Backups and restore
Daily database dumps, a full copy with files, and restoring.
Daily database backup
The backup service writes loomark-<date>.dump to deploy/backups every day at BACKUP_HOUR_UTC (01:00 UTC by default) and removes copies older than BACKUP_KEEP_DAYS (14). The folder can be changed with BACKUP_DIR.
docker compose exec backup /bin/sh /backup.sh --onceAttachments
Attachment files live in the minio-data volume. A full copy of database and files is an instance export — see Moving to another server. It is convenient to make one weekly and before updates.
Restore the database
- Step 1Stop the application:
docker compose stop web worker postgrest. - Step 2Recreate the empty database and set its search path (commands below).
- Step 3Restore the dump with
pg_restore. - Step 4Start everything:
docker compose up -d.
cd deploy
docker compose stop web worker postgrest
docker compose exec -T postgres sh -c 'dropdb -U postgres --if-exists loomark && createdb -U postgres loomark'
docker compose exec -T postgres psql -U postgres -d loomark \
-c "alter database loomark set search_path = \"\$user\", public, extensions"
docker compose exec -T postgres pg_restore -U postgres -d loomark --no-owner < backups/loomark-<date>.dump
docker compose up -dDatabase roles are stored in the cluster, not in the database, so on the same server they already exist. On a new server use the instance import instead.