8046e408d6
按审查后的方案拆分为 8 个文件,单文件最大行数从 1385 降至 483: utils/(纯函数,无 React 依赖) - videoTimeline.ts: computeAssignedIntervals(57 行) - videoValidation.ts: validateLocalVideo(85 行) hooks/(独立领域逻辑) - useEmptyShotMaterials.ts: 空镜素材匹配/切换/上传(210 行) - useVideoGeneration.ts: 视频生成 4-Step 核心流程(425 行) _components/(展示组件,接收 props) - AvatarMaterialSelector.tsx: 人物素材卡片(99 行) - ShotTimeline.tsx: 分镜列表 + 素材操作(182 行) - GenerationControls.tsx: 底部控制栏(112 行) index.tsx: 容器组件,组合子组件 + 管理人物素材/预览/activeScene(483 行) 目录采用 _components/ 下划线前缀(页面私有组件惯例)。 TypeScript 编译和 Vite 生产构建均通过。 Refs: P1-6
100 lines
2.5 KiB
YAML
100 lines
2.5 KiB
YAML
# 美家卡智影 - 测试服部署配置
|
|
# ==============================
|
|
# 用法:
|
|
# docker-compose -f docker-compose.test.yml up -d --build
|
|
#
|
|
# 包含: PostgreSQL + Redis + API + Scheduler
|
|
# 独立运行,不依赖外部网络或服务
|
|
|
|
services:
|
|
db:
|
|
image: postgres:15-alpine
|
|
container_name: meijiaka-zy-db
|
|
environment:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: meijiaka_zy
|
|
volumes:
|
|
- /opt/meijiaka-zy/data/postgres:/var/lib/postgresql/data
|
|
ports:
|
|
- "127.0.0.1:5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- meijiaka-zy
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: meijiaka-zy-redis
|
|
volumes:
|
|
- /opt/meijiaka-zy/data/redis:/data
|
|
ports:
|
|
- "127.0.0.1:6379:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- meijiaka-zy
|
|
|
|
api:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: meijiaka-zy-api
|
|
env_file: .env
|
|
environment:
|
|
TZ: Asia/Shanghai
|
|
LOG_LEVEL: INFO
|
|
ports:
|
|
- "8081:8000"
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
command: >
|
|
sh -c "alembic upgrade head && uvicorn app.main:app --host 0.0.0.0 --port 8000"
|
|
networks:
|
|
- meijiaka-zy
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://localhost:8000/health')\""]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
scheduler:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: meijiaka-zy-scheduler
|
|
env_file: .env
|
|
environment:
|
|
TZ: Asia/Shanghai
|
|
LOG_LEVEL: INFO
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
command: python -m app.scheduler.main
|
|
networks:
|
|
- meijiaka-zy
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "python -c \"import asyncio, time; from app.core.redis_client import get_redis_client; r=get_redis_client(); t=asyncio.run(r.get('scheduler:heartbeat')); t=float(t) if t else 0; assert t>0 and time.time()-t<30, 'scheduler heartbeat stale'\""]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 30s
|
|
|
|
networks:
|
|
meijiaka-zy:
|
|
driver: bridge
|