Mount backup volumes into the backup process container

This commit is contained in:
Einar Forselv 2019-04-19 02:18:32 +02:00
parent 64908c8e2f
commit 196c59962b
1 changed files with 11 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import argparse import argparse
import pprint
import sys import sys
from restic_volume_backup.config import Config from restic_volume_backup.config import Config
@ -59,10 +60,19 @@ def backup(config, containers):
restic.init_repo(config.repository) restic.init_repo(config.repository)
print("Starting backup container..") print("Starting backup container..")
# Map all volumes from the backup container into the backup process container
volumes = containers.this_container.volumes()
# Map volumes from other containers we are backing up
mounts = containers.generate_backup_mounts('/backup')
volumes.update(mounts)
pprint.pprint(volumes, indent=2)
backup_runner.run( backup_runner.run(
image=containers.this_container.image, image=containers.this_container.image,
command='restic-volume-backup start-backup-process', command='restic-volume-backup start-backup-process',
volumes=containers.this_container.volumes, volumes=volumes,
enviroment=containers.this_container.environment, enviroment=containers.this_container.environment,
labels={ labels={
"restic-volume-backup.backup_process": 'True', "restic-volume-backup.backup_process": 'True',