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:
46
AGENTS.md
46
AGENTS.md
@@ -14,29 +14,31 @@ BtToxin Pipeline is an automated Bacillus thuringiensis toxin mining system. It
|
||||
| Package Manager | pixi (conda environments) |
|
||||
| Pipeline | Python 3.9+ (pandas, matplotlib, seaborn) |
|
||||
| Digger Tool | BtToxin_Digger (Perl, BLAST, HMMER) |
|
||||
| Frontend | Vue 3 + Vite + Element Plus |
|
||||
| Backend | FastAPI + Uvicorn |
|
||||
| Frontend | Vue 3 + Vite + Element Plus + vue-i18n |
|
||||
| Backend | FastAPI + Uvicorn + SQLAlchemy |
|
||||
| Database | PostgreSQL 15 (Metadata) + Redis 7 (Queue) |
|
||||
| Result Storage | File system + 30-day retention |
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# 1. 克隆并安装依赖
|
||||
# 1. Clone and install dependencies
|
||||
git clone <repo>
|
||||
cd bttoxin-pipeline
|
||||
pixi install
|
||||
|
||||
# 2. 启动前后端服务(推荐)
|
||||
# 2. Start services (Docker recommended for full stack)
|
||||
# Using DaoCloud mirrors for faster builds in CN
|
||||
docker compose -f docker/compose/docker-compose.traefik.yml up -d --build
|
||||
|
||||
# Access:
|
||||
# Frontend: https://bttiaw.hzau.edu.cn (via Traefik)
|
||||
# Backend API: http://localhost:8000 (Internal)
|
||||
# Traefik Dashboard: http://localhost:8080
|
||||
|
||||
# 3. Development Mode (Local)
|
||||
pixi run web-start
|
||||
|
||||
# 前端访问: http://localhost:5173
|
||||
# 后端 API: http://localhost:8000
|
||||
|
||||
# 或者分别启动
|
||||
pixi run fe-dev # 仅前端
|
||||
pixi run api-dev # 仅后端
|
||||
|
||||
# 3. 通过网页提交任务
|
||||
```
|
||||
# - 上传 .fna 基因组文件
|
||||
# - 配置参数
|
||||
# - 点击提交
|
||||
@@ -180,7 +182,7 @@ Parameters:
|
||||
- min_coverage: float (0-1, default: 0.6)
|
||||
- allow_unknown_families: boolean (default: false)
|
||||
- require_index_hit: boolean (default: true)
|
||||
- lang: "zh" | "en" (default: "zh")
|
||||
- lang: "zh" | "en" (default: "zh") - *Now supported via Accept-Language header*
|
||||
|
||||
Response:
|
||||
{
|
||||
@@ -283,10 +285,11 @@ docker-compose -f docker-compose.simple.yml up -d
|
||||
### Docker Architecture
|
||||
|
||||
```
|
||||
bttoxin-pipeline (single container)
|
||||
├── nginx (port 80) # Reverse proxy + static files
|
||||
├── uvicorn (port 8000) # FastAPI backend
|
||||
└── pixi environments # digger, pipeline, webbackend
|
||||
bttoxin-pipeline (Stack)
|
||||
├── traefik (reverse proxy, port 80/443)
|
||||
├── bttoxin-pipeline (FastAPI + Static Files, port 8000)
|
||||
├── bttoxin-postgres (Database, port 5432)
|
||||
└── bttoxin-redis (Task Queue, port 6379)
|
||||
```
|
||||
|
||||
### Docker Volume Mounts
|
||||
@@ -294,11 +297,8 @@ bttoxin-pipeline (single container)
|
||||
| Host Path | Container Path | Purpose |
|
||||
|-----------|----------------|---------|
|
||||
| `./jobs` | `/app/jobs` | Task results |
|
||||
| `./frontend/dist` | `/var/www/html` | Frontend static files |
|
||||
| `./web` | `/app/web` | Backend code |
|
||||
| `./Data` | `/app/Data` | Reference data |
|
||||
| `./scripts` | `/app/scripts` | Pipeline scripts |
|
||||
| `./pixi.toml` | `/app/pixi.toml` | Pixi configuration |
|
||||
| `postgres_data` | `/var/lib/postgresql/data` | Database persistence |
|
||||
| ... | ... | Source code mounts (dev) |
|
||||
|
||||
## Task Flow
|
||||
|
||||
|
||||
Reference in New Issue
Block a user