fix(deploy): wait for control proxy health

This commit is contained in:
root committed 2026-09-04 14:20:54 +00:00
1 parent 61d55cab0f
commit 0fda3af4c3
2 files changed
+18 -1

No files matched your search

+17
View File
@@ -349,11 +349,28 @@ rm -f "$image_tar"
mv "$image_archive" "$ROOT/node-images/media-node.tar.gz"
chmod 644 "$ROOT/node-images/media-node.tar.gz"
wait_for_compose_health() {
compose_file=$1; project=$2; service=$3; attempt=1
while [ "$attempt" -le 60 ]; do
container=$(docker compose --env-file "$ENV_FILE" -f "$compose_file" -p "$project" ps -q "$service" 2>/dev/null || true)
status=''
if [ -n "$container" ]; then
status=$(docker inspect -f '{{.State.Health.Status}}' "$container" 2>/dev/null || true)
fi
[ "$status" = healthy ] && return 0
[ "$status" = unhealthy ] && die "$service 容器健康检查失败"
sleep 2
attempt=$((attempt + 1))
done
die "$service 容器健康检查超时"
}
docker compose --env-file "$ENV_FILE" -f "$E_COMPOSE" -p "$E_PROJECT" up -d postgres valkey
docker compose --env-file "$ENV_FILE" -f "$E_COMPOSE" -p "$E_PROJECT" run --rm --no-deps e-server migrate -config /etc/overcooked-e/config.yaml
docker compose --env-file "$ENV_FILE" -f "$S_COMPOSE" -p "$S_PROJECT" up -d postgres valkey
docker compose --env-file "$ENV_FILE" -f "$S_COMPOSE" -p "$S_PROJECT" run --rm --no-deps s-migrate
docker compose --env-file "$ENV_FILE" -f "$S_COMPOSE" -p "$S_PROJECT" up -d s-control control-proxy webui
wait_for_compose_health "$S_COMPOSE" "$S_PROJECT" control-proxy
docker compose --env-file "$ENV_FILE" -f "$E_COMPOSE" -p "$E_PROJECT" up -d e-server
wait_for() {