Add PD to Serenity backup automation scaffolding

This commit is contained in:
Fizzlepoof
2026-05-15 03:08:03 +00:00
parent 295a22bc1f
commit 5f52b2e6cf
6 changed files with 250 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
#!/usr/bin/bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# shellcheck disable=SC1091
source "$SCRIPT_DIR/pd_backup_lib.sh"
stamp="$(timestamp_utc)"
dbs="${POSTGRES_DB_LIST:-}"
if [[ -z "$dbs" ]]; then
echo "POSTGRES_DB_LIST is empty; nothing to dump." >&2
exit 1
fi
for db in $dbs; do
out="$PD_DB_DUMP_ROOT/${db}_${stamp}.sql.gz"
echo "Dumping Postgres database '$db' to $out"
docker_cmd exec "$POSTGRES_CONTAINER" pg_dump -U postgres "$db" | gzip -9 > "$out"
done
echo "Postgres dumps complete: $PD_DB_DUMP_ROOT"