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

@@ -3,6 +3,26 @@
# The container exposes port 8000 where FastAPI serves both API and frontend
services:
postgres:
image: docker.m.daocloud.io/library/postgres:15-alpine
container_name: bttoxin-postgres
restart: unless-stopped
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
- POSTGRES_DB=bttoxin
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- traefik-network
redis:
image: docker.m.daocloud.io/library/redis:7-alpine
container_name: bttoxin-redis
restart: unless-stopped
networks:
- traefik-network
bttoxin:
build:
context: ../..
@@ -13,8 +33,14 @@ services:
- ../../jobs:/app/jobs
environment:
- JOBS_DIR=/app/jobs
# No need for ROOT_PATH since Traefik handles the routing
- DATABASE_URL=postgresql://postgres:password@postgres:5432/bttoxin
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
restart: unless-stopped
depends_on:
- postgres
- redis
networks:
- traefik-network
labels:
@@ -44,6 +70,9 @@ networks:
# Create this network first: docker network create traefik-network
# Or set external: false to let docker-compose create it
volumes:
postgres_data:
# Example Traefik configuration (traefik.yml):
#
# services: