backup(portal): barman-cloud PITR via a Linode-side Garage WAL archive #19
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/t_ce7d6772-pitr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this does
sirius-growth/portalhad a 24 h-RPO nightlypg_dumpand no way to roll forward — a bad write at 14:00 lost everything since 02:37. This adds continuous WAL archiving plus a daily base backup into a second, independent Garage node on the Linode, and proves a restore to a point in time end to end.The primary (
siriussec) and the Pi's Garage are in the same building on the same power domain and uplink, so the archive deliberately does not go to the Pi's store. It goes to the Linode, which is the only off-site box in the estate.1. S3 target on the Linode —
infrastructure/garage-linode/A separate single-node Garage (
dxflrs/garage:v1.1.0, same pinned tag as the Pi) — not a peer of the Pi's noded053db4dfc97bf78: ownnode_key, ownmeta/,replication_factor = 1, capacity 20 GB.linodeis a kubelet node: installingdockerdbeside its containerd would add a second runtime for nothing. One declarative/etc/containers/systemd/garage.container, systemd owns the lifecycle, no daemon.10.10.0.5only —garage.tomlbinds10.10.0.5:3900(S3) and10.10.0.5:3903(admin/metrics). No0.0.0.0listener anywhere,eth0(public) never bound.inet wal_archive_guard, PREROUTING priority -140: acceptlo/wg0(+10.244.0.0/16for local pods), drop the rest, counters on both rules. Same pattern as the Pi'sgarage-firewall.nft; ufw alone would not cover a container publish.pg-wal-archive, private,Website access: false. Keycnpg-portal-wal(GK7f2b4bb1fc9abaec50fde37b) is read+write on that bucket only, no bucket-create. Values are in Secretsirius-growth/portal-wal-s3— not in git, not in this PR, not in any comment.install.sh(idempotent),README.md(ports, exposure proof, sizing, retention),pitr-restore.md(the rehearsal transcript).Disk sizing (measured)
/data/9.3 MB incl. block-store overhead,meta/4.6 MB)archive_timeout/wal_segment_sizeThe 20 GB cap is intentional: at the cap Garage returns
507 InsufficientStorageand theBackup/ScheduledBackupgoes red instead of the Linode disk filling. The response then isretentionPolicy: 7d, not deleting WALs by hand.2. CNPG barman-cloud for
sirius-growth/portalonlyapps/base/sirius-growth/cluster.yaml:spec.backup.barmanObjectStore,destinationPath: s3://pg-wal-archive(bucket root — barman appends the server name, so the prefix isportal/base+portal/wals, andforgejo/pgcan share the bucket later without colliding),endpointURL: http://10.10.0.5:3900, gzip on WAL and data,retentionPolicy: "14d".apps/base/sirius-growth/scheduled-backup.yaml:ScheduledBackup portal-daily,0 20 3 * * *(six-field, seconds first) = 03:20 UTC.barmanObjectStoreand not the CNPG-I plugin: the operator (1.30.0, pinned ininfrastructure/databases/base/upstream/) still ships barman-cloud in-tree and it is the same binaries; the plugin would add a Deployment + CNPG-I registration + TLS to keep alive on a 3-node homelab. The operator is explicit that 1.31 removes the in-tree path, so this is documented in §8.1 as a hard migration gate before any 1.31 bump. Say the word if you'd rather I do the plugin now and hold this PR.forgejo/pgis not touched on this pass (a day of git history is annoying, not costly).3. PITR is proven, not asserted
…059archived 22:35:07Z).…05Aarchived 22:35:29Z). Both WALs are in the archive — the restore has to choose to stop, it is not starved of data.Cluster portal-pitr-testwithbootstrap.recovery→externalClusters(serverName: portal) andtargetTime: 2026-11-19T22:35:15Z.Rest of the database came back too (physical restore):
clients 4 = 4,calendar_tokens 3 = 3,applications 1 = 1. Test cluster deleted afterwards, probe table dropped from the primary; nothing was written to production data.4. Live evidence
5. Existing job unchanged
sirius-growth/portalstays inCNPG_TARGETSas a logical second copy: it is readable with plainpg_restoreon any box, it does not depend on barman or on the Linode Garage node, and it is the fallback if the archive is ever unusable. The RPO now comes from the WAL archive, not from the dump, so the dump is redundancy rather than the primary.forgejo/pgandosint/osint-dbkeep their nightly dumps unchanged.6. Docs
docs/cluster-overview.md: new §5.1 (the WAL store: where, ports, firewall, node id, key scope), §8.1 counts five paths, the coverage table row shows both copies, the sizing/deprecation/credentials bullets are added, the "no PITR" gap is explicitly closed, and the "a new CNPG cluster is not picked up automatically" note now covers barman prefixes. New §8.3 is the restore recipe (target time → throwaway cluster → verify → cut over), plus the gotchas that cost time (Flux ownscluster.yaml; six-field cron;serverName;pg_is_in_recovery() = fon a promoted single-instance recovery cluster).Notes for the merge
apps/base/sirius-growth/cluster.yamland reverts a manualspec.backupwithin its 1 min interval. After merge Flux applies within ~60 s; verify withkubectl -n sirius-growth get cluster portal -o jsonpath='{.spec.backup.barmanObjectStore.destinationPath}'.infrastructure/garage-linode/is not Flux-applied (same as the Pi's Garage); the Linode was installed from it withinstall.sh, and the bucket/key/Secret exist already.