Added pg-functions to docker-backup and added backup-restore.yaml

This commit is contained in:
Clemens Geibel 2021-07-16 11:07:01 +02:00
parent 51c654b272
commit aa0214569d
5 changed files with 67 additions and 0 deletions

View file

@ -17,5 +17,6 @@ function main() {
source /usr/local/lib/functions.sh source /usr/local/lib/functions.sh
source /usr/local/lib/file-functions.sh source /usr/local/lib/file-functions.sh
source /usr/local/lib/pg-functions.sh
main main

View file

@ -11,4 +11,5 @@ function main() {
source /usr/local/lib/functions.sh source /usr/local/lib/functions.sh
source /usr/local/lib/file-functions.sh source /usr/local/lib/file-functions.sh
source /usr/local/lib/pg-functions.sh
main main

View file

@ -6,6 +6,8 @@ function main() {
file_env AWS_ACCESS_KEY_ID file_env AWS_ACCESS_KEY_ID
file_env AWS_SECRET_ACCESS_KEY file_env AWS_SECRET_ACCESS_KEY
#restic -r ${RESTIC_REPOSITORY}/pg-role snapshots
restic -r ${RESTIC_REPOSITORY}/pg-database snapshots
restic -r ${RESTIC_REPOSITORY}/files snapshots restic -r ${RESTIC_REPOSITORY}/files snapshots
} }

View file

@ -27,5 +27,6 @@ function main() {
source /usr/local/lib/functions.sh source /usr/local/lib/functions.sh
source /usr/local/lib/file-functions.sh source /usr/local/lib/file-functions.sh
source /usr/local/lib/pg-functions.sh
main main

View file

@ -0,0 +1,62 @@
kind: Pod
apiVersion: v1
metadata:
name: backup-restore
labels:
app.kubernetes.io/name: backup-restore
app.kubernetes.io/part-of: jira
spec:
containers:
- name: backup-app
image: domaindrivenarchitecture/c4k-jira-backup
imagePullPolicy: IfNotPresent
command: ["/entrypoint-start-and-wait.sh"]
env:
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: postgres-secret
key: postgres-user
- name: POSTGRES_DB
valueFrom:
configMapKeyRef:
name: postgres-config
key: postgres-db
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secret
key: postgres-password
- name: POSTGRES_HOST
value: "postgresql-service:5432"
- name: POSTGRES_SERVICE
value: "postgresql-service"
- name: POSTGRES_PORT
value: "5432"
- name: AWS_DEFAULT_REGION
value: eu-central-1
- name: AWS_ACCESS_KEY_ID_FILE
value: /var/run/secrets/backup-secrets/aws-access-key-id
- name: AWS_SECRET_ACCESS_KEY_FILE
value: /var/run/secrets/backup-secrets/aws-secret-access-key
- name: RESTIC_REPOSITORY
valueFrom:
configMapKeyRef:
name: backup-config
key: restic-repository
- name: RESTIC_PASSWORD_FILE
value: /var/run/secrets/backup-secrets/restic-password
volumeMounts:
- name: jira-data-volume
mountPath: /var/backups
- name: backup-secret-volume
mountPath: /var/run/secrets/backup-secrets
readOnly: true
volumes:
- name: jira-data-volume
persistentVolumeClaim:
claimName: jira-pvc
- name: backup-secret-volume
secret:
secretName: backup-secret
restartPolicy: OnFailure