feat(backup): dump the Sögin Postgres nightly #8

Merged
jonnxor merged 2 commits from feat/sogin-postgres-dump into main 2026-10-31 19:43:02 +00:00
Owner

Adds the Sögin Postgres to the nightly backup (DATA-02, D-06).

What changes

  • dump_sogin in backup/run.sh: pg_dump from the sogin-postgres container, plain SQL, through a temp file and a move, owner-only (700 directory, 600 file). A failed dump is logged loudly and does not abort the rest of the backup; the last good dump stays in place.
  • A fixed --restrict-key=sogin, so two dumps of an unchanged database are byte-identical and restic can deduplicate them.
  • backup/include.txt gains ~/Backups/sogin-postgres.
  • Monthly verify gains check 6: the dump in the latest snapshot ends with -- PostgreSQL database dump complete. The snapshot-age check is now 7.
  • restore-sogin case and mise run backup:restore-sogin: pull the dump from the latest B2 snapshot into ~/Backups/sogin-restore, which is never backed up. The restore trial itself lives in the sogin repo's runbook.
  • README updated to match.

Merge order, please read

Do not merge until the sogin-postgres unit is deployed on hades and has been dumped once.
The monthly verify (next run on the 1st) fails on a snapshot with no Sögin dump, so merging early makes the verify raise a false alarm. Until sogin-postgres runs, dump_sogin just skips. The sogin repo's plan 02-12 does this in order: deploy, first dump, then this merge.

Tested

  • sh -n backup/run.sh
  • dump_sogin against a throwaway postgres:17.11 container: dump complete line present, mode 600, two runs byte-identical.
  • Skip path with no container returns 0; a failing pg_dump leaves the previous dump untouched.
  • restore-sogin against a throwaway local restic repository (not B2).

🤖 Generated with Claude Code

Adds the Sögin Postgres to the nightly backup (DATA-02, D-06). ## What changes - `dump_sogin` in `backup/run.sh`: `pg_dump` from the `sogin-postgres` container, plain SQL, through a temp file and a move, owner-only (700 directory, 600 file). A failed dump is logged loudly and does not abort the rest of the backup; the last good dump stays in place. - A fixed `--restrict-key=sogin`, so two dumps of an unchanged database are byte-identical and restic can deduplicate them. - `backup/include.txt` gains `~/Backups/sogin-postgres`. - Monthly verify gains check 6: the dump in the latest snapshot ends with `-- PostgreSQL database dump complete`. The snapshot-age check is now 7. - `restore-sogin` case and `mise run backup:restore-sogin`: pull the dump from the latest B2 snapshot into `~/Backups/sogin-restore`, which is never backed up. The restore trial itself lives in the sogin repo's runbook. - README updated to match. ## Merge order, please read **Do not merge until the `sogin-postgres` unit is deployed on hades and has been dumped once.** The monthly verify (next run on the 1st) fails on a snapshot with no Sögin dump, so merging early makes the verify raise a false alarm. Until `sogin-postgres` runs, `dump_sogin` just skips. The sogin repo's plan 02-12 does this in order: deploy, first dump, then this merge. ## Tested - `sh -n backup/run.sh` - `dump_sogin` against a throwaway `postgres:17.11` container: dump complete line present, mode 600, two runs byte-identical. - Skip path with no container returns 0; a failing `pg_dump` leaves the previous dump untouched. - `restore-sogin` against a throwaway local restic repository (not B2). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
- dump_sogin writes plain SQL through a temp file and a move, owner-only
- fixed --restrict-key keeps two dumps of an unchanged database identical
- monthly verify gains a check for the dump's completion line

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
feat(backup): restore the Sögin dump from a snapshot
All checks were successful
CI / sanity (pull_request) Successful in 6s
a356f5755e
- restore-sogin case and backup:restore-sogin task pull the dump into
  ~/Backups/sogin-restore, which include.txt does not cover
- the desk owns this step because only it holds restic's credentials

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
WAAAGH/_workdesk!8
No description provided.