feat: 更新后端配置、Docker部署、API模块及多项文档

- 更新后端 main.py、config.py 核心配置
- 更新 compute API 模块
- 更新 Docker 部署配置(app/compute docker-compose、nginx、环境变量)
- 更新前端 API 模块(dataset、model、request)及 vite 配置
- 更新多项项目文档(架构、部署、开发计划、日志等)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
wuyongtao
2026-07-21 10:09:36 +08:00
parent a67ca2c19c
commit bccd3bf448
21 changed files with 418 additions and 415 deletions

View File

@@ -7,7 +7,7 @@
| 镜像 | 用途 |
| --- | --- |
| `python:3.12-slim` | 应用后端基础镜像,后端运行环境要求 Python 3.12 及以上 |
| `nginx:1.27-alpine` | 前端静态资源与 `/api` 反向代理运行镜像 |
| `nginx:1.27-alpine` | 前端静态资源与 `/modelTF` 反向代理运行镜像 |
| `hiyouga/llamafactory:latest` | 算力服务基础镜像,基于 LLaMA-Factory 官方镜像扩展 Compute API |
| `postgres:16-alpine` | 开发阶段内置 PostgreSQL |
| `redis:7-alpine` | 开发阶段内置 Redis |
@@ -152,8 +152,8 @@ docker compose up -d
健康检查:
```text
GET http://<compute-server-ip>:19100/health
GET http://<compute-server-ip>:19100/api/v1/compute/health
GET http://<compute-server-ip>:19100/modelTF/health
GET http://<compute-server-ip>:19100/modelTF/v1/compute/health
```
算力侧代码和数据外挂:

View File

@@ -1,6 +1,6 @@
APP_ENV=prod
APP_NAME=YG Fine-Tune Platform API
API_PREFIX=/api
MODELTF_ROUTE_PREFIX=/modelTF
FRONTEND_IMAGE=yg-ft-frontend-runtime:latest
BACKEND_API_IMAGE=yg-ft-backend-api:latest
@@ -30,7 +30,7 @@ LOG_ERROR_FILE_PREFIX=error
LOG_MAX_BYTES=20971520
LOG_RETENTION_DAYS=10
API_PROXY_PASS=http://backend-api:8000
BACKEND_PROXY_PASS=http://backend-api:8000
# Split deployment: set these to the compute server address, for example http://10.10.20.31:19100.
COMPUTE_API_BASE_URL=http://compute-api:9100

View File

@@ -8,7 +8,7 @@ services:
ports:
- "${FRONTEND_PORT:-16801}:80"
environment:
API_PROXY_PASS: ${API_PROXY_PASS:-http://backend-api:8000}
BACKEND_PROXY_PASS: ${BACKEND_PROXY_PASS:-http://backend-api:8000}
volumes:
- ../../frontend/dist:/usr/share/nginx/html:ro
- ../nginx.conf.template:/etc/nginx/templates/default.conf.template:ro
@@ -31,7 +31,7 @@ services:
environment:
APP_ENV: ${APP_ENV:-prod}
APP_NAME: ${APP_NAME:-YG Fine-Tune Platform API}
API_PREFIX: ${API_PREFIX:-/api}
MODELTF_ROUTE_PREFIX: ${MODELTF_ROUTE_PREFIX:-/modelTF}
DATABASE_URL: ${DATABASE_URL:-postgresql+asyncpg://yg_ft:change_me@postgres:5432/yg_ft}
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}
USE_BUILTIN_POSTGRES: ${USE_BUILTIN_POSTGRES:-true}
@@ -56,7 +56,7 @@ services:
networks:
- yg-ft-app
healthcheck:
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/api/v1/health', timeout=3).read()\""]
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/modelTF/health', timeout=3).read()\""]
interval: 30s
timeout: 5s
retries: 3

View File

@@ -1,5 +1,6 @@
COMPUTE_ENV=prod
COMPUTE_HOST_ID=gpu-node-01
MODELTF_ROUTE_PREFIX=/modelTF
# Five-digit host ports exposed outside the compute server.
COMPUTE_API_PORT=19100
FILE_GATEWAY_PORT=19101

View File

@@ -8,6 +8,7 @@ services:
environment:
COMPUTE_ENV: ${COMPUTE_ENV:-prod}
COMPUTE_HOST_ID: ${COMPUTE_HOST_ID:-gpu-node-01}
MODELTF_ROUTE_PREFIX: ${MODELTF_ROUTE_PREFIX:-/modelTF}
COMPUTE_SERVICE_TOKEN: ${COMPUTE_SERVICE_TOKEN:-change_me}
ENABLE_APP_CALLBACK: ${ENABLE_APP_CALLBACK:-false}
LLAMA_FACTORY_HOME: ${LLAMA_FACTORY_HOME:-/app/LLaMA-Factory}
@@ -25,7 +26,7 @@ services:
networks:
- yg-ft-compute
healthcheck:
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://127.0.0.1:9100/health', timeout=3).read()\""]
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://127.0.0.1:9100/modelTF/health', timeout=3).read()\""]
interval: 30s
timeout: 5s
retries: 3

View File

@@ -11,8 +11,8 @@ server {
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass ${API_PROXY_PASS};
location /modelTF {
proxy_pass ${BACKEND_PROXY_PASS};
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@@ -27,4 +27,4 @@ server {
expires 30d;
add_header Cache-Control "public, immutable";
}
}
}