# Garage on the Linode — the CloudNativePG WAL archive A **second, independent** single-node Garage on the Linode VPS. It holds one bucket, `pg-wal-archive`, and its only consumer is the **CNPG-I Barman Cloud plugin** archiving for `sirius-growth/portal` (continuous WAL archiving + daily base backups → point-in-time recovery). It is **not** the Pi's Garage (`infrastructure/garage/`, node `d053db4dfc97bf78`). Different host, different `node_key`, different metadata dir, no RPC peering, nothing shared. That is the whole point: > The CNPG primary runs on `siriussec` in the same building, on the same power > domain and the same uplink as the Pi. A WAL archive on the Pi would be a second > copy of the same failure. The archive has to be off-site; the Linode is the > only off-site box in this estate. ## What runs | | | |---|---| | Host | Linode VPS, Kubernetes node `linode`, WireGuard `10.10.0.5` (`dummy-k8s`), hub `10.20.0.1` on `wg0` | | Runtime | **podman 5.4** + a quadlet unit. This host is a kubelet node: installing `dockerd` next to the kubelet's containerd would add a second container runtime for no benefit, so the Pi's compose file cannot be reused verbatim | | Unit | `/etc/containers/systemd/garage.container` → generated `garage.service` (`Restart=always`) | | Image | `dxflrs/garage:v1.1.0` (same pinned tag as the Pi) | | Config | `/etc/garage/garage.toml` (installed from this directory) | | RPC secret | `/etc/garage/garage.env` → `GARAGE_RPC_SECRET`, `0600 root:root`, **not in git** | | State | `/var/lib/garage/meta` (metadata, `node_key`) and `/var/lib/garage/data` (objects) | | Node | `994fd2f42ae72da6`, zone `dc1`, capacity **20 GB**, `replication_factor = 1` | | Bucket | `pg-wal-archive` — private, `Website access: false` | ## Exposure — WireGuard only, twice 1. `garage.toml` binds `10.10.0.5:3900` (S3) and `10.10.0.5:3903` (admin/metrics) explicitly. There is no `0.0.0.0` listener and `eth0` (the public IP) is never bound, so `ss -ltn` is proof by itself. 2. `host/wal-archive-firewall.nft` is an nftables table in **PREROUTING priority -140** that accepts 3900/3903 only from `lo`/`wg0` (plus source `10.244.0.0/16` for pods on this node) and **drops** everything else, with counters on every rule. podman with `Network=host` does not need DNAT, but the table keeps a future port mapping from reopening the path — and ufw alone would not cover a container publish, exactly as on the Pi. Measured (2026-11-19), from the laptop **straight to the Linode's public IP with no VPN in the path**: 3900 and 3903 both `filtered`, and `nft list table inet wal_archive_guard` shows the drop counter incrementing. Anonymous `GET http://10.10.0.5:3900/pg-wal-archive/` → **403 AccessDenied**. ## Install / re-install ```bash # on the Linode, from a checkout of sirius/homek8s cd infrastructure/garage-linode sudo ./install.sh ``` `install.sh` is idempotent: it installs podman if missing, writes `/etc/garage/{garage.toml,garage.env}` (generating the RPC secret once), installs the quadlet unit and the nft guard **before** starting the container, then assigns the layout capacity on first run (`layout assign -z dc1 -c 20G`) and prints `garage status` + the listener set. Verify (all four must hold): ```bash systemctl status garage.service --no-pager | head -3 ss -ltnH 'sport = :3900 or sport = :3903' # only 10.10.0.5, never 0.0.0.0 podman exec garage /garage -c /etc/garage.toml status # node 994fd2f42ae72da6, HEALTHY nft list table inet wal_archive_guard # counters on accept and drop ``` ## Bucket and key ```bash G() { podman exec garage /garage -c /etc/garage.toml "$@"; } G bucket create pg-wal-archive G key create cnpg-portal-wal # prints the secret once — capture it G bucket allow --read --write pg-wal-archive --key cnpg-portal-wal G bucket info pg-wal-archive # Website access: false ``` Key ID `GK7f2b4bb1fc9abaec50fde37b` (`cnpg-portal-wal`), scope **read+write on `pg-wal-archive` only** — no bucket-create, no other bucket, not an admin key. The secret lives in the cluster as Secret `sirius-growth/portal-wal-s3` (`ACCESS_KEY_ID`, `ACCESS_SECRET_KEY`, `REGION=garage`), created out of band and **never committed**. Garage v1.1 has no `--yes` on `key create`; the secret is printed exactly once, so redirect it to a `0600` root file and read it from there. ## Disk sizing and retention Measured 2026-11-19: | | | |---|---| | Linode `/` | 79 GB, 29 GB used, **46 GB free** | | Garage capacity | **20 GB** (layout), i.e. the store stops accepting before the disk does | | First base backup + 7 WAL segments | **4.9 MB** in 8 bucket objects (`/var/lib/garage/data` 9.3 MB including Garage's block-store overhead, `meta` 4.6 MB) | | `archive_timeout` / `wal_segment_size` on the primary | 5 min / 16 MB → at most 288 segments/day | | Observed compressed segment | 16–25 KB when the portal is quiet | | Steady state (quiet) | ~6 MB WAL/day + 4.5 MB base backup/day ≈ **150 MB per 14-day window** | | Worst case (every segment full, 3–5× gzip) | ~1.5 GB/day ≈ 21 GB per 14 days — would hit the cap | Retention is `spec.retentionPolicy: "14d"` on the `ObjectStore` (`portal-wal` in `sirius-growth`), enforced by the plugin's instance sidecar (every 30 min), not by the Cluster. The 20 GB cap is deliberate: when it is reached Garage returns `507 InsufficientStorage` and the `Backup` / `ScheduledBackup` goes red — a visible failure instead of a full Linode disk. The response to that is to lower the retention policy to `7d`, or to grow the Linode disk; never to delete WALs by hand (that breaks the archive's continuity and every PITR target that depends on the deleted segment). ## How the archive is laid out `destinationPath: s3://pg-wal-archive` (bucket root) with the barman server name explicitly set to the cluster name (`Cluster.spec.plugins[].parameters.serverName: portal`), so: ``` pg-wal-archive/portal/base/20261119T223452/{backup.info,data.tar.gz} pg-wal-archive/portal/wals/0000000100000000/00000001000000000000005A.gz ``` That is one prefix per cluster, which is what lets `forgejo/pg` share this bucket later without colliding. Listing it (the postgres container has no credentials in its own environment; the Secret does): ```bash kubectl -n sirius-growth run wal-list --rm -it --restart=Never \ --image=public.ecr.aws/aws-cli/aws-cli:2.15.30 \ --overrides='{"spec":{"containers":[{"name":"aws","image":"public.ecr.aws/aws-cli/aws-cli:2.15.30", "envFrom":[{"secretRef":{"name":"portal-wal-s3"}}], "command":["sh","-c","export AWS_ACCESS_KEY_ID=$ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY=$ACCESS_SECRET_KEY AWS_DEFAULT_REGION=$REGION; aws --endpoint-url http://10.10.0.5:3900 s3 ls --recursive --human-readable s3://pg-wal-archive/"]}]}}' ``` ## Restore Point-in-time recovery is a **cluster restore**, not a file copy. The full rehearsed recipe (marker → restore to `targetTime` → verify) is §8.3 of `docs/cluster-overview.md`; `pitr-restore.md` in this directory is the self-contained version with the commands and the acceptance output. Short form: a throwaway `Cluster` with `bootstrap.recovery.source` pointing at an `externalClusters` entry (`serverName: portal`, the same bucket and Secret) and `recoveryTarget.targetTime`, then promote/cut over. Recovery needs the **base backup** plus every WAL segment up to the target — one missing segment is a failed restore, which is why the archive is never pruned by hand. ## What this store is *not* - **Not a cluster peer of the Pi's Garage.** No `[rpc]` peering, no shared `rpc_secret`, no replicated data. Two independent single-node stores. - **Not Flux-managed.** Flux watches `./clusters/homek8s`; nothing there references this directory. A push changes nothing on the Linode until `install.sh` runs. - **Not a general-purpose bucket host.** One bucket, one key, one consumer. Put application media on the Pi's store; this one exists to be off-site. - **Not exposed to the LAN or the internet**, and no Cloudflare tunnel, DNS record or public bucket will be added to it.