Skip to content

Backups

A backup of Lyra is three files:

File What it holds
lyra.dump The database: every page, database, comment, account and setting made in the app
files.tar Uploaded files, images and videos, from the files volume
env.backup A copy of deploy/.env, with your settings and secrets

Keep .env with the other two. Stored sign-in tokens can only be read with its AUTH_SECRET, so a database restored without it signs everyone out and loses those tokens.

Run these in the deploy folder:

Terminal window
umask 077
docker compose exec -T postgres pg_dump -U lyra -Fc lyra > lyra.dump
docker compose exec -T lyra tar -cf - -C /data/files . > files.tar
cp .env env.backup

umask 077 makes the new files readable only by you. Lyra keeps running while you back up.

Back up every day, and keep the copies on another machine, so that losing the server doesn’t lose the backups too.

On a new server, get Lyra as in Install, copy env.backup to deploy/.env and run ./start.sh. Because .env already exists, it skips the questions. Then, in the deploy folder:

Terminal window
docker compose exec -T lyra tar -xf - -C /data/files < files.tar
docker compose stop lyra
docker compose exec -T postgres sh -c 'dropdb -U lyra lyra && createdb -U lyra lyra'
docker compose exec -T postgres pg_restore -U lyra -d lyra < lyra.dump
docker compose up -d --wait

This puts the files back, stops Lyra, replaces the new server’s empty database with the backup and starts Lyra again.

When uploaded files are kept in an S3-compatible bucket, back up the bucket instead of files.tar. Turn on versioning or snapshots for the bucket if your provider offers them, so a deleted or overwritten file can be brought back. See Your own proxy and S3.