Skip to content

Weekly off-Neon pg_dump backup (24h PITR is not enough) #58

Description

@Sootopolis

Problem

Neon free plan retains only 24 hours of PITR history. If a bad write lands and isn't caught within 24h, there's no recovery beyond restoring whatever stale dump happens to be lying around. Disaster-recovery floor is too low.

Proposal

Weekly pg_dump -Fc from one of the laptops (or a small cloud VM) to local disk + optional cheap object store.

# Sunday 04:00 UTC
0 4 * * 0 PGPASSWORD=<...> pg_dump \
  -h ep-divine-shape-ab2735ig.eu-west-2.aws.neon.tech \
  -U ccas_owner -d ccas \
  --sslmode=require -Fc \
  -f ~/ccas-backups/ccas-$(date +\%Y\%m\%d).dump
  • Custom-format dump (-Fc) → ~25 MB compressed for current data size.
  • Exclude api_response_cache / api_response_body / api_fetch_failure (rebuildable) → keep dumps small.
  • Retention: 4-8 weekly snapshots, then rolling delete. Decide after first few dumps.
  • Optional: rsync to S3 / B2 / Backblaze for off-site copy.

Scope

  • Documented cron entry + one-shot test of the command.
  • Optional: a tiny shell script in scripts/ (e.g. backup-neon.sh) that wraps pg_dump and prunes old dumps.
  • Optional: README section "Backups".

Out of scope: automated restore drills (later).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:dbSchema, SQL, migrations, MagnumchoreTooling, deps, config, build, cleanup

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions