fix(deploy): wait for control proxy health
This commit is contained in:
1 parent
61d55cab0f
commit
0fda3af4c3
2 files changed
+18
-1
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
||||
8cc23c8ac0b407deec4bd2c10f98ce1dae7b97c7fa8193b28773607680075a77 install.sh
|
||||
3776581f5b8755afe0fbc3ea9121416504f117da83f2baa6214c315d2d473ef8 install.sh
|
||||
e8cabc5a989d171206361e6ae8b4e0baf9bb9a611ac41106bbe42de0782e8975 compose/s.yml
|
||||
203b6da918dee21dbfabbcf5466111bd92c7a8c9e754dad61e7e75e20513b880 compose/e.yml
|
||||
c226c5e1feb5cd6948ee9b32897e77240e21793090d8f42234ca999450ec90b0 config/e-server.production.yaml
|
||||
|
||||
+17
@@ -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() {
|
||||
|
||||
Reference in new issue
Block a user