refactor: integrate worker-runner generation into install/update flow

update configure services to call generate_n8n_workers.sh instead of
prompting for separate runner count. update start_services.py and
apply_update.sh to include docker-compose.n8n-workers.yml when present.
This commit is contained in:
Yury Kossakovsky
2025-12-09 17:34:12 -07:00
parent d54eca620c
commit 98f2dd807e
3 changed files with 25 additions and 58 deletions

View File

@@ -192,6 +192,11 @@ def stop_existing_containers():
if os.path.exists(dify_compose_path):
cmd.extend(["-f", dify_compose_path])
# Check if the n8n workers compose file exists. If so, include it in the 'down' command.
n8n_workers_compose_path = "docker-compose.n8n-workers.yml"
if os.path.exists(n8n_workers_compose_path):
cmd.extend(["-f", n8n_workers_compose_path])
cmd.append("down")
run_command(cmd)
@@ -219,14 +224,22 @@ def start_local_ai():
"""Start the local AI services (using its compose file)."""
print("Starting local AI services...")
# Build compose files list
compose_files = ["-f", "docker-compose.yml"]
# Check if n8n workers compose file exists (generated by generate_n8n_workers.sh)
n8n_workers_compose_path = "docker-compose.n8n-workers.yml"
if os.path.exists(n8n_workers_compose_path):
compose_files.extend(["-f", n8n_workers_compose_path])
# Explicitly build services and pull newer base images first.
print("Checking for newer base images and building services...")
build_cmd = ["docker", "compose", "-p", "localai", "-f", "docker-compose.yml", "build", "--pull"]
build_cmd = ["docker", "compose", "-p", "localai"] + compose_files + ["build", "--pull"]
run_command(build_cmd)
# Now, start the services using the newly built images. No --build needed as we just built.
print("Starting containers...")
up_cmd = ["docker", "compose", "-p", "localai", "-f", "docker-compose.yml", "up", "-d"]
up_cmd = ["docker", "compose", "-p", "localai"] + compose_files + ["up", "-d"]
run_command(up_cmd)
def generate_searxng_secret_key():