feat: verify postgres backups
Quality / test (push) Canceled after 0s

This commit is contained in:
2026-09-09 18:38:57 -04:00
parent cb26d16061
commit 73b4b9795e
3 changed files with 50 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
set -eu
: "${BACKUP_FILE:?Set BACKUP_FILE to a PostgreSQL custom-format dump}"
if [ ! -f "$BACKUP_FILE" ]; then
printf '%s\n' "Backup file not found: $BACKUP_FILE" >&2
exit 1
fi
if [ ! -s "$BACKUP_FILE" ]; then
printf '%s\n' "Backup file is empty: $BACKUP_FILE" >&2
exit 1
fi
docker compose -f compose.production.yaml run --rm -T postgres \
pg_restore --list < "$BACKUP_FILE" >/dev/null
printf '%s\n' "Backup archive is readable: $BACKUP_FILE"