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

@ -0,0 +1,41 @@
#!/usr/sbin/nft -f
# WAL-archive inbound guard — defence in depth for Garage on the Linode hub.
#
# WHY THIS EXISTS AND WHY UFW ALONE IS NOT ENOUGH:
# On the Pi the risk is docker's DNAT bypassing ufw's INPUT chain. Here the
# store runs under podman with Network=host, so there is no DNAT to bypass —
# but the same rule shape is kept anyway, because the next person who adds a
# port mapping (or a second container that proxies this one) must not be able
# to reach 3900 from eth0 by accident. This table is evaluated in PREROUTING
# at priority -140, before any DNAT, so it binds the exposure to the transport
# rather than to how the listener was published.
#
# Effective policy for 3900 (S3 API) and 3903 (metrics/admin):
# accept from WireGuard (wg0) and loopback — incl. pod traffic arriving from
# the mesh with a 10.244.x source — drop everything else (eth0, LAN, public).
# DROP not REJECT: an off-mesh scan sees `filtered` and learns nothing.
#
# Note this is *in addition to* ufw, which on this host allows 22 from
# 10.20.0.0/24 and any from 10.10.0.0/24 / 10.244.0.0/16. ufw's own default is
# deny incoming, so the LAN path is already closed; this table keeps it closed
# even if someone later opens ufw wider for a different service.
#
# `destroy` (not `delete`) so re-running the unit replaces the table instead of
# appending a duplicate, and does not fail on first install.
destroy table inet wal_archive_guard
table inet wal_archive_guard {
chain prerouting {
type filter hook prerouting priority -140; policy accept;
# WireGuard mesh + hub link, and loopback (the garage CLI talks to
# 127.0.0.1:3901 inside this host namespace).
iifname { "lo", "wg0" } tcp dport { 3900, 3903 } counter accept
# Pods on this node reach the dummy-k8s address from the pod network.
ip saddr 10.244.0.0/16 tcp dport { 3900, 3903 } counter accept
# Everything else — eth0/public, any future interface nobody added above.
tcp dport { 3900, 3903 } counter drop
}
}