From e1e508988a84f11e44f764e72ca848a8c22cd9e8 Mon Sep 17 00:00:00 2001 From: cesnimda Date: Fri, 3 Jul 2026 14:52:42 +0200 Subject: [PATCH] fix(deploy): make bundled Ollama opt-in to avoid duplicate container The compose file shipped its own ollama service, so 'docker compose pull' during deploy re-downloaded the Ollama image and a deploy that starts the AI stack would spin up a second Ollama alongside an existing/shared one. - ollama service moved behind a 'bundled-ollama' compose profile, so it is excluded from the default pull/up (no duplicate, no re-download) - ai-service no longer depends_on ollama and is documented to point at a shared instance via OLLAMA_BASE_URL (e.g. http://:11435) - deploy.sh no longer names ollama in 'compose up' To run a self-contained Ollama: docker compose --profile bundled-ollama up Co-Authored-By: Claude Opus 4.8 --- deploy/deploy.sh | 4 +++- docker-compose.yml | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/deploy/deploy.sh b/deploy/deploy.sh index da281d5..644595c 100644 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -61,7 +61,9 @@ fi # Force recreation so updated port mappings, env vars, and container config always apply on deploy. compose up -d --force-recreate --remove-orphans backend frontend if [ "$DEPLOY_BUILD_AI_SERVICE" = "true" ]; then - compose up -d --force-recreate ai-service ollama + # Ollama is opt-in (compose "bundled-ollama" profile). Deploys reuse an + # existing/shared Ollama via OLLAMA_BASE_URL instead of starting a duplicate. + compose up -d --force-recreate ai-service fi if [ -n "${OLLAMA_MODEL:-}" ]; then diff --git a/docker-compose.yml b/docker-compose.yml index aa48c78..fb889e5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -75,12 +75,14 @@ services: context: ./tools/summarizer dockerfile: Dockerfile environment: + # Point at an existing/shared Ollama by setting OLLAMA_BASE_URL in .env + # (e.g. http://:11435). The in-compose ollama service below is + # opt-in via the "bundled-ollama" profile, so it is NOT started by default + # and no duplicate Ollama container is created. - OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-http://ollama:11434} - OLLAMA_MODEL=${OLLAMA_MODEL:-qwen2.5:7b} ports: - "8001:8001" - depends_on: - - ollama networks: - default - shared_services @@ -91,7 +93,11 @@ services: timeout: 10s retries: 3 + # Opt-in only: start with `docker compose --profile bundled-ollama up`. + # Left out of the default set so deploys reuse an existing/shared Ollama + # (configured via OLLAMA_BASE_URL) instead of spinning up a duplicate. ollama: + profiles: ["bundled-ollama"] image: ollama/ollama:latest ports: - "11434:11434"