From 7f18f4d4d524a7ab15f31734439810f8fe26c3aa Mon Sep 17 00:00:00 2001 From: Filippo Ledda Date: Mon, 11 Sep 2023 10:01:23 +0200 Subject: [PATCH 1/2] #707 backup volume mount removed --- .../helm/templates/auto-database.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/deployment-configuration/helm/templates/auto-database.yaml b/deployment-configuration/helm/templates/auto-database.yaml index 2deba7fe..6ec31380 100644 --- a/deployment-configuration/helm/templates/auto-database.yaml +++ b/deployment-configuration/helm/templates/auto-database.yaml @@ -74,11 +74,6 @@ spec: volumeMounts: - name: {{ .app.harness.database.name | quote }} mountPath: /data/db - {{- if .root.Values.backup.active }} - - name: "db-backups" - mountPath: {{ (printf "%s/%s/%s" .root.Values.backup.dir .app.harness.database.type .app.harness.database.name) | quote }} - readOnly: true - {{- end }} {{- if eq .app.harness.database.type "postgres" }} - mountPath: /dev/shm name: dshm @@ -92,11 +87,6 @@ spec: medium: Memory name: dshm {{- end }} - {{- if .root.Values.backup.active }} - - name: "db-backups" - persistentVolumeClaim: - claimName: "db-backups" - {{- end }} --- {{- if .root.Values.backup.active }} {{- include (print "deploy_utils.database." .app.harness.database.type ".backup") . }} From 6fb75cd9d28050b8feb4f9245bff07d69726e472 Mon Sep 17 00:00:00 2001 From: Filippo Ledda Date: Mon, 11 Sep 2023 10:01:59 +0200 Subject: [PATCH 2/2] #707 backup volume mount removed --- docs/applications/databases.md | 39 ++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/docs/applications/databases.md b/docs/applications/databases.md index 6aa6af13..89bd2868 100644 --- a/docs/applications/databases.md +++ b/docs/applications/databases.md @@ -111,14 +111,49 @@ Per default, database backups are disabled. However, you can overwrite backups b ```yaml backup: - active: true + active: true ``` +See all the default values [here](../../deployment-configuration/helm/values.yaml). You can find additional configuration fields for backups to overwrite in the generated `deployment/helm/values.yaml` once you deploy your applications. Backups are defined for `mongo` and `postgres` database in form of a [K8s CronJob](https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/) that creates a dump of the database and stores it in a different persistent volume on the same cluster. -This is done periodically according to a configurable schedule, per default once a day. +This is done periodically according to a configurable schedule, per default every 5 minutes. + +A smart retention strategy is used for backups, by default: +- all current days backups +- one per day, last 7 days +- one per week, last 4 weeks +- one per month, last 6 months + +Implementation of backups and retention is based on https://github.com/prodrigestivill/docker-postgres-backup-local. + +#### How to monitor and restore backups + +Backups are stored in a Kubernetes volume named `db-backups`. + +Can mount the volume to your database pod by adding the following to your db deployment: + +```yaml +... +spec: + template: + spec: + containers: + - ... + volumeMounts: + - name: "db-backups" + mountPath: /backups + readOnly: true + ... + volumes: + ... + - name: "db-backups" + persistentVolumeClaim: + claimName: "db-backups" +``` + ### MongoDB