ops: nightly DB backup + self-hosted uptime monitoring
CI/CD / CI · API (dotnet build + test) (push) Successful in 41s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 30s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m10s
CI/CD / CI · Admin Web (tsc) (push) Successful in 37s
CI/CD / CI · Website (tsc) (push) Successful in 44s
CI/CD / CI · Koja (tsc) (push) Successful in 50s
CI/CD / Deploy · all services (push) Successful in 1m48s

Backup (production data-loss protection — was none):
- meezi-backup sidecar in docker-compose.yml runs pg_dump nightly at 02:00
  Tehran, gzip, 14-day rotation, atomic .partial→final, into ./backups
  (persists across deploys; rsync off-box per RESTORE.md).
- Wired into the deploy job (up -d --no-deps backup); takes one dump on boot.
- scripts/backup/pg-backup-loop.sh + RESTORE.md (restore + off-box guidance).

Monitoring:
- docker-compose.monitoring.yml: Uptime Kuma stack (own volume), stood up
  once, independent of app deploys.
- Caddyfile status.{$DOMAIN} route; docs/monitoring.md lists the exact
  monitors (incl. /q guest-menu 200 check) + TLS-expiry alerts (catches the
  ~90-day cert breakage early) + alert-channel setup.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-15 18:45:07 +03:30
parent d407f0b3e9
commit 32a7cf5b25
7 changed files with 231 additions and 0 deletions
+24
View File
@@ -177,6 +177,30 @@ services:
ports:
- "${KOJA_PORT:-3103}:3000"
# Nightly Postgres backup — dumps the DB every night, keeps the last 14 days.
# Dumps land in the host ./backups dir (bind mount) so they survive a full
# container/volume wipe and can be rsync'd off-box. See scripts/backup/RESTORE.md.
backup:
image: ${POSTGRES_IMAGE:-mirror.soroushasadi.com/postgres:16-alpine}
container_name: meezi-backup
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
PGHOST: postgres
PGPORT: "5432"
PGUSER: meezi
PGPASSWORD: "${DB_PASSWORD:-meezi_local_pass}"
PGDATABASE: meezi
RETAIN_DAYS: "${BACKUP_RETAIN_DAYS:-14}"
BACKUP_HOUR: "${BACKUP_HOUR:-2}"
TZ: Asia/Tehran
entrypoint: ["/bin/sh", "/backup/pg-backup-loop.sh"]
volumes:
- ./scripts/backup:/backup:ro
- ${BACKUP_DIR:-./backups}:/backups
volumes:
postgres_data:
redis_data: