Repository navigation
fix(deploy): 服务器部署问题修复 (P0-P3) + 容器/文档/npx 修复 - #48
Merged
Merged
Conversation
- db: dash_device_status 补 device_type 字段 (init.sql + V14 幂等迁移) - ai: CPU-only 依赖 requirements-cpu.txt + Dockerfile DEVICE 参数 (默认 cpu, 避免 >2GB torch 镜像) - compose: x-common-env 锚点统一环境变量; Redis 用 REDIS_HOST (对齐 application.yml); Kafka 用 KAFKA_BOOTSTRAP_SERVERS (修复 dashboard 连接 localhost 问题); quality 移除多余 kafka 配置 - docker: 6 个 Java 服务 Dockerfile 默认 SPRING_PROFILES_ACTIVE=docker - cors: 预设 https://*.reality-blog.asia 与隧道域名 - api: 批量创建设备返回 created/skipped/errors 明细; SQL 语法异常友好提示 - docs: DEPLOYMENT.md 同步 AI CPU/GPU、Cloudflare、环境变量规范
- requirements.txt 移除从未使用的 skl2onnx/onnx/onnxmltools/joblib, 仅保留 src 实际 import 的运行时依赖(训练导出 ONNX 为可选项,注明安装方式) - 删除 requirements-cpu.txt(requirements.txt 精简后不再需要) - Dockerfile 简化为单一依赖安装,移除 DEVICE 参数 - docker-compose.prod.yml 移除 AI_DEVICE 参数 - DEPLOYMENT.md 同步依赖说明
- mes-frontend: npm 镜像源默认 npmmirror (ARG NPM_REGISTRY 可覆盖) - mes-ai-service: pip 镜像源默认清华源 (ARG PIP_INDEX 可覆盖)
- kafka: advertised listeners 由 localhost 改为容器服务名 kafka, 修复容器内客户端(如 dashboard)连不上 broker 的问题 - ai: 镜像补 COPY knowledge/ (RAG 文档缺失会导致知识库为空); 新增 .dockerignore 排除 .venv/__pycache__ 等, 避免构建上下文膨胀 - java x6: .dockerignore 修复 target/ 排除与 COPY target/*.jar 冲突 (此前镜像构建必然失败); apt 源换阿里云镜像 + --no-install-recommends - frontend: npm install 改 npm ci --no-audit --no-fund (按 lock 安装, 少发审计请求) - dev.yml: quality 移除多余的 kafka depends_on; dashboard 补 kafka 健康依赖
容器: - Dockerfile 改用 python:3.12-slim (与本地/README 技术栈一致) - 新增 HEALTHCHECK (/api/v1/health, 标准库 urllib, 无需额外装 curl) - prod.yml AI 服务补 healthcheck 代码: - conversation_store.init_db MySQL 不可用时降级告警, 不再阻断启动 (LLM/预测/分析不受影响, 与 Redis 降级策略一致) - main.py 端口改读 config.yaml server 段 (AI_PORT/AI_HOST 可覆盖), 修复文档声称'配置文件包含端口'实际硬编码的不一致 配置: - config.yaml 删除未被代码使用的 kafka 死配置段 - llm.api_key 改为空串+注释, 明确密钥只读环境变量 ZHIPU_API_KEY 文档: - README: 工具数 15→19, 知识库文档数按实际修正, 项目结构 修正 (train.py→根目录 train_models.py, 删除不存在的 models/), 鉴权说明补 model/status 例外, Docker 部署补 compose 方式与环境变量, config.yaml 示例与真实文件对齐 - DEPLOYMENT.md: 补充 AI 健康检查/自动建表/降级说明
nginx.conf: - 新增 map X-Forwarded-Proto 透传: Cloudflare Flexible SSL 下 后端网关能正确识别 https 协议(修复重定向/安全头误判) - WebSocket 升级改标准 map 写法(\ → close/upgrade), 非 WS 请求不再强制 Connection: upgrade - client_max_body_size 20m, server_tokens off, gzip_vary on DEPLOYMENT.md: - 新增 §10 Nginx 与 Cloudflare Tunnel 完整章节: 架构图 / 容器 nginx 能力清单 / 宿主机 nginx 停用或 80→3000 转发示例 / Cloudflare 设置要点 / 6 类常见问题排查表
- .env.production: VITE_AI_SERVICE_URL /api/ai → /ai (axios baseURL 已是 /api, 拼接后应为 /api/ai/** 而非 /api/api/ai/**) - docker-compose.prod.yml: 前端构建参数同步改为 /ai, 加注释防回退 - DEPLOYMENT.md: 新增 API 路径拼接规范 (baseURL 唯一前缀来源, AI 模块相对 /ai, 网关 StripPrefix=2 链路说明) 说明: 服务器上的 nginx rewrite 临时规则 (^/api/api/ai/) 在重新构建 前端容器后随镜像替换自动移除, 无需手工清理
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
汇总 6 个提交的服务器部署修复: