Files
nixos/manifests/databases/postgres-cluster.yaml
T

85 lines
2.0 KiB
YAML

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: postgres
spec:
instances: 1
enablePDB: false
storage:
size: 100Gi
primaryUpdateStrategy: unsupervised
managed:
roles:
- name: pgadmin
ensure: present
comment: PG Admin user
login: true
superuser: true
passwordSecret:
name: postgres-user-pgadmin
- name: matrix
ensure: present
comment: Matrix DB user
login: true
superuser: false
passwordSecret:
name: postgres-user-matrix
plugins:
- name: barman-cloud.cloudnative-pg.io
isWALArchiver: true
parameters:
barmanObjectName: k3sbackup-objectstore
# Use this as the target of the bootstrap recovery process
# It is important that the `externalClusters` serverName matches
# the old name of the original cluster that you are upgrading.
# When restoring, set the targetTime to the latest backup that you
# want to restore to
# bootstrap:
# recovery:
# source: origin
# recoveryTarget:
# targetTime: "2025-08-25 19:00:40+05"
# externalClusters:
# - name: origin
# plugin:
# name: barman-cloud.cloudnative-pg.io
# parameters:
# barmanObjectName: k3sbackup-objectstore
# serverName: postgres
---
apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
name: k3sbackup-objectstore
spec:
configuration:
destinationPath: "s3://k3sbackup/postgres"
endpointURL: "http://s3.thehellings.lan:9000/"
s3Credentials:
accessKeyId:
name: k3sbackup-secret
key: username
secretAccessKey:
name: k3sbackup-secret
key: password
wal:
compression: gzip
retentionPolicy: "30d"
---
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: postgres-backup
spec:
immediate: true # Create one when this is added to the cluster
schedule: "0 1 0 * * *" # 1AM, nightly
backupOwnerReference: self
cluster:
name: postgres
method: plugin
pluginConfiguration:
name: barman-cloud.cloudnative-pg.io