backup: nightly pg_dump service on the postgres:18 image

Production Postgres had NO automated backup (pg_dump appeared only in the
one-time migration script). New db-backup service in both compose files fires
20:10 ET Mon-Fri: pg_dump | gzip with pipefail + gunzip -t + tmp-then-rename
(a mid-stream death can't masquerade as a backup), prunes past
BACKUP_KEEP_DAYS, writes last_backup_ok on success. postgres:18 image =
version-matched client (app image has none). TrueNAS host is pull-only, so
its copy inlines the script. Restore: gunzip -c dump | psql $DATABASE_URL.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
momentum devandClaude Fable 5 committed 2026-07-13 16:39:26 -04:00
1 parent 5b95a9712c
commit caee1d5655
4 files changed
+107

No files matched your search

+5
View File
@@ -51,6 +51,11 @@ TELEGRAM_CHAT_ID='2082795871'
DEADMAN_STALE_MIN=5 # alert when no events for this many minutes during market hours
DEADMAN_DAILY_PING=1 # nightly OK-ping after 20:30 ET — proves the watchdog itself is alive
# Nightly pg_dump (db-backup compose service, 20:10 ET Mon-Fri) — the only
# automated backup of the production Postgres. See deploy/docker/backup_db.sh.
BACKUP_DIR=/data/backups # inside the db-backup container (app-data volume)
BACKUP_KEEP_DAYS=14 # prune dumps older than this many days
#Market Data these are free plans so work within days/months capacity.
Alpha_Vantage_Api_Key=<REDACTED>
Twelve_Data_Api_Key=<REDACTED>