Skip to content

ops(#35): database backup & restore scripts + DR guide - #61

Merged
mondial7 merged 1 commit into
mainfrom
ops/backups-and-dr
Jul 11, 2026
Merged

ops(#35): database backup & restore scripts + DR guide#61
mondial7 merged 1 commit into
mainfrom
ops/backups-and-dr

Conversation

@mondial7

Copy link
Copy Markdown
Owner

Closes #35 — the main ops gap for a self-hosted deployment.

Since the app is stateless (templates/assets embedded in the binary) and all state lives in PostgreSQL, a database dump is a full backup.

  • scripts/backup.sh — timestamped, compressed pg_dump (custom format), prunes dumps older than RETENTION_DAYS (default 14). Validates DATABASE_URL and that pg_dump is installed.
  • scripts/restore.shpg_restore --clean --if-exists into a target DB, with a confirmation pause.
  • make backup convenience target.
  • Deployment guide gains a "Backups & disaster recovery" section: nightly cron example, Docker Compose variant, and a restore drill (the app re-applies migrations on boot).

Validated end-to-end against a real Postgres (dump → restore into a scratch DB → row counts intact). No code changes; ships under [Unreleased] and rides the next release.

- scripts/backup.sh: timestamped, compressed pg_dump (custom format) with
  retention pruning; scripts/restore.sh: pg_restore with --clean --if-exists.
  Both wrap the standard PG client tools and validate DATABASE_URL / tool presence.
- make backup target; 'Backups & disaster recovery' section in the deployment
  guide (nightly cron, Docker Compose variant, restore drill, off-host reminder).
- Backup+restore flow validated end-to-end against a real Postgres.

All state is in Postgres (the binary is stateless), so a DB dump is a full backup.
@mondial7
mondial7 merged commit c41ec57 into main Jul 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Database backups & disaster recovery

1 participant