Update backup script to include everything needed to do a bare metal restore of the new V6 server
Quality Gate / gate (push) Failing after 49s

This commit is contained in:
Jim Lancaster
2026-08-26 12:21:40 -05:00
parent 2c6ef46f5f
commit 89ed83239e
5 changed files with 88 additions and 14 deletions
+16 -7
View File
@@ -1,22 +1,25 @@
# Backup and Restore (V6.0 Phase 4)
This guide defines operational backup/restore for the Docker PostgreSQL runtime and Synology replication.
This guide defines operational backup/restore for clean-slate recovery of the Docker runtime and Synology replication.
## 1. Backup artifacts
## 1. Backup artifacts (full recovery set)
- Primary local backup location: `./data/backups`
- Backup format: PostgreSQL custom dump (`pg_dump -Fc`)
- Naming: `postgres-YYYYMMDD-HHMMSS.dump` (UTC timestamp)
- Files created per timestamp:
- `postgres-YYYYMMDD-HHMMSS.dump` (PostgreSQL custom dump via `pg_dump -Fc`)
- `uploads-YYYYMMDD-HHMMSS.tar.gz` (full `/app/uploads` volume; includes `homepage.md`, documents, and photos)
- `config-YYYYMMDD-HHMMSS.tar.gz` (deployment config snapshot: `.env.production`, `docker-compose.production.yml`, `deploy/cloudflared/config.yml`)
- `backup-YYYYMMDD-HHMMSS.manifest` (artifact index)
## 2. Creating backups
Use the scripted command:
Use the scripted command from the repository root:
```bash
sh deploy/backup/create_postgres_backup.sh
```
Optional environment overrides:
Environment overrides:
- `BACKUP_DIR` (default `./data/backups`)
- `BACKUP_RETENTION_DAYS` (default `14`)
@@ -38,12 +41,18 @@ Restore requires downtime for app + worker writes.
- `docker compose --env-file .env.production -f docker-compose.production.yml stop app worker`
2. Restore:
- `sh deploy/backup/restore_postgres_backup.sh ./data/backups/postgres-YYYYMMDD-HHMMSS.dump`
- if same-timestamp `uploads-*.tar.gz` and `config-*.tar.gz` exist in the same directory, they are restored automatically.
3. Start app and worker:
- `docker compose --env-file .env.production -f docker-compose.production.yml start app worker`
4. Validate `/healthz` and run one smoke workflow.
Notes:
- Config restore extracts the archived files back into the current repository path.
- If only the database dump is present, restore runs in database-only mode (legacy behavior).
## 4. Retention and recovery targets
- Retention baseline: keep at least 14 days of backups locally.
- Synology copy: replicate each new backup to DS420j mounted path.
- Synology copy: replicate each backup artifact set to DS420j mounted path.
- Periodic restore drill: run at least once per release cycle to verify recovery.