Add database backup/restore script with auto-pruning

scripts/db-backup.sh provides three commands:
- backup: creates a timestamped, gzipped pg_dump (custom format) in ./backups/
- restore: drops, recreates, and loads a backup with confirmation prompt
- list: shows available backups with sizes and dates

Supports --keep N flag for automatic pruning of backups older than N days,
making it cron-friendly for daily automated backups. Also adds backups/
and *.dump.gz to .gitignore.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-02 14:40:51 -05:00
parent 42767e3119
commit 704f29362a
2 changed files with 301 additions and 0 deletions

5
.gitignore vendored
View File

@@ -24,6 +24,11 @@ postgres_data/
redis_data/
pgdata/
# Database backups
backups/
*.dump
*.dump.gz
# SSL
letsencrypt/