ops(#35): database backup & restore scripts + DR guide - #61
Merged
Conversation
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, compressedpg_dump(custom format), prunes dumps older thanRETENTION_DAYS(default 14). ValidatesDATABASE_URLand thatpg_dumpis installed.scripts/restore.sh—pg_restore --clean --if-existsinto a target DB, with a confirmation pause.make backupconvenience target.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.