2026-10-19 03:03:09 -04:00
|
|
|
apiVersion: postgresql.cnpg.io/v1
|
|
|
|
|
kind: Cluster
|
|
|
|
|
metadata:
|
|
|
|
|
name: portal
|
|
|
|
|
namespace: sirius-growth
|
|
|
|
|
spec:
|
|
|
|
|
instances: 1
|
|
|
|
|
imageName: ghcr.io/cloudnative-pg/postgresql:16
|
|
|
|
|
storage:
|
|
|
|
|
size: 5Gi
|
|
|
|
|
storageClass: local-path
|
|
|
|
|
affinity:
|
|
|
|
|
nodeSelector:
|
|
|
|
|
kubernetes.io/hostname: siriussec
|
|
|
|
|
bootstrap:
|
|
|
|
|
initdb:
|
|
|
|
|
database: portal
|
|
|
|
|
owner: portal
|
|
|
|
|
secret:
|
|
|
|
|
name: sirius-growth-portal-db
|
|
|
|
|
resources:
|
|
|
|
|
requests:
|
|
|
|
|
cpu: 100m
|
|
|
|
|
memory: 256Mi
|
|
|
|
|
limits:
|
|
|
|
|
memory: 1Gi
|
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.
2026-11-19 17:46:27 -05:00
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
# 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
|
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.
2026-11-19 17:58:12 -05:00
|
|
|
# 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.
|
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.
2026-11-19 17:46:27 -05:00
|
|
|
#
|
|
|
|
|
# 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.
|
|
|
|
|
#
|
|
|
|
|
# `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.
|
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.
2026-11-19 17:58:12 -05:00
|
|
|
plugins:
|
|
|
|
|
- name: barman-cloud.cloudnative-pg.io
|
|
|
|
|
isWALArchiver: true
|
|
|
|
|
parameters:
|
|
|
|
|
barmanObjectName: portal-wal
|
|
|
|
|
serverName: portal
|
2026-10-27 01:32:20 -04:00
|
|
|
# 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
|
|
|
|
|
# application metrics.
|
|
|
|
|
monitoring:
|
|
|
|
|
enablePodMonitor: false
|
|
|
|
|
disableDefaultQueries: false
|
|
|
|
|
customQueriesConfigMap:
|
|
|
|
|
- name: cnpg-default-monitoring
|
|
|
|
|
key: queries
|