Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/707 #708

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions deployment-configuration/helm/templates/auto-database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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") . }}
Expand Down
39 changes: 37 additions & 2 deletions docs/applications/databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading