Deploy Caddyfile to valhalla / deploy (push) Successful in 1m24s
Plane had been broken since the June env_file cutover (bare DATABASE_URL / SECRET_KEY entries overrode stack.env with empty values, so the migrator never connected) and TB-018 already dropped it. It held one empty project. Removes the 8 Plane services and their env from the dev stack, the plane.ginnoir.com Caddy block, the Authentik forward-auth provider/app, the nightly pg_dump and minio snapshot path, and stale doc references. A final pg_dump + minio tarball is kept at ~/plane-final-20261026 on valhalla. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
65 lines
2.0 KiB
Bash
65 lines
2.0 KiB
Bash
#!/bin/sh
|
|
# Dump all homelab databases to /config/backup/dumps (gzip SQL).
|
|
# Runs inside backup_scheduler; needs docker.sock.
|
|
set -eu
|
|
|
|
DUMP_ROOT=/dumps
|
|
STAMP=$(date +%Y%m%d-%H%M%S)
|
|
DIR="${DUMP_ROOT}/${STAMP}"
|
|
mkdir -p "${DIR}"
|
|
|
|
log() { echo "[backup-dump ${STAMP}] $*"; }
|
|
|
|
dump_postgres() {
|
|
name="$1"
|
|
user="$2"
|
|
db="$3"
|
|
if ! docker ps --format '{{.Names}}' | grep -qx "${name}"; then
|
|
log "skip ${name} (not running)"
|
|
return 0
|
|
fi
|
|
log "dump ${name} → ${db}"
|
|
docker exec "${name}" pg_dump -U "${user}" "${db}" | gzip -c > "${DIR}/${name}.sql.gz"
|
|
}
|
|
|
|
# user: root (default) or app account (e.g. bookstack — root password may not match env)
|
|
# pwvar: optional name of the container env var holding that user's password
|
|
dump_mariadb() {
|
|
name="$1"
|
|
db="$2"
|
|
user="${3:-root}"
|
|
pwvar="${4:-}"
|
|
if ! docker ps --format '{{.Names}}' | grep -qx "${name}"; then
|
|
log "skip ${name} (not running)"
|
|
return 0
|
|
fi
|
|
log "dump ${name} → ${db} (as ${user})"
|
|
if [ -n "${pwvar}" ]; then
|
|
docker exec "${name}" sh -c "mariadb-dump -u \"${user}\" -p\"\${${pwvar}}\" \"${db}\"" \
|
|
| gzip -c > "${DIR}/${name}.sql.gz"
|
|
elif [ "${user}" = "root" ]; then
|
|
docker exec "${name}" sh -c "mariadb-dump -u root -p\"\${MARIADB_ROOT_PASSWORD:-\$MYSQL_ROOT_PASSWORD}\" \"${db}\"" \
|
|
| gzip -c > "${DIR}/${name}.sql.gz"
|
|
else
|
|
docker exec "${name}" sh -c "mariadb-dump -u \"${user}\" -p\"\${MYSQL_PASSWORD:-\$MARIADB_PASSWORD}\" \"${db}\"" \
|
|
| gzip -c > "${DIR}/${name}.sql.gz"
|
|
fi
|
|
}
|
|
|
|
log "starting database dumps → ${DIR}"
|
|
|
|
dump_postgres postgres_gitea gitea gitea
|
|
dump_postgres postgres_authentik authentik authentik
|
|
dump_postgres postgres_famapp famapp famapp
|
|
dump_postgres postgres_resume postgres postgres
|
|
dump_postgres immich-postgres immich immich
|
|
dump_postgres nextcloud-postgres nextcloud nextcloud
|
|
|
|
dump_mariadb mariadb_bookstack bookstack bookstack BOOKSTACK_DB_PASSWORD
|
|
dump_mariadb owncloud_mariadb owncloud
|
|
dump_mariadb romm-db romm
|
|
|
|
find "${DUMP_ROOT}" -mindepth 1 -maxdepth 1 -type d -mtime +14 -exec rm -rf {} + 2>/dev/null || true
|
|
|
|
log "done"
|