From cd89800fd48f687f68ba34008434aeb3dab1fe70 Mon Sep 17 00:00:00 2001 From: p4u1 Date: Wed, 5 Nov 2025 16:21:31 +0100 Subject: [PATCH] feat: Adds a command to setup the restic repository in s3 --- README.md | 14 +++++++++++--- abra.sh | 4 ++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e9e2ea6..1061aed 100644 --- a/README.md +++ b/README.md @@ -49,15 +49,23 @@ The backup location can be changed using the `RESTIC_REPOSITORY` env variable. ### S3 Storage -To use S3 storage as backup location set the following envs: +1. To use S3 storage as backup location set the following envs: ``` RESTIC_REPOSITORY=s3:/ SECRET_AWS_SECRET_ACCESS_KEY_VERSION=v1 AWS_ACCESS_KEY_ID= COMPOSE_FILE="$COMPOSE_FILE:compose.s3.yml" ``` -and add your `` as docker secret: -`abra app secret insert aws_secret_access_key v1 ` +2. and add your `` as docker secret: +``` +abra app secret insert aws_secret_access_key v1 +``` + +3. Intialze you restic repository: +``` +abra app cmd --chaos app setup_restic_s3 +``` + See [restic s3 docs](https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#amazon-s3) for more information. diff --git a/abra.sh b/abra.sh index ce50a91..58214d4 100644 --- a/abra.sh +++ b/abra.sh @@ -8,3 +8,7 @@ run_cron () { while [ ! -f /tmp/backup.log ]; do sleep 1; done echo "$schedule $(crontab -l | tr -s " " | cut -d ' ' -f6-)" | crontab - } + +setup_restic_s3() { + AWS_SECRET_ACCESS_KEY=$(cat /run/secrets/aws_secret_access_key) restic -r $RESTIC_REPOSITORY init +}