🚀 cloudnative-pg

This commit is contained in:
auricom
2024-01-25 01:26:56 +01:00
parent 05e8b34b3a
commit bc41f2d151
14 changed files with 150 additions and 99 deletions

View File

@@ -1,53 +0,0 @@
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: &app cloudnative-pg-external-backup
namespace: default
spec:
schedule: "@daily"
jobTemplate:
spec:
ttlSecondsAfterFinished: 86400
template:
spec:
automountServiceAccountToken: false
restartPolicy: OnFailure
containers:
- name: *app
image: prodrigestivill/postgres-backup-local:15-alpine@sha256:30473b9a3f2e884b7a17d6da1287e962933ab9d69ea5ba604c2e2afb89d16bb9
env:
- name: POSTGRES_HOST
value: ${POSTGRES_HOST}
- name: POSTGRES_DB
value: "atuin,authelia,bazarr,freshrss,gatus,ghostfolio,lidarr_main,immich,invidious,joplin,kresus,linkding,lldap,lychee,outline,paperless,prowlarr_main,pushover-notifier,radarr_main,sharry,tandoor,vaultwarden,vikunja,wallabag"
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: cloudnative-pg-secret
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: cloudnative-pg-secret
key: password
- name: POSTGRES_EXTRA_OPTS
value: "-Z9 --schema=public --blobs"
- name: BACKUP_KEEP_DAYS
value: "7"
- name: BACKUP_KEEP_WEEKS
value: "4"
- name: BACKUP_KEEP_MONTHS
value: "3"
- name: HEALTHCHECK_PORT
value: "8080"
command:
- "/backup.sh"
volumeMounts:
- name: backups
mountPath: /backups
volumes:
- name: backups
nfs:
server: "${LOCAL_LAN_TRUENAS}"
path: /mnt/storage/backups/postgresql

View File

@@ -1,7 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/kustomization.json
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: default
resources:
- ./external-backup.yaml

View File

@@ -1,51 +0,0 @@
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: postgres
namespace: default
spec:
instances: 3
imageName: ghcr.io/bo0tzz/cnpgvecto.rs:15.5@sha256:a02838b9531af52dea5f8978bc0961640eea7ff2ad1b090978c561e6c52f1394
primaryUpdateStrategy: unsupervised
enableSuperuserAccess: true
storage:
size: 50Gi
storageClass: rook-ceph-block
superuserSecret:
name: cloudnative-pg-secret
monitoring:
enablePodMonitor: true
backup:
retentionPolicy: 7d
barmanObjectStore:
wal:
compression: bzip2
maxParallel: 8
destinationPath: s3://postgresql/
endpointURL: https://.${SECRET_DOMAIN}:9000
serverName: postgres-v8
s3Credentials:
accessKeyId:
name: cloudnative-pg-secret
key: aws-access-key-id
secretAccessKey:
name: cloudnative-pg-secret
key: aws-secret-access-key
# bootstrap:
# recovery:
# source: postgres-v6
# externalClusters:
# - name: postgres-v6
# barmanObjectStore:
# destinationPath: s3://postgresql/
# endpointURL: https://minio.${SECRET_DOMAIN}:9000
# s3Credentials:
# accessKeyId:
# name: postgres-minio
# key: MINIO_ACCESS_KEY
# secretAccessKey:
# name: postgres-minio
# key: MINIO_SECRET_KEY
# wal:
# maxParallel: 8

View File

@@ -1,9 +0,0 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/kustomization.json
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: default
resources:
- backups
- ./cluster.yaml
- ./scheduledbackup.yaml

View File

@@ -1,12 +0,0 @@
---
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: postgres
namespace: default
spec:
schedule: "@daily"
immediate: true
backupOwnerReference: self
cluster:
name: postgres