From dd1daaaae9bb4c9ade07159327b1047482dbd793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=8B=A4=E6=B0=91?= Date: Thu, 21 May 2026 11:08:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(update):=20=E9=87=8D=E5=90=AF=E6=89=80?= =?UTF-8?q?=E6=9C=89=E8=BF=90=E8=A1=8C=E4=B8=AD=E7=9A=84=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E8=80=8C=E9=9D=9E=E4=BB=85=20tenant-service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原脚本只重启 tenant-service 和 nginx,导致 im-service/file-service 等 服务的镜像更新不生效。改为遍历所有可能的业务服务,按实际运行状态 决定是否重启,跳过未激活的可选服务。 Co-Authored-By: Claude Sonnet 4.6 --- scripts/update.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/update.sh b/scripts/update.sh index 67e56fa..7d3d520 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -447,13 +447,14 @@ _COMPOSE="docker compose --env-file ${ROOT_DIR}/.env \ # 使用 up -d 而非 restart:restart 只重启容器进程,不会切换到新拉取的镜像; # up -d 会检测镜像变更并重建容器,是应用新版本的正确方式。 -info "应用新镜像并重启 tenant-service ..." -$_COMPOSE up -d --no-deps --remove-orphans tenant-service -ok "tenant-service 已更新" - -info "应用新镜像并重启 nginx ..." -$_COMPOSE up -d --no-deps --remove-orphans nginx -ok "nginx 已更新" +for _svc in tenant-service im-service file-service update-service license-service push-service tenant-web nginx; do + # 仅重启已激活的服务(跳过未运行的可选服务) + if $_COMPOSE ps --services --filter status=running 2>/dev/null | grep -q "^${_svc}$"; then + info "应用新镜像并重启 ${_svc} ..." + $_COMPOSE up -d --no-deps --remove-orphans "$_svc" + ok "${_svc} 已更新" + fi +done # --------------------------------------------------------------------------- # Step 7 — 等待 tenant-service 健康