Files
YG_FT/docker/README.md

59 lines
2.5 KiB
Markdown
Raw Permalink Normal View History

# Docker 部署说明
## 部署边界
生产规划分为应用服务器、存储服务器和算力服务器。应用服务器运行 Frontend Nginx、Backend API、Redis存储服务器运行 MinIO算力服务器运行 Compute API、Compute Agent、GPU 和训练引擎。三类服务器不共享 Docker 网络,通过可路由地址通信。
当前 WSL 联调地址为 `172.25.179.69`,拆分部署时必须替换为真实服务器地址。
## 配置
应用服务器 `docker/app/.env`
```env
MINIO_ENABLED=true
MINIO_ENDPOINT=http://172.25.179.69:19000
COMPUTE_API_BASE_URL=http://172.25.179.69:19100
FILE_GATEWAY_BASE_URL=http://172.25.179.69:19101
COMPUTE_STATUS_SYNC_MODE=polling
COMPUTE_POLL_INTERVAL_SECONDS=3
```
MinIO 不需要额外安装 Python 包Backend 的 MinIO 兼容访问依赖随 `backend/requirements.txt` 安装。生产环境应使用固定 DNS/IP、内网访问和防火墙白名单。
## 构建和启动
```bash
docker build -f docker/app/Dockerfile.backend -t yg-ft-backend-api:latest .
docker build -f docker/app/Dockerfile.frontend -t yg-ft-frontend-runtime:latest .
docker build -f docker/compute/Dockerfile.compute -t yg-ft-compute-api:latest .
cd docker/minio && docker compose up -d
cd ../app && docker compose up -d
cd ../compute && docker compose up -d
```
验证命令:`docker compose ps``curl http://<app-server>:17861/modelTF/health``curl http://<compute-server>:19100/modelTF/health``curl http://<minio-server>:19000/minio/health/live`
## 端口
| 服务 | 主机端口 | 容器端口 |
| --- | ---: | ---: |
| Frontend | 16801 | 80 |
| Backend API | 17861 | 8000 |
| Redis | 16379 | 6379 |
| MinIO API/Console | 19000/19001 | 9000/9001 |
| Compute API/File Gateway | 19100/19101 | 9100 |
## 数据和安全
算力主机应持久化 `/data/yg-ft/models``datasets``trained_models``outputs``cache` 以及训练日志目录。上述目录是 Compute Agent 的本地缓存和运行目录,权威对象必须归档 MinIO。
- Compute API 和 File Gateway 开启 token 认证。
- MinIO 不直接暴露公网,使用内网或安全组限制访问。
- 不在镜像和 Git 中提交数据库、Redis、MinIO 密码或服务 token。
- 当前 Compute API 默认 root 仅适用于开发阶段,生产环境需评估非 root 和 GPU/挂载目录权限改造。
## 拆分验证
从 Backend 容器验证 MinIO 和每个 Compute API 的 health上传数据集、训练、权重合并、推理和节点断网重试均需完成一次联调。