diff --git a/docker/README.md b/docker/README.md index ec581b3c..53e4a46d 100644 --- a/docker/README.md +++ b/docker/README.md @@ -95,7 +95,7 @@ systemctl list-timers 'ccs-cliproxy-*' journalctl -u ccs-cliproxy-reconcile.service -u ccs-cliproxy-update.service ``` -By default, reconciliation expects `/opt/cliproxy/docker-compose.yml` with Compose project +By default, reconciliation expects `/root/.ccs/docker/docker-compose.integrated.yml` with Compose project `docker`. Keep those defaults when adopting an existing stack so its `docker_ccs_home` and `docker_ccs_logs` volumes remain attached. The scripts support environment overrides for the container, Compose paths and project, lock file, and logs. diff --git a/docker/host/ccs-cliproxy-reconcile.sh b/docker/host/ccs-cliproxy-reconcile.sh index ec67ca0b..074d2f90 100755 --- a/docker/host/ccs-cliproxy-reconcile.sh +++ b/docker/host/ccs-cliproxy-reconcile.sh @@ -3,8 +3,8 @@ set -Eeuo pipefail container_name="${CCS_CLIPROXY_CONTAINER:-ccs-cliproxy}" -compose_dir="${CCS_CLIPROXY_COMPOSE_DIR:-/opt/cliproxy}" -compose_file="${CCS_CLIPROXY_COMPOSE_FILE:-$compose_dir/docker-compose.yml}" +compose_dir="${CCS_CLIPROXY_COMPOSE_DIR:-/root/.ccs/docker}" +compose_file="${CCS_CLIPROXY_COMPOSE_FILE:-$compose_dir/docker-compose.integrated.yml}" compose_project="${CCS_CLIPROXY_COMPOSE_PROJECT:-docker}" lock_file="${CCS_CLIPROXY_LOCK_FILE:-/run/lock/ccs-cliproxy-maintenance.lock}" log_file="${CCS_CLIPROXY_RECONCILE_LOG:-/var/log/ccs-cliproxy-reconcile.log}" @@ -52,7 +52,9 @@ compose_recreate() { -f "$compose_file" up -d --force-recreate --build } -if ! docker inspect "$container_name" >/dev/null 2>&1; then +running_state="$(docker inspect --format '{{.State.Running}}' "$container_name" 2>/dev/null || true)" + +if [ -z "$running_state" ]; then log "Container $container_name is missing; recreating from $compose_file" compose_up wait_for_health @@ -60,7 +62,7 @@ if ! docker inspect "$container_name" >/dev/null 2>&1; then exit 0 fi -if [ "$(docker inspect --format '{{.State.Running}}' "$container_name")" != 'true' ]; then +if [ "$running_state" != 'true' ]; then log "Container $container_name is stopped; restoring the Compose service" compose_up wait_for_health diff --git a/tests/unit/docker/cliproxy-host-continuity-assets.test.ts b/tests/unit/docker/cliproxy-host-continuity-assets.test.ts index d2111982..5d5f6fcc 100644 --- a/tests/unit/docker/cliproxy-host-continuity-assets.test.ts +++ b/tests/unit/docker/cliproxy-host-continuity-assets.test.ts @@ -86,10 +86,13 @@ release_install_lock`, }); it('recreates missing containers and escalates unhealthy recovery', () => { - expect(reconcileScript).toContain('CCS_CLIPROXY_COMPOSE_DIR:-/opt/cliproxy'); + expect(reconcileScript).toContain('CCS_CLIPROXY_COMPOSE_DIR:-/root/.ccs/docker'); + expect(reconcileScript).toContain('$compose_dir/docker-compose.integrated.yml'); expect(reconcileScript).toContain('CCS_CLIPROXY_COMPOSE_PROJECT:-docker'); expect(reconcileScript).toContain('--project-name "$compose_project"'); expect(reconcileScript).toContain('-f "$compose_file" up -d --no-build'); + expect(reconcileScript).toContain("2>/dev/null || true"); + expect(reconcileScript).toContain('if [ -z "$running_state" ]'); expect(reconcileScript).toContain('restart ccs-dashboard cliproxy'); expect(reconcileScript).toContain('docker restart "$container_name"'); expect(reconcileScript).toContain('up -d --force-recreate --no-build');