Mark backup process container with env variable
This commit is contained in:
parent
2535ce3421
commit
98a10bf994
|
@ -17,7 +17,7 @@ def run(image: str = None, command: str = None, volumes: dict = None,
|
||||||
labels=labels,
|
labels=labels,
|
||||||
# auto_remove=True, # We remove the container further down
|
# auto_remove=True, # We remove the container further down
|
||||||
detach=True,
|
detach=True,
|
||||||
environment=environment,
|
environment=environment + ['BACKUP_PROCESS_CONTAINER=true'],
|
||||||
volumes=volumes,
|
volumes=volumes,
|
||||||
network_mode=f'container:{source_container_id}', # Reuse original container's network stack.
|
network_mode=f'container:{source_container_id}', # Reuse original container's network stack.
|
||||||
working_dir=os.getcwd(),
|
working_dir=os.getcwd(),
|
||||||
|
|
|
@ -57,6 +57,9 @@ def status(config, containers):
|
||||||
logger.info("Status for compose project '%s'", containers.project_name)
|
logger.info("Status for compose project '%s'", containers.project_name)
|
||||||
logger.info("Repository: '%s'", config.repository)
|
logger.info("Repository: '%s'", config.repository)
|
||||||
logger.info("Backup currently running?: %s", containers.backup_process_running)
|
logger.info("Backup currently running?: %s", containers.backup_process_running)
|
||||||
|
logger.info("Checking docker availability")
|
||||||
|
|
||||||
|
utils.list_containers()
|
||||||
|
|
||||||
if containers.stale_backup_process_containers:
|
if containers.stale_backup_process_containers:
|
||||||
utils.remove_containers(containers.stale_backup_process_containers)
|
utils.remove_containers(containers.stale_backup_process_containers)
|
||||||
|
@ -152,7 +155,7 @@ def backup(config, containers):
|
||||||
|
|
||||||
def start_backup_process(config, containers):
|
def start_backup_process(config, containers):
|
||||||
"""The actual backup process running inside the spawned container"""
|
"""The actual backup process running inside the spawned container"""
|
||||||
if containers.this_container != containers.backup_process_container:
|
if not utils.is_true(os.environ.get('BACKUP_PROCESS_CONTAINER')):
|
||||||
logger.error(
|
logger.error(
|
||||||
"Cannot run backup process in this container. Use backup command instead. "
|
"Cannot run backup process in this container. Use backup command instead. "
|
||||||
"This will spawn a new container with the necessary mounts."
|
"This will spawn a new container with the necessary mounts."
|
||||||
|
|
Loading…
Reference in New Issue