# Nightly pg_dumpall streamed into restic on LXC 105, then a ping to the # "Backup – Postgres (k3s)" Push monitor in Uptime Kuma. # Suspended until postgres-backup-secrets exists (README, "Postgres backups"). apiVersion: batch/v1 kind: CronJob metadata: name: postgres-backup spec: suspend: true schedule: "45 2 * * *" timeZone: Europe/Paris concurrencyPolicy: Forbid jobTemplate: spec: backoffLimit: 1 template: spec: restartPolicy: Never containers: - name: backup image: postgres:17.11-alpine envFrom: - secretRef: name: postgres-secrets - secretRef: name: postgres-backup-secrets command: - /bin/sh - -ec - | set -o pipefail apk add --no-cache restic curl >/dev/null restic cat config >/dev/null 2>&1 || restic init export PGPASSWORD="$POSTGRES_PASSWORD" pg_dumpall -h postgres -U postgres \ | restic backup --stdin --stdin-filename pg_dumpall.sql --host k3s-postgres restic forget --host k3s-postgres --keep-daily 7 --keep-weekly 4 --keep-monthly 3 --prune curl -fsS -m 10 -o /dev/null "$KUMA_PUSH_URL"