forked from coop-cloud/backup-bot-two
choos specific restore target
This commit is contained in:
13
backupbot.py
13
backupbot.py
@ -4,7 +4,6 @@ import os
|
||||
import click
|
||||
import json
|
||||
import subprocess
|
||||
# todo json logging
|
||||
import logging
|
||||
import docker
|
||||
import restic
|
||||
@ -106,9 +105,15 @@ def backup_volumes(backup_paths, apps, dry_run=False):
|
||||
|
||||
@cli.command()
|
||||
@click.option('snapshot', '--snapshot', '-s', envvar='SNAPSHOT', default='latest')
|
||||
def restore(snapshot):
|
||||
service_paths = f'/var/lib/docker/volumes/{SERVICE}_*'
|
||||
result = restic.restore(snapshot_id=snapshot, include=service_paths, target_dir='/')
|
||||
@click.option('target', '--target', '-t', envvar='TARGET', default='/')
|
||||
def restore(snapshot, target):
|
||||
# Todo: recommend to shutdown the container
|
||||
service_paths = VOLUME_PATH
|
||||
if SERVICE:
|
||||
service_paths = service_paths + f'{SERVICE}_*'
|
||||
print(f"restoring Snapshot {snapshot} of {service_paths} at {target}")
|
||||
result = restic.restore(snapshot_id=snapshot, include=service_paths, target_dir=target)
|
||||
logging.debug(result)
|
||||
|
||||
|
||||
@cli.command()
|
||||
|
Reference in New Issue
Block a user