Files
bttoxin-pipeline/@fix_plan.md
zly 9835b6e341 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>
2026-01-14 12:38:54 +08:00

6.4 KiB
Raw Blame History

BtToxin Pipeline 开发任务清单

高优先级 (P0) - 基础功能

Frontend - 国际化与导航

  • F1.1: 安装并配置 vue-i18n
  • F1.2: 创建 locales/zh.jsonlocales/en.json 翻译文件
  • F1.3: 在 App.vue 添加完整导航栏(首页 | 关于 | 提交任务 | 任务状态 | 工具说明)
  • F1.4: 添加中英文切换按钮(全局,页面显眼处)
  • F1.5: 将所有硬编码文本替换为 i18n 变量

Frontend - 上传功能增强

  • F2.1: 支持 .fna / .fa 基因组文件 和 .faa / .fasta 蛋白序列文件
  • F2.2: 单文件上传限制(每次只能上传 1 个文件)
  • F2.3: 基因组和蛋白序列互斥(不能同时上传)
  • F2.4: 添加悬浮提示说明(文件类型要求、格式说明)
  • F2.5: 表单验证 - 不符合条件时弹出错误提示

Frontend - 任务状态页面增强

  • F3.1: 区分运行中 (running) 和排队中 (pending/queued) 状态
  • F3.2: 排队状态显示当前排队序号(如 "排队中:第 3 位"
  • F3.3: 运行状态显示进度条
  • F3.4: 更新 PIPELINE_STAGES 支持蛋白序列流程

Frontend - 关于页面

  • F4.1: 创建 AboutView.vue
  • F4.2: 介绍 BtToxin Pipeline 功能
  • F4.3: 展示示例结果截图(预留位置)
  • F4.4: 注意事项和限制说明

Frontend - 工具说明页面

  • F5.1: 创建 ToolInfoView.vue重命名为"工具说明"
  • F5.2: 介绍 BtToxin_Shoter 的评估原理(不说数学公式)
  • F5.3: 说明识别流程和阈值设定依据
  • F5.4: 不提及 BtToxin_Digger

Backend - FastAPI 重构

  • B1.1: 创建 FastAPI 后端 (backend/app/main.py)
  • B1.2: 实现任务创建 API (POST /api/v1/jobs/create)
  • B1.3: 实现任务状态查询 API (GET /api/v1/jobs/{job_id})
  • B1.4: 实现结果下载 API (GET /api/v1/results/{job_id}/download)
  • B1.5: 实现任务删除 API (DELETE /api/v1/results/{job_id})

Backend - 并发控制

  • B2.1: 实现 16 并发限制(使用 ConcurrencyManager + Redis
  • B2.2: 实现任务排队机制QUEUED 状态)
  • B2.3: API 返回排队位置或预计等待时间
  • B2.4: Redis 存储任务状态和队列信息

Backend - 多格式支持

  • B3.1: 自动检测上传文件类型(.fna/.fa/.faa/.fasta
  • B3.2: 根据文件类型设置 sequence_type (nucl/prot)
  • B3.3: 修改 pipeline 脚本支持蛋白序列输入

中优先级 (P1) - 增强功能

CRISPR-Cas 预留

  • C1.1: 创建 crispr_cas/ 目录结构(文档已准备,目录待实现时创建)
  • C1.2: 在 pixi.toml 添加 [feature.crispr] 环境
  • C1.3: 在 bttoxin_shoter.py 预留 CRISPR 权重参数和融合函数(已文档化)
  • C1.4: 文档说明后续如何实现 CRISPR 分析

后端国际化

  • B4.1: API 返回文本支持多语言
  • B4.2: 错误消息国际化

前端样式优化

  • F6.1: 使用 ui-ux-pro-max skill 优化页面风格
  • F6.2: 参考 Apple 风格设计(配色、间距、动画)
  • F6.3: 响应式布局优化

低优先级 (P2) - 部署与文档

Docker 部署

  • D1.1: 创建 FastAPI 专用 Dockerfile
  • D1.2: 更新 docker-compose.yml
  • D1.3: 配置 Traefik labels
  • D1.4: 测试域名访问 (bttiaw.hzau.edu.cn) Domain accessible, Traefik routing OK

文档

  • Doc1: 更新 AGENTS.md
  • Doc2: 编写部署文档

已完成

  • 初始版本提交 - 简化架构 + 轮询改造
  • 2025-01-13 #1: Backend API enhancements - tasks router, download/delete endpoints, concurrency control, queue management
  • 2025-01-13 #2: Pipeline script enhancement - protein file (.faa) support with automatic type detection
  • 2025-01-13 #3: Docker deployment - SPA static file serving, Traefik labels, docker-compose configuration
  • 2025-01-13 #4: CRISPR-Cas reservation - infrastructure prepared, implementation plan documented
  • 2025-01-14 #5: UI/UX Phase 1 - Apple-inspired design system with glassmorphism navbar, animated hero section, enhanced feature cards, comprehensive design tokens
  • 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
  • 2025-01-14 #7: Deployment attempt - Identified Docker registry configuration issue (docker.fnnas.com returning 401)
  • 2025-01-14 #8: Full Deployment Success - Fixed all build/runtime errors and successfully deployed bttoxin-pipeline container.
  • 2025-01-14 #9: Backend Internationalization - Implemented i18n infrastructure and localized API responses.
  • 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

# 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