mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-03 13:12:09 +00:00
fix(docker): target live cliproxy compose stack
This commit is contained in:
1 parent
c8098532a6
commit
54c3e86e89
3 files changed
+11
-6
No files matched your search
+1
-1
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in new issue
Block a user