PG 16+ funkiness
All checks were successful
Build and Push Docker Image / build (push) Successful in 20s
All checks were successful
Build and Push Docker Image / build (push) Successful in 20s
This commit is contained in:
@@ -51,14 +51,13 @@ while true; do
|
|||||||
FILE="$CONTAINER_BACKUP_DIR/${TIMESTAMP}.sql"
|
FILE="$CONTAINER_BACKUP_DIR/${TIMESTAMP}.sql"
|
||||||
|
|
||||||
mkdir -p "$CONTAINER_BACKUP_DIR"
|
mkdir -p "$CONTAINER_BACKUP_DIR"
|
||||||
echo "[INFO] Backing up container: $NAME ($container)"
|
|
||||||
|
|
||||||
# Try to dump as postgres, fallback to root
|
echo "[INFO] Backing up container: $NAME ($container)"
|
||||||
if docker exec -u postgres -e PGUSER=postgres "$container" pg_dumpall -U postgres >"$FILE" 2>/tmp/pg_backup_error.log; then
|
PG_PASS=$(docker inspect --format '{{range .Config.Env}}{{println .}}{{end}}' "$container" | grep POSTGRES_PASSWORD | cut -d= -f2)
|
||||||
|
if docker exec -e PGPASSWORD="$PG_PASS" "$container" pg_dumpall -U postgres -h 127.0.0.1 >"$FILE" 2>/tmp/pg_backup_error.log; then
|
||||||
echo "[SUCCESS] Backup complete for $NAME -> $FILE"
|
echo "[SUCCESS] Backup complete for $NAME -> $FILE"
|
||||||
else
|
else
|
||||||
echo "[ERROR] Backup failed for $NAME (check /tmp/pg_backup_error.log)"
|
echo "[ERROR] Backup failed for $NAME (check /tmp/pg_backup_error.log)"
|
||||||
rm -f "$FILE"
|
|
||||||
fi
|
fi
|
||||||
# Retention cleanup
|
# Retention cleanup
|
||||||
find "$CONTAINER_BACKUP_DIR" -type f -mtime +$RETENTION_DAYS -name '*.sql' -delete
|
find "$CONTAINER_BACKUP_DIR" -type f -mtime +$RETENTION_DAYS -name '*.sql' -delete
|
||||||
|
|||||||
Reference in New Issue
Block a user