Back up and restore an instance
A library backup saves your library in one file: recipes, photos, books, tags, history, and the original files you kept from imports. Make one regularly, keep a copy somewhere else, and practice a restore now and then so you know it works.
Choose your deployment method in the tabs. Native commands run as the system user that owns the database and assets folder. If savorum isn’t on your PATH, use its full path, such as ./bin/savorum.
Container examples use the container or Compose service name savorum. Create /var/backups/savorum on the host and give user and group 65532:65532 read and write access. It is mounted at /backups in the temporary container. Docker CLI examples read the server’s image ID and reuse its data mounts; Compose examples use the service’s image and mounts.
Make and check a backup
Section titled “Make and check a backup”Back up to a folder outside Savorum’s data folder, then verify the file:
Back up and verify savorum_image=$(docker inspect --format '{{.Image}}' savorum) &&docker run --rm --read-only --volumes-from savorum \-v /var/backups/savorum:/backups \"$savorum_image" backup \--database /data/savorum.db --assets /data/assets \--output /backups/instance.savorum-backup &&docker run --rm --read-only --volumes-from savorum \-v /var/backups/savorum:/backups:ro \"$savorum_image" verify --input /backups/instance.savorum-backupBack up and verify docker compose run --rm --no-deps \-v /var/backups/savorum:/backups \savorum backup \--database /data/savorum.db --assets /data/assets \--output /backups/instance.savorum-backup &&docker compose run --rm --no-deps \-v /var/backups/savorum:/backups:ro \savorum verify --input /backups/instance.savorum-backupUse the Docker CLI instructions from a terminal on the container host. Replace
savorumwith the container name shown by your manager. The temporary container uses the server’s image and data mounts.Back up and verify savorum backup \--database /var/lib/savorum/savorum.db \--assets /var/lib/savorum/assets \--output /var/backups/savorum/instance.savorum-backup &&savorum verify --input /var/backups/savorum/instance.savorum-backupCopy the backup somewhere else, such as another disk or a cloud drive, and run
verifyon the copy. For a container, mount the copy’s folder at/backupsinstead.Every so often, practice a restore.
verify checks that the file is complete and undamaged, and that this version of Savorum can restore it. It doesn’t change your running server. Verify with the same version you’ll restore with.
Checksums catch damage, not tampering. Verifying finds a corrupted backup, but can’t tell who made it. Someone who can replace a backup can replace its checksums too. Protect where you store backups, and only restore one you trust.
Encrypted backups
Section titled “Encrypted backups”Add --encrypt to seal the backup, and your webhook signing keys, in one password-protected file. Savorum asks for the password twice, or reads it from --password-file FILE (- reads standard input), which also turns on encryption:
savorum_image=$(docker inspect --format '{{.Image}}' savorum) &&docker run --rm -it --read-only --volumes-from savorum \ -v /var/backups/savorum:/backups \ "$savorum_image" backup \ --database /data/savorum.db --assets /data/assets \ --encrypt --output /backups/instance.savorum-backup.agedocker compose run --rm --no-deps \ -v /var/backups/savorum:/backups \ savorum backup \ --database /data/savorum.db --assets /data/assets \ --encrypt --output /backups/instance.savorum-backup.ageUse the Docker CLI instructions from a terminal on the container host. Replace savorum with the container name shown by your manager. The temporary container uses the server’s image and data mounts.
savorum backup \ --database /var/lib/savorum/savorum.db \ --assets /var/lib/savorum/assets \ --encrypt \ --output /var/backups/savorum/instance.savorum-backup.ageverify and restore ask for the password, or read it from --password-file. The file is an age file, so the standard age tool can decrypt it too.
Restore a backup
Section titled “Restore a backup”Restore replaces everything on the target server. Don’t merge restored files into a current assets folder, and don’t use a full backup to bring back selected recipes. Stop the server before restoring. Don’t restore inside a running container.
Stop the server and use its image and data mounts for verification and restore:
savorum_image=$(docker inspect --format '{{.Image}}' savorum) &&docker stop savorum &&docker run --rm --read-only --volumes-from savorum \ -v /var/backups/savorum:/backups:ro \ "$savorum_image" verify --input /backups/instance.savorum-backup &&docker run --rm --read-only --volumes-from savorum \ -v /var/backups/savorum:/backups:ro \ "$savorum_image" restore --input /backups/instance.savorum-backup \ --database /data/savorum.db --assets /data/assets &&docker start savorumRestore a Compose deployment
Section titled “Restore a Compose deployment”Mount the backup folder read-only, and use the same data volume and paths as the service:
docker compose stop savorum &&docker compose run --rm --no-deps \ -v /var/backups/savorum:/backups:ro \ savorum verify --input /backups/instance.savorum-backup &&docker compose run --rm --no-deps \ -v /var/backups/savorum:/backups:ro \ savorum restore --input /backups/instance.savorum-backup \ --database /data/savorum.db --assets /data/assets &&docker compose up -d savorumStop the Savorum container in your manager, then use the Docker CLI instructions from a terminal on the host. Replace savorum with its container name. Start that container again after a successful restore.
-
Stop Savorum, using whatever normally runs it.
-
Verify the backup with the same version of Savorum that will run it, then restore:
Verify and restore savorum verify --input /var/backups/savorum/instance.savorum-backup &&savorum restore --input /var/backups/savorum/instance.savorum-backup \--database /var/lib/savorum/savorum.db --assets /var/lib/savorum/assets -
Start Savorum.
Open a few recipes and books, check history and the trash, and load some photos.
If you use Connect, set it up on the replacement server.
An encrypted restore also puts back the webhook signing keys. It refuses if <database>.webhook-secrets already holds keys.
Practice a restore
Section titled “Practice a restore”Restore into a new, empty folder or volume, so your real server isn’t touched. With the source build:
./bin/savorum backup \ --database ./data/savorum.db \ --assets ./data/assets \ --output ./data/instance.savorum-backup./bin/savorum verify --input ./data/instance.savorum-backupinstall -d -m 700 ./restore-data./bin/savorum restore \ --input ./data/instance.savorum-backup \ --database ./restore-data/savorum.db \ --assets ./restore-data/assets./bin/savorum check-database --database ./restore-data/savorum.dbWrite down the backup date, the Savorum version, how long it took, and what you checked.
Move from Savorum Cloud
Section titled “Move from Savorum Cloud”Savorum Cloud gives the library owner a .savorum-backup.age download in the encrypted backup format. It restores with the Savorum command-line tools; it is not a recipe file to import in the app. Keep the password you chose when preparing it. To move it to your own server:
- Restore the download with its password. This also installs its webhook signing keys.
- Run
hosting showand note theowner_user_idit prints. - Give the owner a local password. Leave out
--loginif the account already has a local login. - Release the hosting link. This requires a local administrator with a password.
savorum verify --input library.savorum-backup.agesavorum restore --input library.savorum-backup.age \ --database /data/savorum.db --assets /data/assetssavorum hosting show --database /data/savorum.dbsavorum user reset-password --database /data/savorum.db \ --user-id OWNER_ID --login ownersavorum hosting release --database /data/savorum.dbReplace OWNER_ID with owner_user_id from hosting show. The password reset asks for a new local sign-in password; verify and restore ask for the backup password. Add --password-file FILE or --password-file - when running without an interactive terminal.
Releasing turns off the Cloud sign-in and signs out its sessions and tokens. Your recipes, libraries, and roles stay. Then remove the Cloud provider from your provider file if you copied one, set --public-url to your own address, and start Savorum with --auth-enabled.
Passkeys stay tied to the old address, so they stop working. Sign in with the password, then add new passkeys.
Good to know
Section titled “Good to know”- Webhook signing keys, in the
<database>.webhook-secretsfolder beside the database, aren’t in a plain backup. Back them up separately with the same care, use an encrypted backup, or replace every webhook secret after a restore. - Resized photos aren’t in the backup; Savorum makes them again. Temporary job files aren’t backed up.
- Backup refuses to start unless the destination has room for about twice the database, plus all original files, plus 512 MiB.
savorum storage --backup-directory DIRshows the expected size and free space. - Verify and restore need free space of about three times the database, plus the original files, plus 512 MiB.
- A backup holds the database’s write lock while it copies, so run a large backup at a quiet time.
- Encrypting or decrypting needs about 528 MiB of free memory. A server with 512 MiB refuses before writing anything. Plain backups still work there; open encrypted ones on a machine with more memory.
verifyandrestoreaccept at most 64 GiB of uncompressed content. For a larger backup you trust, add--max-expanded-bytes BYTESto both, such as--max-expanded-bytes 137438953472.- Backup files are readable only by their owner (
0600). Never make them world-readable. If your server uses group storage, setSAVORUM_STORAGE_ACCESS=groupfor everybackupandrestoretoo. For Docker CLI examples, add-e SAVORUM_STORAGE_ACCESS=groupbefore the image name; Compose inherits the service’s environment. - If a restore is interrupted, start Savorum normally with the same paths so it can finish recovering. Never delete the lock file, recovery journal, SQLite
-walor-shmfiles, or older copies to force it to start.