Skip to content
ConceptForOperatorWith or without Foxden Admin

Running Library ​

This page covers what is specific to running Library on your server: its file store, which holds the other apps' files too, its PDF renderer, and how its backup proves itself.

Where it runs ​

Folder/opt/library
Addresslibrary.<your-domain>, with live editing at /collab on the same address
On the server127.0.0.1:3480 (the app) and 127.0.0.1:3481 (live editing)
Servicesapp, collab (live editing), extractor (reads the text out of files), renderer (makes PDFs), db, migrate, updater
SettingsLibrary settings

In some foxden output and on Admin's Products page, Library is shown under an older name. --product library names it in every command.

The file store ​

Library keeps every file in its file store. On a server with other apps, it is their file store too: once Fennec, Corsac, Pampas, Culpeo and Admin are linked to Library, the files they store go to Library. See The file store.

  • By default the store is a folder on the server (the library-files volume). Its size on Server sizes leaves the files out: plan the disk for what your team keeps. One file can be up to 500 MB (LIBRARY_MAX_FILE_MB), and each space has an upload quota of 10 GB unless it sets its own (LIBRARY_SPACE_QUOTA_MB, 0 for none).
  • To keep the files in a bucket instead, on any S3-compatible service, set LIBRARY_S3_ENDPOINT, LIBRARY_S3_BUCKET, LIBRARY_S3_ACCESS_KEY_ID and LIBRARY_S3_SECRET_ACCESS_KEY (and LIBRARY_S3_REGION when it is not us-east-1), then restart Library. The folder then only holds uploads on their way in.

A file's bytes stay in the store for 35 days after nothing refers to them any more (LIBRARY_BLOB_RETENTION_DAYS). Keep that longer than backups are kept (BACKUP_KEEP_DAYS, 14), so every kept backup's files are still there.

Its backup ​

The nightly backup at 01:55 is a database dump and a copy of the file store, made so that nothing is copied twice. It reads back every file the dump refers to and checks each one; if one is missing or wrong, the backup fails, is not kept, and the alert runs. What it found is kept in backups/last-proof.

  • The dump goes off the server with the off-site copy, like every app's.
  • The file copy is kept in /opt/library/backups/files, on the same server. To copy it off the server, set LIBRARY_FILES_REMOTE to an rclone crypt remote that you set up and keep the key of. Until then, the files of Library and of every linked app are only on the server.
  • With the store in a bucket, set BACKUP_FILES_SOURCE to rclone's name for that bucket, so the backup can read it.

Restore the database and the files together with foxden backup restore. See Back up and restore.

PDFs ​

Library makes PDFs with its own renderer, a headless Chromium. It runs locked down: read-only, as a user that is not root, with no capabilities, its own seccomp profile, and on an internal network with no way off the server; inside it, every request a page makes is blocked. Its limits are settings: LIBRARY_RENDERER_MEMORY, LIBRARY_RENDERER_CPUS, LIBRARY_RENDERER_PIDS and LIBRARY_RENDERER_TMP_MB. A new install has PDFs on (LIBRARY_RENDERER_URL); leave it blank to turn them off.

Email ​

Library sends email only when it has both a sender and a key, which foxden email set and Server › Connections give it together. It refuses to start with one and not the other. It can also send through your own mail server with SMTP_URL. See Set up outgoing email.

Secrets and sign-in ​

Library's APP_SECRET signs sessions and live-editing tokens. A new one signs everybody out; keep it with the server.

With Admin on the server, people sign in to Library through Admin. On its own, the hand-over screen prints a setup link (/setup?token=...) that creates Library's first account; foxden console link --product library prints it again until that account exists.

Foxden is open source under Apache-2.0.