feat: add restic backups
Description
This MR adds a new container for backing up our kubernetes cluster databases using restic. The image contains all dependencies (even for MongoDB) which will be part of an upcoming iteration.
The workflow is simple:
- We prepare an S3-compatible folder for backups
- We run 2 kubernetes pods periodically using this image to backup mysql and postgres
- Done
Test instructions
You need to linux machines to test this. If you have no linux machine, set up a digitalocean droplet with docker installed and scp the files.
Within the docker/resticbackup directory, do the following:
- Run
docker build -t resticbackup .
- Run
docker exec -it --rm resticbackup bash
- Export bash env variables as shown in https://vault.opencraft.com/ui/vault/secrets/secret/show/core/restic
- Run
restic snapshots
-- you should see 2 snapshots for multiple files. One tagged with MySQL and the other one with Postgres - Run
./backup-mysql.sh && ./backup-postgres.sh
-- this will take about 3 minutes - Run
restic snapshots
again and validate the new snapshots are added - Run
restic forget <snapshot id>
to remove a snapshot - Run
restic snapshots
to validate the snapshot is removed