M23: automate verified database backups

This commit is contained in:
NuklearRabbit
2026-08-10 15:46:06 +02:00
parent 689e499634
commit f0f1be83ae
8 changed files with 142 additions and 4 deletions
+12 -4
View File
@@ -25,7 +25,7 @@ cd /mnt/user/appdata/mobilityops
./deploy/unraid/configure-env.sh \
http://192.168.10.150:1236 \
http://192.168.10.150:5678/webhook/mobilityops-return
docker compose -p mobilityops -f compose.yaml -f compose.unraid.yaml up --build -d db api web
docker compose -p mobilityops -f compose.yaml -f compose.unraid.yaml up --build -d db api web backup
docker compose -p mobilityops -f compose.yaml -f compose.unraid.yaml exec api \
python -m app.cli seed --reset
```
@@ -55,14 +55,22 @@ docker logs --tail=200 n8n
## Backup and restore
Create and structurally verify a timestamped PostgreSQL custom-format backup:
The `backup` service creates a backup immediately and then every 24 hours. Every dump is
validated with `pg_restore --list`, receives a SHA-256 sidecar and is retained for 30 days
with at least seven copies protected from pruning. Its healthcheck becomes unhealthy when
no successful backup has been recorded for 26 hours. Configure
`BACKUP_SECONDARY_DESTINATION=/offsite` plus an independently mounted
`MOBILITYOPS_BACKUP_SECONDARY_DIR` for a second copy.
Create an additional on-demand backup or verify the newest scheduled backup:
```bash
./deploy/unraid/backup-postgres.sh
./deploy/unraid/verify-postgres-backups.sh
```
Copy backups off the server according to the host backup policy. A restore is deliberately
guarded and creates an additional safety backup before replacing the database:
A restore is deliberately guarded and creates an additional safety backup before
replacing the database:
```bash
./deploy/unraid/restore-postgres.sh \