Reduce down time while updating

This commit is contained in:
jpk 2023-02-15 16:30:55 +01:00
parent 192f6c1444
commit 790e01866f
1 changed files with 7 additions and 6 deletions

View File

@ -89,12 +89,13 @@ def control(ctx, service, command):
@only_if_service_exists
def update(ctx, service, remove):
compose_file = get_compose_file(Path(CONFIG.root_directory) / service)
command_chain = {
f"Stopping {service}": ["down" if remove else "stop"],
f"Pulling {service} images": ["pull"],
f"Starting {service}": ["up", "-d"],
}
for title, command in command_chain.items():
command_chain = [
(f"Pulling {service} images", ["pull"]),
(f"Starting {service}", ["up", "-d"]),
]
if remove:
command_chain.insert(0, (f"Stopping {service}", ["down"]))
for title, command in command_chain:
output.print_header(ctx, title)
docker_compose_command(command, compose_file)