How to backup with restic to S3 compatible storage

restic: https://restic.readthedocs.io/en/latest/080_examples.html#setting-up-restic-with-amazon-s3
gist: https://gist.github.com/revant/2414cedce8e19d209d5d337ea19efabc#file-backup-with-restic-and-s3-md

Start local MinIO

docker run \
  -p 9000:9000 \
  -p 9001:9001 \
  --name localminio \
  -v ~/minio/data:/data \
  -e "MINIO_ROOT_USER=AKIAIOSFODNN7EXAMPLE" \
  -e "MINIO_ROOT_PASSWORD=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" \
  quay.io/minio/minio server /data --console-address ":9001"

Note: Minio example is for local testing only, use S3 compatible object storage in case of production setup

Initialize Restic Repo with S3

export RESTIC_REPOSITORY="s3:http://localhost:9000/restic-demo"
export AWS_ACCESS_KEY_ID="AKIAIOSFODNN7EXAMPLE"
export AWS_SECRET_ACCESS_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
export RESTIC_PASSWORD="secret"
restic init

Take backup

cd /home/frappe/frappe-bench
restic backup sites

List snapshots

restic snapshots

repository 4cd7ac50 opened successfully, password is correct
ID        Time                 Host            Tags        Paths
-------------------------------------------------------------------------------------------
369ee669  2022-03-11 22:00:24  develop-laptop             /home/frappe/frappe-bench/sites
-------------------------------------------------------------------------------------------
1 snapshots

Restore backup

cd /home/frappe/frappe-bench
restic restore 369ee669 --target .
2 Likes