apps(backup): nightly Forgejo data + CNPG dumps to the Linode, and prove a restore #17

Merged
sirius merged 2 commits from feat/t_dcad85f6-backups into master 2026-11-19 22:11:51 +00:00
Owner

Nothing backed up Forgejo or the CloudNativePG databases. This adds one nightly path and exercises a restore.

What runs: CronJob forgejo/cluster-backup, 37 2 * * * UTC, Forbid, destination [email protected]:/root/cluster-backup over the WireGuard mesh (never the public IP, never a PV on the same disk).

  • forgejo-data PVC → rsync -a --delete --link-dest=../latest snapshot mirror, read-only mount, transient upload spools excluded, rsync exit 24 tolerated (Forgejo is live while it copies).
  • forgejo/pg and sirius-growth/portal → pg_dump -Fc -Z6 run inside the CNPG primary over the local socket (no DB password in git or in the Job), sha256 compared local-vs-remote before the .part rename.
  • Every run writes manifests/<stamp>.txt (sizes + checksums) remotely; retention 7 data snapshots / 14 dumps; remote free-space guard (8 GiB min).
  • Nothing staged on siriussec (83 % full → DiskPressure hazard); the pod carries ephemeral-storage: 1Gi so a regression cannot stage the PVC on the T480.
  • Job lives in ns forgejo (a PVC cannot be mounted cross-namespace); the portal dump uses exec-only RBAC declared in apps/base/sirius-growth/backup-exec-rbac.yaml.
  • Only secret: forgejo/cluster-backup-ssh — out of band, not in git; ed25519 key from=-restricted on the Linode, host key pinned.

Verified live (hand-fired Job cluster-backup-manual-3): RESULT=success; first full mirror 19 GiB then an incremental run sending 4.4 MB (speedup 4290, hardlinked snapshots: du total 19 G for 3 snapshots); dumps forgejo-pg 10,133,865 B sha 6252104…, sirius-growth-portal 178,932 B. Restore rehearsal: pulled the dump back from the Linode into a throwaway Postgres pod → repository=1225 user=5811 issue=402 pull_request=392 tables=130 (matches live 1225/5811/402/392).

docs/cluster-overview.md §8.1 now states what is covered and the honest gaps (Grafana sqlite, osint pgdata, sgs-leadgen-data, Pi /etc/wireguard), §8.2 the restore runbook.

Nothing backed up Forgejo or the CloudNativePG databases. This adds one nightly path and exercises a restore. **What runs:** CronJob `forgejo/cluster-backup`, `37 2 * * *` UTC, `Forbid`, destination `[email protected]:/root/cluster-backup` over the WireGuard mesh (never the public IP, never a PV on the same disk). * `forgejo-data` PVC → `rsync -a --delete --link-dest=../latest` snapshot mirror, read-only mount, transient upload spools excluded, rsync exit 24 tolerated (Forgejo is live while it copies). * `forgejo/pg` and `sirius-growth/portal` → `pg_dump -Fc -Z6` run *inside* the CNPG primary over the local socket (no DB password in git or in the Job), sha256 compared local-vs-remote before the `.part` rename. * Every run writes `manifests/<stamp>.txt` (sizes + checksums) remotely; retention 7 data snapshots / 14 dumps; remote free-space guard (8 GiB min). * Nothing staged on siriussec (83 % full → DiskPressure hazard); the pod carries `ephemeral-storage: 1Gi` so a regression cannot stage the PVC on the T480. * Job lives in ns `forgejo` (a PVC cannot be mounted cross-namespace); the portal dump uses exec-only RBAC declared in `apps/base/sirius-growth/backup-exec-rbac.yaml`. * Only secret: `forgejo/cluster-backup-ssh` — out of band, not in git; ed25519 key `from=`-restricted on the Linode, host key pinned. **Verified live (hand-fired Job `cluster-backup-manual-3`)**: `RESULT=success`; first full mirror 19 GiB then an incremental run sending 4.4 MB (speedup 4290, hardlinked snapshots: `du` total 19 G for 3 snapshots); dumps `forgejo-pg` 10,133,865 B sha 6252104…, `sirius-growth-portal` 178,932 B. Restore rehearsal: pulled the dump back **from the Linode** into a throwaway Postgres pod → `repository=1225 user=5811 issue=402 pull_request=392 tables=130` (matches live 1225/5811/402/392). `docs/cluster-overview.md` §8.1 now states what is covered and the honest gaps (Grafana sqlite, osint pgdata, sgs-leadgen-data, Pi `/etc/wireguard`), §8.2 the restore runbook.
Nothing on this platform backed up Forgejo or the CloudNativePG databases;
docs/cluster-overview.md had claimed both must be backed up for months.

New CronJob forgejo/cluster-backup (37 2 * * * UTC, Forbid) streams to
[email protected]:/root/cluster-backup over the WireGuard mesh:

  * forgejo-data PVC mirrored with rsync --link-dest (snapshot per night,
    hardlinked, readonly PVC mount, transient upload spools excluded, rsync
    exit 24 tolerated because Forgejo is live while it runs);
  * pg_dump -Fc from inside each CNPG primary (local socket, no DB password
    in git) for forgejo/pg and sirius-growth/portal, sha256-verified on both
    sides before the .part file is renamed.

Nothing is staged on siriussec (83% full, DiskPressure hazard); the job has
an ephemeral-storage cap of 1Gi to make that structural. Job lives in ns
forgejo because a PVC cannot be mounted cross-namespace; the portal dump uses
exec-only RBAC declared in apps/base/sirius-growth/backup-exec-rbac.yaml.

Only secret is forgejo/cluster-backup-ssh (out of band, not in git):
from=-restricted ed25519 key on the Linode, host key pinned.

docs/cluster-overview.md: §8.1 coverage + honest gaps, §8.2 restore runbook,
live PVC/disk numbers corrected.
sirius merged commit 094ee2c704 into master 2026-11-19 22:11:51 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/homek8s!17
No description provided.