From 2ea59b4230c4c1814c9f6436c8682bc42f3278f0 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 24 Oct 2023 21:03:44 +0200 Subject: [PATCH] breaking change: rename env RESTIC_REPO to RESTIC_REPOSITORY --- .env.sample | 6 +++--- README.md | 10 +++++----- backupbot.py | 6 +++--- compose.secret.yml | 2 +- compose.yml | 2 +- release/1.0.0+latest | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.env.sample b/.env.sample index 172d156..fc4f2db 100644 --- a/.env.sample +++ b/.env.sample @@ -4,7 +4,7 @@ SECRET_RESTIC_PASSWORD_VERSION=v1 COMPOSE_FILE=compose.yml -RESTIC_REPO=/backups/restic +RESTIC_REPOSITORY=/backups/restic CRON_SCHEDULE='30 3 * * *' @@ -22,8 +22,8 @@ CRON_SCHEDULE='30 3 * * *' #COMPOSE_FILE="$COMPOSE_FILE:compose.s3.yml" # Secret restic repository -# use a secret to store the RESTIC_REPO if the repository location contains a secret value +# use a secret to store the RESTIC_REPOSITORY if the repository location contains a secret value # i.E rest:https://user:SECRET_PASSWORD@host:8000/ -# it overwrites the RESTIC_REPO variable +# it overwrites the RESTIC_REPOSITORY variable #SECRET_RESTIC_REPO_VERSION=v1 #COMPOSE_FILE="$COMPOSE_FILE:compose.secret.yml" diff --git a/README.md b/README.md index e772270..6e57400 100644 --- a/README.md +++ b/README.md @@ -45,13 +45,13 @@ Backupbot II tries to help, by Per default Backupbot stores the backups locally in the repository `/backups/restic`, which is accessible as volume at `/var/lib/docker/volumes/_backups/_data/restic/` -The backup location can be changed using the `RESTIC_REPO` env variable. +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: ``` -RESTIC_REPO=s3:/ +RESTIC_REPOSITORY=s3:/ SECRET_AWS_SECRET_ACCESS_KEY_VERSION=v1 AWS_ACCESS_KEY_ID= COMPOSE_FILE="$COMPOSE_FILE:compose.s3.yml" @@ -67,7 +67,7 @@ See [restic s3 docs](https://restic.readthedocs.io/en/latest/030_preparing_a_new To use SFTP storage as backup location set the following envs: ``` -RESTIC_REPO=sftp:user@host:/restic-repo-path +RESTIC_REPOSITORY=sftp:user@host:/restic-repo-path SECRET_SSH_KEY_VERSION=v1 SSH_HOST_KEY="hostname ssh-rsa AAAAB3... COMPOSE_FILE="$COMPOSE_FILE:compose.ssh.yml" @@ -85,7 +85,7 @@ abra app secret insert ssh_key v1 """$(cat backupkey) ### Restic REST server Storage -You can simply set the `RESTIC_REPO` variable to your REST server URL `rest:http://host:8000/`. +You can simply set the `RESTIC_REPOSITORY` variable to your REST server URL `rest:http://host:8000/`. If you access the REST server with a password `rest:https://user:pass@host:8000/` you should hide the whole URL containing the password inside a secret. Uncomment these lines: ``` @@ -96,7 +96,7 @@ Add your REST server url as secret: ``` `abra app secret insert restic_repo v1 "rest:https://user:pass@host:8000/"` ``` -The secret will overwrite the `RESTIC_REPO` variable. +The secret will overwrite the `RESTIC_REPOSITORY` variable. See [restic REST docs](https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#rest-server) for more information. diff --git a/backupbot.py b/backupbot.py index ac7beb8..7d48b9e 100755 --- a/backupbot.py +++ b/backupbot.py @@ -23,13 +23,13 @@ SERVICE = None @click.group() @click.option('-l', '--log', 'loglevel') @click.option('service', '--host', '-h', envvar='SERVICE') -@click.option('repository', '--repo', '-r', envvar='RESTIC_REPO', required=True) +@click.option('repository', '--repo', '-r', envvar='RESTIC_REPOSITORY', required=True) def cli(loglevel, service, repository): global SERVICE if service: SERVICE = service.replace('.', '_') if repository: - os.environ['RESTIC_REPO'] = repository + os.environ['RESTIC_REPOSITORY'] = repository if loglevel: numeric_level = getattr(logging, loglevel.upper(), None) if not isinstance(numeric_level, int): @@ -40,7 +40,7 @@ def cli(loglevel, service, repository): def init_repo(): - repo = os.environ['RESTIC_REPO'] + repo = os.environ['RESTIC_REPOSITORY'] logging.debug(f"set restic repository location: {repo}") restic.repository = repo restic.password_file = '/var/run/secrets/restic_password' diff --git a/compose.secret.yml b/compose.secret.yml index ab649ae..22fdb9f 100644 --- a/compose.secret.yml +++ b/compose.secret.yml @@ -3,7 +3,7 @@ version: "3.8" services: app: environment: - - RESTIC_REPO_FILE=/run/secrets/restic_repo + - RESTIC_REPOSITORY_FILE=/run/secrets/restic_repo secrets: - restic_repo diff --git a/compose.yml b/compose.yml index 888c3e3..0a7f7c3 100644 --- a/compose.yml +++ b/compose.yml @@ -10,7 +10,7 @@ services: - backups:/backups environment: - CRON_SCHEDULE - - RESTIC_REPO + - RESTIC_REPOSITORY - RESTIC_PASSWORD_FILE=/run/secrets/restic_password secrets: - restic_password diff --git a/release/1.0.0+latest b/release/1.0.0+latest index 47876a2..5495d57 100644 --- a/release/1.0.0+latest +++ b/release/1.0.0+latest @@ -1,3 +1,3 @@ -Breaking Change: the variables `SERVER_NAME` and `RESTIC_HOST` are merged into `RESTIC_REPO`. The format can be looked up here: https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html +Breaking Change: the variables `SERVER_NAME` and `RESTIC_HOST` are merged into `RESTIC_REPOSITORY`. The format can be looked up here: https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html ssh/sftp: `sftp:user@host:/repo-path` S3: `s3:https://s3.example.com/bucket_name`