From 6e2a7e33170f6859e4e65fb60e622ebaacaac408 Mon Sep 17 00:00:00 2001 From: Christian Prior-Mamulyan Date: Sun, 27 Apr 2025 23:01:15 +0200 Subject: [PATCH] fix: clean up startup process by including Supabase compose and improving container handling Extended Description: - Use 'include:' in docker-compose.yml to properly merge Supabase services. - Update start_services.py to pass --profile during container shutdown to prevent orphan containers and leftover networks. - Update README upgrade instructions to reflect these changes. - This fixes the orphan containers, stuck 'localai_default' network, and incomplete Ollama container updates. This change ensures clean startup/shutdown cycles and improves reliability without increasing complexity. --- README.md | 4 ++-- docker-compose.yml | 3 +++ start_services.py | 19 ++++++++----------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 7dedebb..bbf43d0 100644 --- a/README.md +++ b/README.md @@ -266,10 +266,10 @@ To update all containers to their latest versions (n8n, Open WebUI, etc.), run t ```bash # Stop all services -docker compose -p localai --profile -f docker-compose.yml -f supabase/docker/docker-compose.yml down +docker compose -p localai -f docker-compose.yml --profile down # Pull latest versions of all containers -docker compose -p localai --profile -f docker-compose.yml -f supabase/docker/docker-compose.yml pull +docker compose -p localai -f docker-compose.yml --profile pull # Start services again with your desired profile python start_services.py --profile diff --git a/docker-compose.yml b/docker-compose.yml index 8ae7585..46f1075 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,6 @@ +include: + - ./supabase/docker/docker-compose.yml + volumes: n8n_storage: ollama_storage: diff --git a/start_services.py b/start_services.py index bac2c1a..22b1f04 100644 --- a/start_services.py +++ b/start_services.py @@ -46,16 +46,13 @@ def prepare_supabase_env(): print("Copying .env in root to .env in supabase/docker...") shutil.copyfile(env_example_path, env_path) -def stop_existing_containers(): - """Stop and remove existing containers for our unified project ('localai').""" +def stop_existing_containers(profile=None): print("Stopping and removing existing containers for the unified project 'localai'...") - run_command([ - "docker", "compose", - "-p", "localai", - "-f", "docker-compose.yml", - "-f", "supabase/docker/docker-compose.yml", - "down" - ]) + cmd = ["docker", "compose", "-p", "localai"] + if profile and profile != "none": + cmd.extend(["--profile", profile]) + cmd.extend(["-f", "docker-compose.yml", "down"]) + run_command(cmd) def start_supabase(): """Start the Supabase services (using its compose file).""" @@ -226,7 +223,7 @@ def main(): generate_searxng_secret_key() check_and_fix_docker_compose_for_searxng() - stop_existing_containers() + stop_existing_containers(args.profile) # Start Supabase first start_supabase() @@ -239,4 +236,4 @@ def main(): start_local_ai(args.profile) if __name__ == "__main__": - main() \ No newline at end of file + main()