#!/bin/bash set -euo pipefail # test.pubuli.com:7777 一键部署 guest-chat(等同本地 127.0.0.1:7788 Docker 版) # 用法:在 test 服务器 (100.31.73.254) 上传 guest-cs-stack 后执行 # chmod +x deploy-test7777.sh && ./deploy-test7777.sh COMPOSE="docker compose -f docker-compose.chat.yaml -f docker-compose.chat.test7777.yaml" echo "[1/6] 停止占用 7777/7788 的旧进程(Werkzeug / 旧 Flask)..." fuser -k 7777/tcp 2>/dev/null || true fuser -k 7788/tcp 2>/dev/null || true pkill -f "python app.py" 2>/dev/null || true pkill -f "python.*7777" 2>/dev/null || true pkill -f "python.*7788" 2>/dev/null || true sleep 2 echo "[2/6] 拉取最新镜像..." docker pull ladioussuapp/guest-chat:latest docker inspect ladioussuapp/guest-chat:latest --format 'Digest={{index .RepoDigests 0}}' echo "[3/6] 停止旧容器..." $COMPOSE down 2>/dev/null || true echo "[4/6] 启动新栈..." $COMPOSE up -d --force-recreate echo "[5/6] 等待就绪..." sleep 25 $COMPOSE ps echo "[6/6] 验证..." curl -sf -o /dev/null -w "guest HTTP %{http_code}\n" http://127.0.0.1:7777/guest-customer-service || true curl -sI http://127.0.0.1:7777/guest-customer-service | grep -i server || true echo "" echo "若 Server 不是 gunicorn,或 Chatwoot 空库,执行:" echo " chmod +x bootstrap-chatwoot-test.sh && ./bootstrap-chatwoot-test.sh" echo "" echo "完成。请访问:" echo " http://test.pubuli.com:7777/guest-customer-service"