Skip to content

Commit 1d9aef6

Browse files
authored
Merge pull request #708 from MetaCell/feature/707
Feature/707
2 parents 36791b2 + 6fb75cd commit 1d9aef6

2 files changed

Lines changed: 37 additions & 12 deletions

File tree

deployment-configuration/helm/templates/auto-database.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ spec:
7474
volumeMounts:
7575
- name: {{ .app.harness.database.name | quote }}
7676
mountPath: /data/db
77-
{{- if .root.Values.backup.active }}
78-
- name: "db-backups"
79-
mountPath: {{ (printf "%s/%s/%s" .root.Values.backup.dir .app.harness.database.type .app.harness.database.name) | quote }}
80-
readOnly: true
81-
{{- end }}
8277
{{- if eq .app.harness.database.type "postgres" }}
8378
- mountPath: /dev/shm
8479
name: dshm
@@ -92,11 +87,6 @@ spec:
9287
medium: Memory
9388
name: dshm
9489
{{- end }}
95-
{{- if .root.Values.backup.active }}
96-
- name: "db-backups"
97-
persistentVolumeClaim:
98-
claimName: "db-backups"
99-
{{- end }}
10090
---
10191
{{- if .root.Values.backup.active }}
10292
{{- include (print "deploy_utils.database." .app.harness.database.type ".backup") . }}

docs/applications/databases.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,49 @@ Per default, database backups are disabled. However, you can overwrite backups b
111111

112112
```yaml
113113
backup:
114-
active: true
114+
active: true
115115
```
116116

117+
See all the default values [here](../../deployment-configuration/helm/values.yaml).
117118
You can find additional configuration fields for backups to overwrite in the generated `deployment/helm/values.yaml` once you deploy your applications.
118119

119120
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.
120121

121-
This is done periodically according to a configurable schedule, per default once a day.
122+
This is done periodically according to a configurable schedule, per default every 5 minutes.
123+
124+
A smart retention strategy is used for backups, by default:
125+
- all current days backups
126+
- one per day, last 7 days
127+
- one per week, last 4 weeks
128+
- one per month, last 6 months
129+
130+
Implementation of backups and retention is based on https://github.com/prodrigestivill/docker-postgres-backup-local.
131+
132+
#### How to monitor and restore backups
133+
134+
Backups are stored in a Kubernetes volume named `db-backups`.
135+
136+
Can mount the volume to your database pod by adding the following to your db deployment:
137+
138+
```yaml
139+
...
140+
spec:
141+
template:
142+
spec:
143+
containers:
144+
- ...
145+
volumeMounts:
146+
- name: "db-backups"
147+
mountPath: /backups
148+
readOnly: true
149+
...
150+
volumes:
151+
...
152+
- name: "db-backups"
153+
persistentVolumeClaim:
154+
claimName: "db-backups"
155+
```
156+
122157

123158

124159
### MongoDB

0 commit comments

Comments
 (0)