diff --git a/VERSION b/VERSION index 2ac736a..10b798a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2026.05.20-private.6 +2026.05.21-private.1 diff --git a/scripts/update.sh b/scripts/update.sh index 28c6345..67e56fa 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -448,11 +448,11 @@ _COMPOSE="docker compose --env-file ${ROOT_DIR}/.env \ # 使用 up -d 而非 restart:restart 只重启容器进程,不会切换到新拉取的镜像; # up -d 会检测镜像变更并重建容器,是应用新版本的正确方式。 info "应用新镜像并重启 tenant-service ..." -$_COMPOSE up -d --no-deps tenant-service +$_COMPOSE up -d --no-deps --remove-orphans tenant-service ok "tenant-service 已更新" info "应用新镜像并重启 nginx ..." -$_COMPOSE up -d --no-deps nginx +$_COMPOSE up -d --no-deps --remove-orphans nginx ok "nginx 已更新" # --------------------------------------------------------------------------- @@ -513,7 +513,13 @@ _ws_probe="$(curl -sk --noproxy '*' --max-time 5 \ -H "Sec-WebSocket-Version: 13" \ "http://127.0.0.1:${_NGINX_PORT}/ws/im" 2>/dev/null || echo 000)" -if [ "$_ws_probe" = "101" ]; then +# curl 对 WebSocket 握手的处理:服务端回 101 后 curl 不会说 WS 协议, +# 连接立刻断开,-w '%{http_code}' 可能输出 "101" 或 "101000"(101 + 后续 000)。 +# 只要首三位是 101 即代表握手成功。 +_ws_ok=0 +printf '%s' "$_ws_probe" | grep -q '^101' && _ws_ok=1 + +if [ "$_ws_ok" -eq 1 ]; then ok "容器 nginx → im-service WebSocket 握手正常 (HTTP 101)" # 进一步探测外部域名(需要上层 TLS 代理正确透传 Upgrade 头) if [ -n "$_CONSOLE_DOMAIN" ]; then @@ -525,7 +531,7 @@ if [ "$_ws_probe" = "101" ]; then -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" \ -H "Sec-WebSocket-Version: 13" \ "${_ext_ws_url}" 2>/dev/null || echo 000)" - if [ "$_ext_code" = "101" ]; then + if printf '%s' "$_ext_code" | grep -q '^101'; then ok "外部域名 WebSocket 握手正常 (HTTP 101) → ${_SDK_IM_WS_URL}" else warn "外部域名 WebSocket 握手失败 (HTTP ${_ext_code}) → ${_SDK_IM_WS_URL}"