test
This commit is contained in:
@@ -105,12 +105,12 @@ TENCENT_SDK_APP_ID=20033091
|
||||
TENCENT_SDK_SECRET_KEY=cceba44084aaa04f8c48a1858ffd5385875c3a5ec006d34278d9d3714b40e3b0
|
||||
|
||||
# ── PC 客户端(Vite dev)对接的后端公网地址(可选)───────────────────────────
|
||||
# 仅 IP:在服务器上先部署 Nginx 反代(sudo ./deploy-test/00-init-tools.sh nginx)
|
||||
# PC Web 版 OpenIM WASM DB worker 在公网 IP 下建议走 HTTPS + COOP/COEP。
|
||||
# 填写与下方 DEPLOY_TEST_IP 一致的 https:// 根地址,无末尾斜杠;首次浏览器访问需接受自签名证书。
|
||||
# 通过域名访问 Nginx 反代(sudo ./deploy-test/00-init-tools.sh nginx)。
|
||||
# 填写 HTTP 根地址,无末尾斜杠;Nginx 会将 / 代理到 pc :5173,并代理 API/WS。
|
||||
# ./deploy-test/07-start-frontend.sh 启动 pc 时会 export VITE_*,覆盖 pc/.env,无需改 pc 目录
|
||||
# 若某路径与网关不一致,可单独覆盖:PC_VITE_API_URL / PC_VITE_WS_URL / PC_VITE_CHAT_URL / PC_VITE_USER_URL
|
||||
PC_BACKEND_ORIGIN=https://54.116.29.247
|
||||
PC_PROXY_DOMAIN=cms-jack.imharry.work
|
||||
PC_BACKEND_ORIGIN=http://cms-jack.imharry.work
|
||||
EOF
|
||||
|
||||
success ".env.deploy-test 已写入: $ENV_FILE"
|
||||
|
||||
@@ -30,6 +30,8 @@ if [[ -f "$ENV_FILE" ]]; then
|
||||
set +a
|
||||
fi
|
||||
DEPLOY_TEST_IP="${DEPLOY_TEST_IP:-127.0.0.1}"
|
||||
PC_PROXY_DOMAIN="${PC_PROXY_DOMAIN:-cms-jack.imharry.work}"
|
||||
PC_BACKEND_ORIGIN="${PC_BACKEND_ORIGIN:-http://${PC_PROXY_DOMAIN}}"
|
||||
|
||||
init_script_log # ← 脚本执行日志
|
||||
|
||||
@@ -157,11 +159,8 @@ _start_fe() {
|
||||
if [[ -f "$pidfile" ]] && kill -0 "$(cat "$pidfile")" 2>/dev/null; then
|
||||
success " ✓ $name (PID=$(cat "$pidfile")) ${FE_PORT[$name]} → $logfile"
|
||||
if [[ "$name" == "pc" ]]; then
|
||||
pc_check_wasm_assets "http://${DEPLOY_TEST_IP}:5173"
|
||||
if [[ "${PC_BACKEND_ORIGIN:-}" == https://* ]]; then
|
||||
pc_check_wasm_assets "${PC_BACKEND_ORIGIN}"
|
||||
info " PC 浏览器入口建议使用: ${PC_BACKEND_ORIGIN%/}/(HTTPS + COOP/COEP;首次访问需接受自签名证书)"
|
||||
fi
|
||||
pc_check_wasm_assets "${PC_BACKEND_ORIGIN}"
|
||||
info " PC 浏览器入口建议使用: ${PC_BACKEND_ORIGIN%/}/"
|
||||
fi
|
||||
else
|
||||
error " ✗ $name 启动失败,查看日志:"
|
||||
@@ -201,8 +200,8 @@ if [[ "$TARGET" == "all" ]]; then
|
||||
|
||||
echo ""
|
||||
echo -e "${BOLD}访问地址:${NC}"
|
||||
echo " PC: http://${DEPLOY_TEST_IP}:5173 (默认 yarn dev:web;Electron 用 PC_ELECTRON=1 或 pc 目录内 yarn dev)"
|
||||
echo " PC HTTPS: https://${DEPLOY_TEST_IP}/ (OpenIM WASM DB worker 推荐入口;首次访问需接受自签名证书)"
|
||||
echo " PC: ${PC_BACKEND_ORIGIN%/}/ (Nginx HTTP :80 → pc :5173;默认 yarn dev:web)"
|
||||
echo " PC 直连调试: http://${DEPLOY_TEST_IP}:5173 (绕过 Nginx;Electron 用 PC_ELECTRON=1 或 pc 目录内 yarn dev)"
|
||||
echo " H5: http://${DEPLOY_TEST_IP}:3003"
|
||||
echo " CMS: http://${DEPLOY_TEST_IP}:8001"
|
||||
echo " Build CMS: http://${DEPLOY_TEST_IP}:8002"
|
||||
|
||||
@@ -262,7 +262,7 @@ pc_print_vite_backend_env() {
|
||||
info " VITE_ADMIN_URL=${VITE_ADMIN_URL:-${PC_VITE_ADMIN_URL:-<empty>}}"
|
||||
|
||||
if [[ "$PC_BACKEND_ORIGIN" == http://* ]] && [[ "$PC_BACKEND_ORIGIN" != http://127.0.0.1* ]] && [[ "$PC_BACKEND_ORIGIN" != http://localhost* ]]; then
|
||||
warn " PC_BACKEND_ORIGIN 仍是 HTTP 公网入口;OpenIM WASM DB worker 可能继续 initDB 超时。建议改为 https://${VITE_BASE_DOMAIN}"
|
||||
info " PC 使用 HTTP 公网入口: ${PC_BACKEND_ORIGIN}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ pc_check_nginx_gateway() {
|
||||
success " Nginx 网关可达: ${o}/nginx-health"
|
||||
else
|
||||
warn " Nginx 网关不可达: ${o}/nginx-health"
|
||||
warn " PC WebSocket 默认连 ${VITE_WS_URL:-ws://<host>/msg_gateway};请确认已执行 sudo ./deploy-test/00-init-tools.sh nginx,并放行 TCP 80/443"
|
||||
warn " PC WebSocket 默认连 ${VITE_WS_URL:-ws://<host>/msg_gateway};请确认已执行 sudo ./deploy-test/00-init-tools.sh nginx,并放行 TCP 80"
|
||||
fi
|
||||
|
||||
pc_probe_msg_gateway "$o"
|
||||
|
||||
@@ -297,8 +297,8 @@ await window.__deployTestResetBrowserStorage()
|
||||
await window.__deployTestManualInitDB()
|
||||
|
||||
清理后按这个顺序重测:
|
||||
1. 关闭其它 http://54.116.29.247:5173 / https://54.116.29.247 标签页
|
||||
2. 打开 https://54.116.29.247/ 并刷新页面(首次访问需接受自签名证书)
|
||||
1. 关闭其它 http://cms-jack.imharry.work/ / http://54.116.29.247:5173 标签页
|
||||
2. 打开 http://cms-jack.imharry.work/ 并刷新页面
|
||||
3. 重新粘贴本脚本输出的整段 JS(刷新会清掉已安装的 probe)
|
||||
4. 再登录
|
||||
5. 观察 counts 是否从 0 变 1,以及 /var/log/nginx/openim-pc-proxy-access.log 是否出现 /msg_gateway
|
||||
@@ -307,5 +307,5 @@ await window.__deployTestManualInitDB()
|
||||
|
||||
await window.__deployTestAuthState()
|
||||
|
||||
其中 isSecureContext / crossOriginIsolated 应为 true,SharedArrayBuffer 应为 "function"。
|
||||
HTTP 域名入口下 isSecureContext / crossOriginIsolated 通常为 false;重点观察 SDK 方法是否存在、login 是否返回成功,以及 /msg_gateway 是否建立连接。
|
||||
EOF
|
||||
|
||||
@@ -15,6 +15,8 @@ if [[ -f "$ENV_FILE" ]]; then
|
||||
source "$ENV_FILE"
|
||||
set +a
|
||||
fi
|
||||
PC_PROXY_DOMAIN="${PC_PROXY_DOMAIN:-cms-jack.imharry.work}"
|
||||
PC_BACKEND_ORIGIN="${PC_BACKEND_ORIGIN:-http://${PC_PROXY_DOMAIN}}"
|
||||
|
||||
header "服务运行状态"
|
||||
|
||||
@@ -61,7 +63,7 @@ if command -v curl &>/dev/null && [[ -n "${PC_BACKEND_ORIGIN:-}" ]]; then
|
||||
printf " ${GREEN}●${NC} %-14s %s\n" "nginx-health" "${PC_BACKEND_ORIGIN}/nginx-health"
|
||||
else
|
||||
printf " ${RED}○${NC} %-14s %s\n" "nginx-health" "${PC_BACKEND_ORIGIN}/nginx-health 不可达"
|
||||
echo " 请执行: sudo ./deploy-test/00-init-tools.sh nginx,并确认安全组/防火墙放行 TCP 80/443"
|
||||
echo " 请执行: sudo ./deploy-test/00-init-tools.sh nginx,并确认安全组/防火墙放行 TCP 80"
|
||||
fi
|
||||
gateway_host=$(printf '%s' "$PC_BACKEND_ORIGIN" | sed -E 's#^https?://([^/]+).*#\1#')
|
||||
if [[ "$PC_BACKEND_ORIGIN" == https://* ]]; then
|
||||
@@ -74,9 +76,7 @@ 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}"
|
||||
if [[ "$PC_BACKEND_ORIGIN" == https://* ]]; then
|
||||
echo " PC 页面入口: ${PC_BACKEND_ORIGIN}/ (HTTPS + COOP/COEP,首次访问需接受自签名证书)"
|
||||
fi
|
||||
echo " PC 页面入口: ${PC_BACKEND_ORIGIN}/ (Nginx HTTP :80 → pc :5173)"
|
||||
echo " Nginx 日志: /var/log/nginx/openim-pc-proxy-access.log"
|
||||
pc_probe_msg_gateway "$PC_BACKEND_ORIGIN"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user