Auto-discover databases from postgres — remove static BACKUP_DATABASES list
This commit is contained in:
parent
5e7093c115
commit
c72ebdf79a
3 changed files with 8 additions and 2 deletions
|
|
@ -2,7 +2,6 @@ WEBHOOK_SECRET=CHANGE_ME_match_forgejo_webhook_secret
|
|||
CENTRAL_AUTH_SECRET=CHANGE_ME_same_as_auth_service
|
||||
AUTH_URL=http://10.10.10.101:3001
|
||||
PG_SUPERPASS=CHANGE_ME_postgres_superuser_password
|
||||
BACKUP_DATABASES=auth_db noticeboard_db cashup_db hk_planner_db twin_optimiser_db room_planner_db maintenance_db forecasting_db rates_db settings_db
|
||||
SETTINGS_URL=http://10.10.10.116:3080
|
||||
SETTINGS_SECRET=CHANGE_ME_same_as_settings_service
|
||||
KUMA_PUSH_URL=http://localhost:3001/api/push/KUMA_TOKEN
|
||||
|
|
|
|||
|
|
@ -92,6 +92,14 @@ done
|
|||
|
||||
# ── PostgreSQL dumps ──────────────────────────────────────────────────────────
|
||||
log "PostgreSQL backups..."
|
||||
BACKUP_DATABASES=$(PGPASSWORD="$PG_SUPERPASS" psql -h "$PG_HOST" -U postgres -t -A -c \
|
||||
"SELECT datname FROM pg_database WHERE datistemplate = false AND datname != 'postgres' ORDER BY datname" \
|
||||
2>/dev/null) || true
|
||||
if [ -z "$BACKUP_DATABASES" ]; then
|
||||
err "Could not list databases from postgres"
|
||||
finish "error" "Could not connect to postgres to list databases"
|
||||
exit 1
|
||||
fi
|
||||
for DB in $BACKUP_DATABASES; do
|
||||
log " ${DB}..."
|
||||
TARGET="${NC_DAV}/postgres/daily/${DB}_${TIMESTAMP}.sql.gz"
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ services:
|
|||
- apparmor=unconfined
|
||||
entrypoint: ["/bin/sh", "-c", "crond -f -l 8"]
|
||||
environment:
|
||||
- BACKUP_DATABASES=${BACKUP_DATABASES}
|
||||
- PG_SUPERPASS=${PG_SUPERPASS}
|
||||
- KUMA_PUSH_URL=${KUMA_PUSH_URL}
|
||||
- SETTINGS_URL=${SETTINGS_URL:-http://10.10.10.116:3080}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue