db(portal): migrate WAL archiving to the CNPG-I Barman Cloud plugin

CloudNativePG 1.30 deprecates spec.backup.barmanObjectStore and 1.31 removes
it, so the pin on 1.30.0 was a hard gate. This closes that gate:

- Vendors plugin-barman-cloud v0.16.0 verbatim into
  infrastructure/databases/base/upstream/ (the operator manifest's pattern),
  with a kustomize patch only for --log-level=info and resource bounds.
  v0.16.0 requires CNPG >= 1.30 and is registered through Service
  annotations; its operator<->plugin mTLS pair comes from cert-manager
  (previous commit).
- Adds ObjectStore sirius-growth/portal-wal: the literal translation of the
  retired barmanObjectStore block, with retentionPolicy 14d moved off the
  Cluster (in the plugin, retention belongs to the store).
- Cluster portal drops spec.backup entirely and gains spec.plugins
  (barman-cloud.cloudnative-pg.io, isWALArchiver, barmanObjectName
  portal-wal, serverName portal). The server name is the barman prefix, so
  the plugin keeps writing s3://pg-wal-archive/portal/{base,wals}/... — the
  same objects the in-tree archiver left behind; the 14-day window stays
  readable.
- ScheduledBackup portal-daily switches to method: plugin.
- databases waits on cert-manager; apps waits on databases (the ObjectStore
  CRD ships with the plugin).
- CNPG dashboard: the backup timestamp metric family changes name under the
  plugin, so the panel now accepts both.
This commit is contained in:
devops 2026-11-19 17:58:12 -05:00
commit c45255242b
11 changed files with 1312 additions and 51 deletions

View file

@ -27,49 +27,35 @@ spec:
# ---------------------------------------------------------------------------
# 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.
# domain from this primary. Companion objects: ObjectStore portal-wal (the
# store + 14d retention) and ScheduledBackup portal-daily.
#
# This is the CNPG-I Barman Cloud **plugin** (Deployment cnpg-system/barman-cloud,
# vendored in infrastructure/databases/base), not the operator's in-tree
# barman-cloud support: 1.30 deprecates the in-tree path and 1.31 removes it
# (`Warning: Native support for Barman Cloud backups and recovery is
# deprecated ...`). See objectstore-portal-wal.yaml for the store definition.
#
# `serverName: portal` is the barman prefix and must stay exactly the cluster
# name: the plugin writes to s3://pg-wal-archive/portal/{base,wals}/... — the
# same objects the in-tree archiver left behind, so the existing 14-day window
# stays restorable. Changing it starts a new prefix and abandons that window.
#
# 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
plugins:
- name: barman-cloud.cloudnative-pg.io
isWALArchiver: true
parameters:
barmanObjectName: portal-wal
serverName: portal
# 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