21830d507d
P0 修复 — /itportal/ HTTP 500(连续 3+ 天阻塞)
根因分析:
- portal 源码 frontend-portal/ 在 commit bea288e4 (2026-07-11) 被误删
- portal dist 不存在(前端目录已不存在)
- backend/app/api/portal.py 也已删除
- /api/portal/* API 不再在 router.py 注册
- 但 nginx 配置 + docker-compose 仍引用 portal dist → try_files 指向空目录 → 500
- nginx-split.conf 还有根路径重定向 / → /itportal/ → 用户访问根域名直接 500
修复(最小集、最安全):
1. nginx 6 个配置(nginx/nginx.conf + 5 个 deploy-server 历史变体):
- 删除 location /itportal/ { alias ... } 静态块
- 保留 location /itportal/meetingroom/ API 块(最长前缀仍命中)
- nginx-split.conf / nginx-full.conf / nginx-green-upstream.conf 根重定向
/itportal/ → /itdesk/
2. docker-compose 4 个配置(+split):
- 删除 ./frontend-portal/dist 或 ./html/itportal 卷挂载
3. deploy-server/deploy.sh:
- 删除 portal dist 备份/解压步骤
- 部署完成提示去掉 /itportal/ 入口
预期效果:
- /itportal/ → nginx 404(不再 500)
- /itportal/meetingroom/ → API 仍工作(终端+H5 共用会议室预定)
- /itdesk/ /itagent/ /itadmin/ /itterminal/ 不受影响
- 根域名访问 → 重定向到 /itdesk/(H5 入口)
文件改动:
- nginx/nginx.conf(双 server block)
- deploy-server/nginx.conf(双 server block)
- deploy-server/nginx-full.conf + green-upstream.conf + nginx.conf + nginx-split.conf
- docker-compose.yml + 3 个 deploy-server 变体
- deploy-server/deploy.sh
⚠️ 待部署(无 jumpserver/VPN):本地已就绪,需在 jumpserver-V2 流程下
scp 上述 11 个文件到 /opt/wecom-it-desk/ 覆盖 + docker compose restart nginx 验证
验证命令:curl -I https://itsupport.servyou.com.cn/itportal/ 期望返回 404(或 301/302)
curl -I https://itsupport.servyou.com.cn/itportal/meetingroom/... 期望 200/401/403
curl -I https://itsupport.servyou.com.cn/ 期望 302 → /itdesk/
Refs: 滴答清单任务 6a6bfc29e4b06440c36701e1 (P0 逾期 1 天)
94 lines
3.4 KiB
YAML
94 lines
3.4 KiB
YAML
# =============================================================================
|
||
# 企微智能IT支持服务台 — Docker Compose (Green 环境)
|
||
# =============================================================================
|
||
# 用途:蓝绿部署之 Green 环境
|
||
# 端口:后端 5002, Nginx 5080/5443
|
||
# 数据库/Redis:与 Blue 共用(通过 external_links)
|
||
# =============================================================================
|
||
|
||
services:
|
||
# --------------------------------------------------------------------------
|
||
# FastAPI 后端 — Green 环境
|
||
# --------------------------------------------------------------------------
|
||
backend:
|
||
build:
|
||
context: ./backend
|
||
dockerfile: Dockerfile
|
||
image: wecom-it-desk-backend:green
|
||
container_name: wecom_it_backend_green
|
||
restart: unless-stopped
|
||
ports:
|
||
- "5002:8000"
|
||
external_links:
|
||
- wecom_it_postgres:postgres
|
||
- wecom_it_redis:redis
|
||
environment:
|
||
- WECOM_CORP_ID=${WECOM_CORP_ID}
|
||
- WECOM_AGENT_ID=${WECOM_AGENT_ID}
|
||
- WECOM_SECRET=${WECOM_SECRET}
|
||
- WECOM_TOKEN=${WECOM_TOKEN}
|
||
- WECOM_ENCODING_AES_KEY=${WECOM_ENCODING_AES_KEY}
|
||
# 使用 Blue 的数据库和 Redis(通过 external_links 访问)
|
||
- DATABASE_URL=postgresql://${POSTGRES_USER:-wecom}:${POSTGRES_PASSWORD:-wecom_secret_2026}@postgres:5432/${POSTGRES_DB:-wecom_it_desk}
|
||
- REDIS_URL=redis://:${REDIS_PASSWORD:-R3d!s@2026#Secure}@redis:6379/0
|
||
- CORS_ORIGINS=${CORS_ORIGINS:-http://itsupport.servyou.com.cn}
|
||
- DIFY_API_URL=${DIFY_API_URL}
|
||
- DIFY_API_KEY=${DIFY_API_KEY}
|
||
- DIFY_TIMEOUT=${DIFY_TIMEOUT:-30}
|
||
- DIFY_WINGMAN_API_URL=${DIFY_WINGMAN_API_URL:-}
|
||
- DIFY_WINGMAN_API_KEY=${DIFY_WINGMAN_API_KEY:-}
|
||
- DIFY_WINGMAN_TIMEOUT=${DIFY_WINGMAN_TIMEOUT:-30}
|
||
- MOCK_LOGIN_ENABLED=${MOCK_LOGIN_ENABLED:-false}
|
||
- WECOM_SSO_ENABLED=${WECOM_SSO_ENABLED:-false}
|
||
- WECOM_SSO_CALLBACK_BASE=${WECOM_SSO_CALLBACK_BASE:-https://itsupport.servyou.com.cn}
|
||
- BACKEND_HOST=0.0.0.0
|
||
- BACKEND_PORT=8000
|
||
command: ["/bin/sh", "-c", "echo '>>> Green Environment' && uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 1"]
|
||
networks:
|
||
- it-desk-internal
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "curl -f http://localhost:8000/health || exit 1"]
|
||
interval: 15s
|
||
timeout: 5s
|
||
retries: 3
|
||
start_period: 30s
|
||
logging:
|
||
driver: "json-file"
|
||
options:
|
||
max-size: "20m"
|
||
max-file: "5"
|
||
|
||
# --------------------------------------------------------------------------
|
||
# Nginx — Green 环境反向代理
|
||
# --------------------------------------------------------------------------
|
||
nginx:
|
||
image: nginx:1.27-alpine
|
||
container_name: wecom_it_nginx_green
|
||
restart: unless-stopped
|
||
ports:
|
||
- "80:80"
|
||
- "443:443"
|
||
volumes:
|
||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
||
- ./nginx/ssl:/etc/nginx/ssl:ro
|
||
- ./html/itdesk:/usr/share/nginx/html/itdesk:ro
|
||
- ./html/itagent:/usr/share/nginx/html/itagent:ro
|
||
- ./html/itadmin:/usr/share/nginx/html/itadmin:ro
|
||
environment:
|
||
- NGINX_HOST=localhost
|
||
- NGINX_PORT=80
|
||
depends_on:
|
||
- backend
|
||
networks:
|
||
- it-desk-internal
|
||
logging:
|
||
driver: "json-file"
|
||
options:
|
||
max-size: "10m"
|
||
max-file: "3"
|
||
|
||
networks:
|
||
it-desk-internal:
|
||
name: wecom-it-desk_it-desk-internal
|
||
external: true
|