Skip to content

feat: add restic backups

Boros Gábor requested to merge gabor/restic-backup into main

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:

  1. We prepare an S3-compatible folder for backups
  2. We run 2 kubernetes pods periodically using this image to backup mysql and postgres
  3. 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:

  1. Run docker build -t resticbackup .
  2. Run docker exec -it --rm resticbackup bash
  3. Export bash env variables as shown in https://vault.opencraft.com/ui/vault/secrets/secret/show/core/restic
  4. Run restic snapshots -- you should see 2 snapshots for multiple files. One tagged with MySQL and the other one with Postgres
  5. Run ./backup-mysql.sh && ./backup-postgres.sh -- this will take about 3 minutes
  6. Run restic snapshots again and validate the new snapshots are added
  7. Run restic forget <snapshot id> to remove a snapshot
  8. Run restic snapshots to validate the snapshot is removed

Screenshots

Screenshot_2023-03-20_at_11.54.46

Merge request reports