backup(portal): barman-cloud PITR via a Linode-side Garage WAL archive

sirius-growth/portal had a 24h-RPO pg_dump and no way to roll forward. This adds
continuous WAL archiving + a daily base backup into a second, independent Garage
node on the Linode (bucket pg-wal-archive, 10.10.0.5:3900, WireGuard-only), and
proves a restore to a point in time end to end.

- infrastructure/garage-linode/: podman+quadlet unit (the Linode is a kubelet
  node, no docker), garage.toml bound to 10.10.0.5 only, nft guard in PREROUTING
  -140, install.sh, README with the measured disk sizing, pitr-restore.md with
  the rehearsal transcript.
- apps/base/sirius-growth/cluster.yaml: spec.backup.barmanObjectStore
  (destinationPath s3://pg-wal-archive, gzip WAL+data, retentionPolicy 14d),
  credentials from Secret sirius-growth/portal-wal-s3 (out of band, not in git).
- apps/base/sirius-growth/scheduled-backup.yaml: ScheduledBackup portal-daily,
  03:20 UTC, six-field cron.
- docs/cluster-overview.md: §5.1 the WAL store, §8.1 coverage + sizing + gaps,
  §8.3 the PITR restore recipe.

forgejo/pg is deliberately left on pg_dump only (a day of git history is
annoying, not costly); portal keeps its nightly dump as the logical second copy.

Rehearsed 2026-11-19: marker row at 22:35:06Z, unwanted row at 22:35:28Z,
throwaway cluster restored to targetTime 22:35:15Z came back with the marker and
without the later row. See infrastructure/garage-linode/pitr-restore.md.
This commit is contained in:
Lance Walters 2026-11-19 17:46:27 -05:00
commit 953be9f3cf
12 changed files with 801 additions and 9 deletions

View file

@ -24,6 +24,52 @@ spec:
memory: 256Mi
limits:
memory: 1Gi
# ---------------------------------------------------------------------------
# Point-in-time recovery: continuous WAL archiving + daily base backups into
# Garage on the Linode hub (10.10.0.5), i.e. a different power and internet
# domain from this primary. Companion object: ScheduledBackup portal-daily.
#
# Credentials live in Secret sirius-growth/portal-wal-s3 (created out of band
# from the Garage key `cnpg-portal-wal`, id GK7f2b4bb1fc9abaec50fde37b, scope
# read+write on bucket `pg-wal-archive` only). Never commit the key values.
#
# This uses the operator's in-tree barman-cloud integration rather than the
# CNPG-I barman-cloud plugin: same barman-cloud binaries, no extra Deployment
# and TLS plugin registration to keep alive on a 3-node homelab. The plugin is
# the migration path when 1.30's in-tree support is finally removed.
#
# `pg_dump` in forgejo/cluster-backup still runs nightly for this database as
# a second, logical copy: a dump survives a barman-format regression or a
# store that has been emptied, and it is the only copy that is readable
# without barman. Belt and braces, not redundancy theatre — the RPO comes
# from the WAL archive, not from the dump.
backup:
retentionPolicy: "14d"
barmanObjectStore:
# Bucket root, not bucket/portal: barman appends the server name (which
# defaults to the Cluster name), so the archive lives at
# s3://pg-wal-archive/portal/{base,wals}/... — one prefix per cluster,
# which is what lets forgejo/pg share this bucket later without colliding.
destinationPath: s3://pg-wal-archive
endpointURL: http://10.10.0.5:3900
s3Credentials:
accessKeyId:
name: portal-wal-s3
key: ACCESS_KEY_ID
secretAccessKey:
name: portal-wal-s3
key: ACCESS_SECRET_KEY
region:
name: portal-wal-s3
key: REGION
# gzip on both: this is a WAL stream over the WireGuard mesh to a fixed
# 20 GB store, so bytes on the wire and in the bucket are the cost.
wal:
compression: gzip
maxParallel: 2
data:
compression: gzip
jobs: 2
# Scraped via podmonitor.yaml in this directory (hand-written; see the comment
# in apps/base/forgejo/podmonitor.yaml for why enablePodMonitor is false).
# Only the operator's default query set here — this database needs no custom