forked from coop-cloud/backup-bot-two
Update backupbot.py and compose.yaml
This commit is contained in:
parent
0588a06a97
commit
0abb4827e7
@ -42,7 +42,7 @@ sys.excepthook = handle_exception
|
|||||||
@click.option('-l', '--log', 'loglevel')
|
@click.option('-l', '--log', 'loglevel')
|
||||||
@click.option('-m', '--machine-logs', 'machine_logs', is_flag=True)
|
@click.option('-m', '--machine-logs', 'machine_logs', is_flag=True)
|
||||||
@click.option('service', '--host', '-h', envvar='SERVICE')
|
@click.option('service', '--host', '-h', envvar='SERVICE')
|
||||||
@click.option('repository', '--repo', '-r', envvar='RESTIC_REPOSITORY', required=True)
|
@click.option('repository', '--repo', '-r', envvar='RESTIC_REPOSITORY')
|
||||||
def cli(loglevel, service, repository, machine_logs):
|
def cli(loglevel, service, repository, machine_logs):
|
||||||
global SERVICE
|
global SERVICE
|
||||||
if service:
|
if service:
|
||||||
@ -87,7 +87,11 @@ def export_secrets():
|
|||||||
with open(os.environ[env]) as file:
|
with open(os.environ[env]) as file:
|
||||||
secret = file.read()
|
secret = file.read()
|
||||||
os.environ[env.removesuffix('_FILE')] = secret
|
os.environ[env.removesuffix('_FILE')] = secret
|
||||||
# logger.debug(f"Read secret value: {secret}")
|
|
||||||
|
if env == 'RESTIC_REPOSITORY_FILE':
|
||||||
|
# RESTIC_REPOSITORY_FILE and RESTIC_REPOSITORY are mutually exclusive
|
||||||
|
logger.info("RESTIC_REPOSITORY set to RESTIC_REPOSITORY_FILE. Unsetting RESTIC_REPOSITORY_FILE.")
|
||||||
|
del os.environ['RESTIC_REPOSITORY_FILE']
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
|
@ -8,8 +8,10 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- CRON_SCHEDULE
|
- CRON_SCHEDULE
|
||||||
- RESTIC_REPOSITORY_FILE=/run/secrets/restic_repo
|
- RESTIC_REPOSITORY_FILE=/run/secrets/restic_repo
|
||||||
|
- RESTIC_PASSWORD_FILE=/run/secrets/restic_password
|
||||||
secrets:
|
secrets:
|
||||||
- restic_repo
|
- restic_repo
|
||||||
|
- restic_password
|
||||||
configs:
|
configs:
|
||||||
- source: entrypoint
|
- source: entrypoint
|
||||||
target: /entrypoint.sh
|
target: /entrypoint.sh
|
||||||
@ -29,6 +31,9 @@ secrets:
|
|||||||
restic_repo:
|
restic_repo:
|
||||||
external: true
|
external: true
|
||||||
name: ${STACK_NAME}_restic_repo
|
name: ${STACK_NAME}_restic_repo
|
||||||
|
restic_password:
|
||||||
|
external: true
|
||||||
|
name: ${STACK_NAME}_restic_password
|
||||||
|
|
||||||
configs:
|
configs:
|
||||||
entrypoint:
|
entrypoint:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user