From e88ac79ae86bbf9a2e48b9115e12b4ad151db550 Mon Sep 17 00:00:00 2001 From: bunker-admin Date: Wed, 20 May 2026 15:57:30 -0600 Subject: [PATCH] fix(ccp-agent): export COMPOSE_PROJECT_NAME so upgrade.sh sees correct project MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The agent already passed COMPOSE_PROJECT in env, but Docker Compose actually reads COMPOSE_PROJECT_NAME. When upgrade.sh (running inside the agent container at cwd=/app/instance) shelled out to `docker compose up -d` in Phase 5, compose defaulted the project name to "instance" (cwd basename), collided with the host's existing containers under "changemakerlite", and the upgrade aborted with "Container ... already in use by container ..." errors. Discovered when triggering the first end-to-end CCP "Upgrade Now" on marcelle (v2.9.15 → v2.10.1). Backup/code/rebuild phases all succeeded; migration phase failed instantly. Rollback restored marcelle cleanly. This commit adds COMPOSE_PROJECT_NAME alongside the existing COMPOSE_PROJECT (which the agent's TypeScript still reads for its own slug derivation). Bunker Admin --- docker-compose.prod.yml | 5 +++++ docker-compose.yml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index bfaa678..5d5d42e 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1442,7 +1442,12 @@ services: - INSTANCE_BASE_PATH=/app/instance # Pass the host's compose project name so the agent runs `docker compose -p ` # against the right project (not basename of INSTANCE_BASE_PATH, which is "instance"). + # COMPOSE_PROJECT is read by the agent's TypeScript for slug derivation; + # COMPOSE_PROJECT_NAME is what Docker Compose itself reads when upgrade.sh + # shells out to `docker compose ...` — without it, compose defaults to + # basename(cwd)="instance" and collides with the host's existing containers. - COMPOSE_PROJECT=${COMPOSE_PROJECT_NAME:-changemaker-lite} + - COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-changemaker-lite} logging: *default-logging networks: - changemaker-lite diff --git a/docker-compose.yml b/docker-compose.yml index fa307a1..b4631c8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1465,7 +1465,12 @@ services: - INSTANCE_BASE_PATH=/app/instance # Pass the host's compose project name so the agent runs `docker compose -p ` # against the right project (not basename of INSTANCE_BASE_PATH, which is "instance"). + # COMPOSE_PROJECT is read by the agent's TypeScript for slug derivation; + # COMPOSE_PROJECT_NAME is what Docker Compose itself reads when upgrade.sh + # shells out to `docker compose ...` — without it, compose defaults to + # basename(cwd)="instance" and collides with the host's existing containers. - COMPOSE_PROJECT=${COMPOSE_PROJECT_NAME:-changemaker-lite} + - COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-changemaker-lite} logging: *default-logging networks: - changemaker-lite