test
This commit is contained in:
56
status.sh
56
status.sh
@@ -148,28 +148,62 @@ if command -v curl &>/dev/null && [[ -n "${PC_BACKEND_ORIGIN:-}" ]]; then
|
||||
echo " PC Chat API: ${PC_VITE_CHAT_URL:-${PC_BACKEND_ORIGIN}/api/chat}"
|
||||
echo " PC Admin API: ${PC_VITE_ADMIN_URL:-${PC_BACKEND_ORIGIN}/api/admin}"
|
||||
echo " PC WebSocket: ${PC_VITE_WS_URL:-$default_ws_url}"
|
||||
echo " PC 页面入口: ${PC_BACKEND_ORIGIN}/ (外部 HTTPS → 本机 Nginx :80 → pc dev:web :5173)"
|
||||
echo " PC 页面入口: ${PC_BACKEND_ORIGIN}/ (外部 HTTPS → 本机 Nginx :80 → /app/pc/dist)"
|
||||
echo " Nginx 日志: /var/log/nginx/openim-pc-proxy-access.log"
|
||||
pc_probe_msg_gateway "$PC_BACKEND_ORIGIN"
|
||||
else
|
||||
printf " ${YELLOW}○${NC} %-14s %s\n" "nginx-health" "跳过(未安装 curl 或未设置 PC_BACKEND_ORIGIN)"
|
||||
fi
|
||||
|
||||
# ── 前端服务 ─────────────────────────────────────────────────────────────────
|
||||
# ── 静态前端 ─────────────────────────────────────────────────────────────────
|
||||
echo ""
|
||||
echo -e "${BOLD}[ 静态前端 ]${NC}"
|
||||
print_static_site_status() {
|
||||
local label="$1" dist_file="$2" build_hint="$3" host_header="$4" access_url="$5"
|
||||
local body title
|
||||
|
||||
if [[ -f "$dist_file" ]]; then
|
||||
printf " ${GREEN}●${NC} %-14s %s\n" "${label}-dist" "$dist_file"
|
||||
else
|
||||
printf " ${YELLOW}○${NC} %-14s %s\n" "${label}-dist" "未构建(执行 ${build_hint})"
|
||||
fi
|
||||
|
||||
if command -v curl &>/dev/null; then
|
||||
if curl -fsS --max-time 3 -H "Host: ${host_header}" http://127.0.0.1/nginx-health >/dev/null 2>&1; then
|
||||
printf " ${GREEN}●${NC} %-14s %s\n" "${label}-nginx" "$access_url"
|
||||
body="$(curl -fsS --max-time 5 -H "Host: ${host_header}" http://127.0.0.1/ 2>/dev/null || true)"
|
||||
if [[ -n "$body" ]] && printf '%s' "$body" | grep -qi "<html"; then
|
||||
title="$(printf '%s' "$body" | grep -oiE '<title>[^<]*</title>' | head -1 | sed -E 's#</?title>##g' || true)"
|
||||
if [[ -n "$title" ]]; then
|
||||
printf " ${CYAN}◉${NC} %-14s %s\n" "${label}-title" "$title"
|
||||
else
|
||||
printf " ${CYAN}◉${NC} %-14s %s\n" "${label}-title" "(未解析到 <title>)"
|
||||
fi
|
||||
else
|
||||
printf " ${YELLOW}○${NC} %-14s %s\n" "${label}-title" "首页返回异常,未识别为 HTML"
|
||||
fi
|
||||
else
|
||||
printf " ${YELLOW}○${NC} %-14s %s\n" "${label}-nginx" "不可达(执行 sudo ./deploy-test/00-init-tools.sh nginx)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
print_static_site_status "pc" "$ROOT_DIR/pc/dist/index.html" "./deploy-test/08-build-static-frontend.sh pc" "${PC_PROXY_DOMAIN}" "${PC_BACKEND_ORIGIN}/"
|
||||
print_static_site_status "cms" "$ROOT_DIR/cms/dist/index.html" "./deploy-test/08-build-static-frontend.sh cms" "cms-jack.imharry.work" "http://cms-jack.imharry.work/"
|
||||
print_static_site_status "build-cms" "$ROOT_DIR/build-cms/dist/index.html" "./deploy-test/08-build-static-frontend.sh build-cms" "build-jack.imharry.work" "http://build-jack.imharry.work/"
|
||||
print_static_site_status "build-down" "$ROOT_DIR/build-down/dist/index.html" "./deploy-test/08-build-static-frontend.sh build-down" "down-jack.imharry.work" "http://down-jack.imharry.work/"
|
||||
|
||||
# ── 前端开发服务器 ─────────────────────────────────────────────────────────────
|
||||
echo ""
|
||||
echo -e "${BOLD}[ 前端开发服务器 ]${NC}"
|
||||
fe_port_desc() {
|
||||
case "$1" in
|
||||
pc) echo "5173 (yarn dev:web)" ;;
|
||||
meetingh5) echo "5188" ;;
|
||||
h5) echo "3003" ;;
|
||||
cms) echo "8001" ;;
|
||||
build-cms) echo "8002" ;;
|
||||
build-down) echo "8003" ;;
|
||||
*) echo "?" ;;
|
||||
esac
|
||||
}
|
||||
for fe in pc meetingh5 h5 cms build-cms build-down; do
|
||||
for fe in meetingh5 h5; do
|
||||
pidfile="$PID_DIR/fe-${fe}.pid"
|
||||
logfile="$LOG_DIR/fe-${fe}.log"
|
||||
port_desc="$(fe_port_desc "$fe")"
|
||||
@@ -183,7 +217,7 @@ done
|
||||
# ── 端口占用检查 ──────────────────────────────────────────────────────────────
|
||||
echo ""
|
||||
echo -e "${BOLD}[ 端口占用 ]${NC}"
|
||||
PORTS=(10002 10001 10008 10009 8000 8080 8888 8281 5173 5188 3003 8001 8002 8003)
|
||||
PORTS=(10002 10001 10008 10009 8000 8080 8888 8281 5188 3003)
|
||||
for port in "${PORTS[@]}"; do
|
||||
pid=$(lsof -ti :"$port" 2>/dev/null | head -1 || true)
|
||||
if [[ -n "$pid" ]]; then
|
||||
@@ -197,10 +231,12 @@ done
|
||||
# ── 快速操作提示 ──────────────────────────────────────────────────────────────
|
||||
echo ""
|
||||
echo -e "${BOLD}[ 快捷命令 ]${NC}"
|
||||
echo " ./deploy-test/logs.sh <service> 查看日志(支持前端: pc/h5/cms 等)"
|
||||
echo " ./deploy-test/logs.sh <service> 查看日志(支持前端: meetingh5/h5)"
|
||||
echo " ./deploy-test/restart.sh <service> 重启后端服务"
|
||||
echo " ./deploy-test/restart.sh <svc> --build 重编译并重启"
|
||||
echo " ./deploy-test/07-start-frontend.sh 启动前端服务"
|
||||
echo " ./deploy-test/07-start-frontend.sh 启动开发态前端"
|
||||
echo " ./deploy-test/08-build-static-frontend.sh 构建 pc/cms/build-cms/build-down 静态资源"
|
||||
echo " sudo ./deploy-test/dt.sh fe-publish 构建静态前端 + 更新 Nginx + 校验"
|
||||
echo " ./deploy-test/stop-frontend.sh 停止前端服务"
|
||||
echo " ./deploy-test/check-conn.sh 验证 MongoDB/S3 连接"
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user