chore: 初始版本提交 - 简化架构 + 轮询改造
- 移除 Motia Streams 实时通信,改用 3 秒轮询 - 简化前端代码,移除冗余组件 - 简化后端架构,准备 FastAPI 重构 - 更新 pixi.toml 环境配置 - 保留 bttoxin_digger_v5_repro 作为参考文档 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
28
docker/compose/docker-compose.simple.yml
Normal file
28
docker/compose/docker-compose.simple.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
services:
|
||||
# 单容器部署: Nginx + Backend + Frontend
|
||||
bttoxin:
|
||||
image: ghcr.io/prefix-dev/pixi:latest
|
||||
container_name: bttoxin-pipeline
|
||||
ports:
|
||||
- "8888:80" # 使用 8888 端口避免与 traefik 冲突
|
||||
volumes:
|
||||
- ../../jobs:/app/jobs
|
||||
- ../../frontend/dist:/var/www/html
|
||||
- ../../backend:/app/backend
|
||||
- ../../web:/app/web
|
||||
- ../../Data:/app/Data
|
||||
- ../../scripts:/app/scripts
|
||||
- ../../pixi.toml:/app/pixi.toml
|
||||
- ../nginx/default.conf:/etc/nginx/sites-available/default:ro
|
||||
- ../scripts/entrypoint.sh:/app/entrypoint.sh:ro
|
||||
working_dir: /app
|
||||
environment:
|
||||
- JOBS_DIR=/app/jobs
|
||||
- API_BASE_URL=${API_BASE_URL:-http://your-domain.com}
|
||||
entrypoint: ["/bin/bash", "/app/entrypoint.sh"]
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
restart: unless-stopped
|
||||
18
docker/compose/docker-compose.test.yml
Normal file
18
docker/compose/docker-compose.test.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
# Use port 443 (HTTPS) which Tailscale typically allows
|
||||
|
||||
services:
|
||||
bttoxin:
|
||||
image: bttoxin-pipeline:latest
|
||||
container_name: bttoxin-pipeline
|
||||
ports:
|
||||
- "443:8000" # Use HTTPS port 443
|
||||
volumes:
|
||||
- ../../jobs:/app/jobs
|
||||
environment:
|
||||
- JOBS_DIR=/app/jobs
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8000/api/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
68
docker/compose/docker-compose.traefik.yml
Normal file
68
docker/compose/docker-compose.traefik.yml
Normal file
@@ -0,0 +1,68 @@
|
||||
# Docker Compose configuration for BtToxin Pipeline with Traefik
|
||||
# This configuration removes the internal Nginx and lets Traefik handle routing
|
||||
# The container exposes port 8000 where FastAPI serves both API and frontend
|
||||
|
||||
services:
|
||||
bttoxin:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: docker/dockerfiles/Dockerfile.traefik
|
||||
container_name: bttoxin-pipeline
|
||||
# No ports section - Traefik will handle routing via the container network
|
||||
volumes:
|
||||
- ../../jobs:/app/jobs
|
||||
environment:
|
||||
- JOBS_DIR=/app/jobs
|
||||
# No need for ROOT_PATH since Traefik handles the routing
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- traefik-network
|
||||
labels:
|
||||
# Enable Traefik for this container
|
||||
- "traefik.enable=true"
|
||||
|
||||
# HTTP Router (redirect to HTTPS)
|
||||
- "traefik.http.routers.bttoxin.rule=Host(`bttiaw.hzau.edu.cn`)"
|
||||
- "traefik.http.routers.bttoxin.entrypoints=web"
|
||||
- "traefik.http.routers.bttoxin.middlewares=redirect-to-https"
|
||||
|
||||
# HTTPS Router
|
||||
- "traefik.http.routers.bttoxin-secure.rule=Host(`bttiaw.hzau.edu.cn`)"
|
||||
- "traefik.http.routers.bttoxin-secure.entrypoints=websecure"
|
||||
- "traefik.http.routers.bttoxin-secure.tls=true"
|
||||
|
||||
# Service configuration
|
||||
- "traefik.http.services.bttoxin.loadbalancer.server.port=8000"
|
||||
|
||||
# TLS redirect middleware
|
||||
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
|
||||
- "traefik.http.middlewares.redirect-to-https.redirectscheme.permanent=true"
|
||||
|
||||
networks:
|
||||
traefik-network:
|
||||
external: true
|
||||
# Create this network first: docker network create traefik-network
|
||||
# Or set external: false to let docker-compose create it
|
||||
|
||||
# Example Traefik configuration (traefik.yml):
|
||||
#
|
||||
# services:
|
||||
# traefik:
|
||||
# image: traefik:v2.10
|
||||
# command:
|
||||
# - "--api.insecure=true"
|
||||
# - "--providers.docker=true"
|
||||
# - "--providers.docker.exposedbydefault=false"
|
||||
# - "--entrypoints.web.address=:80"
|
||||
# - "--entrypoints.websecure.address=:443"
|
||||
# ports:
|
||||
# - "80:80"
|
||||
# - "443:443"
|
||||
# - "8080:8080" # Traefik dashboard
|
||||
# volumes:
|
||||
# - "/var/run/docker.sock:/var/run/docker.sock:ro"
|
||||
# networks:
|
||||
# - traefik-network
|
||||
#
|
||||
# networks:
|
||||
# traefik-network:
|
||||
74
docker/compose/docker-compose.yml
Normal file
74
docker/compose/docker-compose.yml
Normal file
@@ -0,0 +1,74 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# Production deployment (all-in-one container with Nginx reverse proxy)
|
||||
bttoxin:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: docker/dockerfiles/Dockerfile
|
||||
container_name: bttoxin-pipeline
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ../../jobs:/app/jobs
|
||||
- ../nginx/default.conf:/etc/nginx/sites-available/default:ro
|
||||
environment:
|
||||
- JOBS_DIR=/app/jobs
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
# Development mode (source code mounted for hot reload)
|
||||
bttoxin-dev:
|
||||
image: ghcr.io/prefix-dev/pixi:latest
|
||||
container_name: bttoxin-dev
|
||||
ports:
|
||||
- "5180:5173"
|
||||
- "8010:8000"
|
||||
volumes:
|
||||
- ../..:/app
|
||||
- ../../jobs:/app/jobs
|
||||
working_dir: /app
|
||||
environment:
|
||||
- JOBS_DIR=/app/jobs
|
||||
# Use relative path for dev (Vite proxy handles /api)
|
||||
- VITE_API_BASE_URL=
|
||||
command: >
|
||||
bash -c "
|
||||
mkdir -p /app/jobs &&
|
||||
pixi shell-hook -e webbackend > /app/activate_backend.sh &&
|
||||
echo 'exec uvicorn backend.app.main:app --reload --host 0.0.0.0 --port 8000 \"\$@\"' >> /app/activate_backend.sh &&
|
||||
bash /app/activate_backend.sh &
|
||||
sleep 5 &&
|
||||
cd /app/frontend && pnpm dev --host --port 5173 &
|
||||
wait
|
||||
"
|
||||
restart: unless-stopped
|
||||
|
||||
# Production with separate containers (if needed for scaling)
|
||||
bttoxin-frontend:
|
||||
image: nginx:alpine
|
||||
container_name: bttoxin-frontend
|
||||
ports:
|
||||
- "8080:80"
|
||||
volumes:
|
||||
- ../../dist:/usr/share/nginx/html:ro
|
||||
environment:
|
||||
- NGINX_HOST=localhost
|
||||
restart: unless-stopped
|
||||
|
||||
bttoxin-backend:
|
||||
image: ghcr.io/prefix-dev/pixi:latest
|
||||
container_name: bttoxin-backend
|
||||
ports:
|
||||
- "8000:8000"
|
||||
volumes:
|
||||
- ../../jobs:/app/jobs
|
||||
working_dir: /app
|
||||
environment:
|
||||
- JOBS_DIR=/app/jobs
|
||||
command: uvicorn web.backend.main:app --host 0.0.0.0 --port 8000
|
||||
restart: unless-stopped
|
||||
Reference in New Issue
Block a user