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.
60 lines
2.2 KiB
Shell
Executable file
60 lines
2.2 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
# Install the Garage WAL archive on the Linode hub (10.10.0.5). Idempotent.
|
|
#
|
|
# sudo ./install.sh
|
|
#
|
|
# Installs: podman (if missing), /etc/garage/{garage.toml,garage.env},
|
|
# /etc/containers/systemd/garage.container, the nft guard, and the state dirs.
|
|
# Then starts the unit and assigns the node's layout capacity on first run.
|
|
#
|
|
# The RPC secret is generated once and never printed. Rewriting it on an
|
|
# existing install is harmless for a single-node store, but the copy in
|
|
# /root/garage-backup is what a rebuild should reuse.
|
|
set -euo pipefail
|
|
|
|
here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
command -v podman >/dev/null || {
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
apt-get update -qq
|
|
apt-get install -y podman
|
|
}
|
|
|
|
install -d -m 0755 /etc/garage /etc/containers/systemd /etc/nftables.d
|
|
install -d -m 0700 /var/lib/garage/meta /var/lib/garage/data
|
|
|
|
install -m 0644 "$here/garage.toml" /etc/garage/garage.toml
|
|
install -m 0644 "$here/garage.container" /etc/containers/systemd/garage.container
|
|
|
|
if [ ! -s /etc/garage/garage.env ]; then
|
|
umask 077
|
|
printf 'GARAGE_RPC_SECRET=%s\n' "$(openssl rand -hex 32)" > /etc/garage/garage.env
|
|
fi
|
|
chmod 0600 /etc/garage/garage.env
|
|
|
|
# Guard first: the listener must never exist unguarded, not even for the
|
|
# seconds between `compose/quadlet up` and a firewall install.
|
|
"$here/host/install-wal-archive-firewall.sh" >/dev/null
|
|
|
|
systemctl daemon-reload
|
|
systemctl start garage.service
|
|
|
|
# First run only: this Garage node needs a layout entry before it accepts
|
|
# writes. Capacity 20 GB against a 79 GB disk holding 29 GB of other data —
|
|
# see README "Disk sizing".
|
|
for _ in $(seq 1 30); do
|
|
garage_status=$(podman exec garage /garage -c /etc/garage.toml status 2>&1 || true)
|
|
grep -q 'NO ROLE' <<<"$garage_status" && break
|
|
sleep 2
|
|
done
|
|
|
|
if grep -q 'NO ROLE' <<<"$garage_status"; then
|
|
node_id=$(awk '/NO ROLE/{print $1}' <<<"$garage_status" | head -1)
|
|
podman exec garage /garage -c /etc/garage.toml layout assign -z dc1 -c 20G "$node_id"
|
|
podman exec garage /garage -c /etc/garage.toml layout apply --version 1
|
|
fi
|
|
|
|
# Verify rather than assume.
|
|
podman exec garage /garage -c /etc/garage.toml status
|
|
ss -ltnH 'sport = :3900 or sport = :3903'
|
|
nft list table inet wal_archive_guard >/dev/null && echo "OK: wal_archive_guard loaded"
|