From a1625ade98f8601be78da2657f067a77e7bbbc1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=8B=A4=E6=B0=91?= Date: Tue, 23 Jun 2026 16:38:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(update):=20=E4=BF=AE=E5=A4=8D=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E6=97=B6=20bugcollect-service=20=E8=A2=AB=20--remove-?= =?UTF-8?q?orphans=20=E5=81=9C=E6=8E=89=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题根因: 1. bugcollect-service 使用 profiles: ["bugcollect"],升级脚本未激活该 profile,docker compose --remove-orphans 将其当孤儿容器停掉 2. Step 6 重启列表未包含 bugcollect-service / symbolicator 修复: - 启动前检测 bugcollect 容器是否在运行,自动导出 COMPOSE_PROFILES=bugcollect - Step 6 服务重启列表追加 bugcollect-service、symbolicator Co-Authored-By: Claude Sonnet 4.6 --- scripts/update.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/update.sh b/scripts/update.sh index 93c53c4..27dc174 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -139,6 +139,15 @@ ok "NGINX_BIND=${_NGINX_BIND}" [ -n "$_CONSOLE_DOMAIN" ] || fail "config/xuqm.env 中 CONSOLE_DOMAIN 未设置,请手动补充后重试" +# 检测已运行的可选 profile 容器,升级时保持 profile 激活状态,避免 +# docker compose --remove-orphans 把 profile 容器当孤儿停掉 +_ACTIVE_PROFILES="" +if docker ps --format '{{.Names}}' 2>/dev/null | grep -qi 'bugcollect'; then + _ACTIVE_PROFILES="bugcollect" + ok "检测到 bugcollect-service 运行中 → 激活 bugcollect profile" +fi +export COMPOSE_PROFILES="${_ACTIVE_PROFILES}" + # --------------------------------------------------------------------------- # Step 1 — 检测 CONSOLE_DOMAIN 是否为裸 IP,提示更正 # --------------------------------------------------------------------------- @@ -488,7 +497,7 @@ _COMPOSE="docker compose --env-file ${ROOT_DIR}/.env \ # 使用 up -d 而非 restart:restart 只重启容器进程,不会切换到新拉取的镜像; # up -d 会检测镜像变更并重建容器,是应用新版本的正确方式。 -for _svc in tenant-service im-service file-service update-service license-service push-service tenant-web nginx; do +for _svc in tenant-service im-service file-service update-service license-service push-service tenant-web nginx bugcollect-service symbolicator; do # 仅重启已激活的服务(跳过未运行的可选服务) if $_COMPOSE ps --services --filter status=running 2>/dev/null | grep -q "^${_svc}$"; then info "应用新镜像并重启 ${_svc} ..."