Rollback SOP
May 20, 2026 · View on GitHub
SQLite
- Stop app container.
- Remove old WAL helper files (server runs in WAL mode — these belong to
the current db, not the backup):
rm -f /data/beecount.db-wal /data/beecount.db-shm - Restore db file (backup is always a clean single file, no -wal / -shm):
cp backups/sqlite/beecount-<ts>.db /data/beecount.db - Start app container. SQLite will auto-create new -wal / -shm on first connection.
- Verify:
GET /ready- Web ledger list and one write smoke test.
Why step 2? In WAL mode
/datacontainsbeecount.db+beecount.db-wal
beecount.db-shm. If you only overwritebeecount.dband leave the old -wal around, SQLite will try to "recover" the old WAL log into the new database and corrupt your restore. Always delete them first.
PostgreSQL
- Stop app container.
- Restore SQL dump:
cat backups/postgres/beecount-<ts>.sql | docker compose -f docker-compose.yml -f docker-compose.postgres.yml exec -T db psql -U beecount -d beecount
- Start app container.
- Verify:
GET /ready- one read + one write API smoke test.
Post-check
GET /metricsis available.admin/sync/errorshas no new critical errors.- If backup artifacts are used, verify:
GET /api/v1/admin/backups/artifacts?ledger_id=<id>- uploaded
snapshotartifacts can be restored viaadmin/backups/restore.