Backups
A production installation needs regular backups. Two things must be saved: the PostgreSQL database and the file storage (uploaded documents).
Backing up the database
Create a dump with pg_dump — in the container installation, directly in the DB container:
docker compose exec db pg_dump -U lalabase lalabase_production > backup.sql
For regular backups, a cron job on the host that creates and versions the dump (e.g. to a separate storage) works well.
Backing up file storage
Uploaded files live in the storage volume. Save it as an archive:
docker compose cp web:/rails/storage ./storage-backup
Consistency
Back up the database and storage in the same time window — otherwise references to files may point nowhere.
Restoring
Load a dump into an empty database:
cat backup.sql | docker compose exec -T db psql -U lalabase lalabase_production
Warning
Test your backups regularly with a trial restore. An untested backup is not a backup.