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.
Back up
Section titled “Back up”Run these in the deploy folder:
umask 077docker compose exec -T postgres pg_dump -U lyra -Fc lyra > lyra.dumpdocker compose exec -T lyra tar -cf - -C /data/files . > files.tarcp .env env.backupumask 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.
Restore
Section titled “Restore”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:
docker compose exec -T lyra tar -xf - -C /data/files < files.tardocker compose stop lyradocker 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.dumpdocker compose up -d --waitThis puts the files back, stops Lyra, replaces the new server’s empty database with the backup and starts Lyra again.
When files are in S3
Section titled “When files are in S3”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.