feat(deploy): fix docker deployment and add backend i18n

- Docker Deployment Fixes:
  - Switch base images to docker.m.daocloud.io to resolve registry 401 errors
  - Add Postgres and Redis services to docker-compose.traefik.yml
  - Fix frontend build: replace missing icons (Globe->Location, Chart->TrendCharts)
  - Fix frontend build: resolve pnpm CI/TTY issues and frozen lockfile errors
  - Add missing backend dependencies (sqlalchemy, psycopg2, redis-py, celery, docker-py) in pixi.toml
  - Ensure database tables are created on startup (lifespan event)

- Backend Internationalization (i18n):
  - Add backend/app/core/i18n.py for locale handling
  - Update API endpoints (jobs, tasks, uploads, results) to return localized messages
  - Support 'Accept-Language' header (en/zh)

- Documentation:
  - Update DOCKER_DEPLOYMENT.md with new architecture and troubleshooting
  - Update AGENTS.md with latest stack details and deployment steps
  - Update @fix_plan.md status

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
zly
2026-01-14 12:38:54 +08:00
parent c0f2de02ca
commit 9835b6e341
32 changed files with 1924 additions and 231 deletions

View File

@@ -71,14 +71,14 @@
### 后端国际化
- [ ] **B4.1**: API 返回文本支持多语言
- [ ] **B4.2**: 错误消息国际化
- [x] **B4.1**: API 返回文本支持多语言
- [x] **B4.2**: 错误消息国际化
### 前端样式优化
- [ ] **F6.1**: 使用 ui-ux-pro-max skill 优化页面风格
- [ ] **F6.2**: 参考 Apple 风格设计(配色、间距、动画)
- [ ] **F6.3**: 响应式布局优化
- [x] **F6.1**: 使用 ui-ux-pro-max skill 优化页面风格
- [x] **F6.2**: 参考 Apple 风格设计(配色、间距、动画)
- [x] **F6.3**: 响应式布局优化
## 低优先级 (P2) - 部署与文档
@@ -87,12 +87,12 @@
- [x] **D1.1**: 创建 FastAPI 专用 Dockerfile
- [x] **D1.2**: 更新 docker-compose.yml
- [x] **D1.3**: 配置 Traefik labels
- [ ] **D1.4**: 测试域名访问 (bttiaw.hzau.edu.cn)
- [x] **D1.4**: 测试域名访问 (bttiaw.hzau.edu.cn) ✅ Domain accessible, Traefik routing OK
### 文档
- [ ] **Doc1**: 更新 AGENTS.md
- [ ] **Doc2**: 编写部署文档
- [x] **Doc1**: 更新 AGENTS.md
- [x] **Doc2**: 编写部署文档
## 已完成
@@ -101,10 +101,54 @@
- [x] **2025-01-13 #2**: Pipeline script enhancement - protein file (.faa) support with automatic type detection
- [x] **2025-01-13 #3**: Docker deployment - SPA static file serving, Traefik labels, docker-compose configuration
- [x] **2025-01-13 #4**: CRISPR-Cas reservation - infrastructure prepared, implementation plan documented
- [x] **2025-01-14 #5**: UI/UX Phase 1 - Apple-inspired design system with glassmorphism navbar, animated hero section, enhanced feature cards, comprehensive design tokens
- [x] **2025-01-14 #6**: Domain testing - Verified bttiaw.hzau.edu.cn is accessible via Traefik (HTTP/2, SSL working), returns 404 because production container not deployed yet
- [x] **2025-01-14 #7**: Deployment attempt - Identified Docker registry configuration issue (docker.fnnas.com returning 401)
- [x] **2025-01-14 #8**: Full Deployment Success - Fixed all build/runtime errors and successfully deployed `bttoxin-pipeline` container.
- [x] **2025-01-14 #9**: Backend Internationalization - Implemented i18n infrastructure and localized API responses.
- [x] **2025-01-14 #10**: Documentation Update - Updated AGENTS.md and DOCKER_DEPLOYMENT.md with new architecture (Postgres/Redis) and deployment steps.
## 参考文档
- Shotter 算法原理: `docs/shotter_math_full_zh_typora.md`
- CRISPR 实现计划: `docs/CRISPR_IMPLEMENTATION_PLAN.md`
- UI/UX 设计计划: `docs/UI_UX_DESIGN_PLAN.md`
- 现有前端代码: `frontend/src/`
- Pixi 环境配置: `pixi.toml`
## 部署状态
### 当前状态 (2025-01-14)
- **Traefik**: ✅ Running (traefik:v3.5.3)
- **Domain**: ✅ Configured (bttiaw.hzau.edu.cn)
- **SSL/HTTPS**: ✅ Working (self-signed cert)
- **Routing**: ✅ Traefik routing to domain OK
- **Docker Build**: ✅ **SUCCESS** - Image built and service running
- **Health Check**: ✅ Passed (internal curl test)
### 部署问题 (已解决)
**Fixed**:
- Docker registry 401 error: Switched to `docker.m.daocloud.io`
- Frontend build errors: Fixed missing icons and types
- Backend dependencies: Added missing python packages
- Import errors: Fixed missing classes in backend models
### 部署步骤
**Standard Deployment**
```bash
# Build and start services
docker compose -f docker/compose/docker-compose.traefik.yml up -d --build
# View logs
docker logs -f bttoxin-pipeline
```
### 完整部署流程
Once registry issue is resolved:
1. Build production image: `docker build -f docker/dockerfiles/Dockerfile.traefik -t bttoxin-prod .`
2. Deploy with docker-compose: `docker-compose -f docker/compose/docker-compose.traefik.yml up -d`
3. Verify deployment: `curl -k https://bttiaw.hzau.edu.cn`
4. Check logs: `docker logs bttoxin-pipeline`