mirror of
https://github.com/auricom/home-cluster.git
synced 2025-09-17 18:24:14 +02:00
♻️ move backups manifests in their owns folders
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Possible actions: error, pre-backup, post-backup
|
||||
ACTION="$1"
|
||||
|
||||
if [ "$WEBHOOK_URL" != "**None**" ]; then
|
||||
case "$ACTION" in
|
||||
"error")
|
||||
echo "Execute error webhook call to $WEBHOOK_URL"
|
||||
curl --url "$WEBHOOK_URL" \
|
||||
--header 'Content-Type: application/json' \
|
||||
--max-time 10 \
|
||||
--retry 5 \
|
||||
$WEBHOOK_EXTRA_ARGS
|
||||
;;
|
||||
# "pre-backup")
|
||||
# echo "Nothing to do"
|
||||
# ;;
|
||||
"post-backup")
|
||||
echo "Execute post-backup webhook call to $WEBHOOK_URL"
|
||||
curl --url "$WEBHOOK_URL" \
|
||||
--header 'Content-Type: application/json' \
|
||||
--max-time 10 \
|
||||
--retry 5 \
|
||||
$WEBHOOK_EXTRA_ARGS
|
||||
;;
|
||||
esac
|
||||
fi
|
@@ -0,0 +1,62 @@
|
||||
---
|
||||
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:1209779d7b39a9f73d498091452051fedfe140252bff59ea1c42e0a9a8a9b8e0
|
||||
env:
|
||||
- name: POSTGRES_HOST
|
||||
value: ${POSTGRES_HOST}
|
||||
- name: POSTGRES_DB
|
||||
value: "authelia,drone,freshrss,gitea,invidious,joplin,lychee,paperless,recipes,sharry,outline,vaultwarden,vikunja,wallabag"
|
||||
- name: POSTGRES_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: postgres-superuser
|
||||
key: username
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: postgres-superuser
|
||||
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"
|
||||
- name: WEBHOOK_URL
|
||||
value: https://uptime-kuma.${SECRET_CLUSTER_DOMAIN}/api/push/45cHKtahUg?status=up&msg=OK&ping=
|
||||
command:
|
||||
- "/backup.sh"
|
||||
volumeMounts:
|
||||
- name: backups
|
||||
mountPath: /backups
|
||||
- name: files
|
||||
subPath: 00-webhook
|
||||
mountPath: /hooks/00-webhook
|
||||
volumes:
|
||||
- name: backups
|
||||
nfs:
|
||||
server: "${LOCAL_LAN_TRUENAS}"
|
||||
path: /mnt/storage/backups/postgresql
|
||||
- name: files
|
||||
configMap:
|
||||
name: postgres-external-backup
|
||||
defaultMode: 0555
|
@@ -0,0 +1,13 @@
|
||||
---
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: default
|
||||
resources:
|
||||
- ./external-backup.yaml
|
||||
configMapGenerator:
|
||||
- name: postgres-external-backup
|
||||
files:
|
||||
- ./00-webhook
|
||||
generatorOptions:
|
||||
disableNameSuffixHash: true
|
Reference in New Issue
Block a user