Backup & Restore
Backup & Restore
PostgreSQL backup procedures and restore verification
This runbook covers PostgreSQL backups and basic restore verification.
Backup (PostgreSQL)
- Ensure
DATABASE_URLis set in the environment. - Run the backup script:
The script writes a timestamped dump to BACKUP_DIR (defaults to ./backups).
Verify Backup
- Restore into a temporary database.
- Run a few sanity queries (users, networks, posts).
- Delete the temporary DB after verification.
Restore (PostgreSQL)
- Create a new empty database.
- Restore with
pg_restore:
R2 / Media
R2 backups are not automated yet. If needed, use rclone or Cloudflare’s export tooling to snapshot the bucket.
Automation Hook
Use the script below in cron or your CI scheduler: