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 # --------------------------------------------------------------------------- # 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. # # 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 # 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