d419d6732e
后端:
- config.py: 新增 APP_BASE_URL 配置,支持 ENV 自动推断公网地址
- vidu.py: POST /lip-sync 自动拼接 callback_url 提交给 Vidu
- vidu.py: 新增 POST /callback 接收 Vidu 异步回调,写入 Redis
- vidu.py: GET /tasks/{id}/status 优先查 Redis,fallback 到 Vidu API
前端:
- types.ts / localStorage.ts: ScriptShot/ProjectSegment 新增 lipSyncVideoPath/VideoUrl/StartTime
- VideoGeneration.tsx: Step 1 提交对口型时保存 lipSyncStartTime(只算一次)
- VideoGeneration.tsx: 新增 Step 2 轮询后端状态(5s×120次),下载对口型视频
- VideoGeneration.tsx: Step 3 拼接时 segment 优先使用对口型视频,startTime=0
部署:
- docker-compose.test.yml / prod.yml: 添加 APP_BASE_URL 环境变量
- .env.example: 添加 APP_BASE_URL 说明
修复:
- 修复 React 闭包陷阱(updateSegment 后 shots 未同步)
- 修复 startTime 不一致(Step1/Step2 各自 random)
117 lines
3.2 KiB
YAML
117 lines
3.2 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:
|
|
- "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:
|
|
- "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:
|
|
- ENV=production
|
|
- DEBUG=false
|
|
- APP_BASE_URL=https://dev.tapi.meijiaka.cn
|
|
- CORS_ORIGINS=https://dev.tapi.meijiaka.cn,http://localhost:1420,http://127.0.0.1:1420
|
|
- DATABASE_URL=postgresql+asyncpg://postgres:postgres@db:5432/meijiaka_zy
|
|
- REDIS_HOST=redis
|
|
- REDIS_PORT=6379
|
|
- REDIS_DB=0
|
|
- SECRET_KEY=${SECRET_KEY}
|
|
- VOLCENGINE_API_KEY=${VOLCENGINE_API_KEY}
|
|
- VOLCENGINE_BASE_URL=${VOLCENGINE_BASE_URL:-https://ark.cn-beijing.volces.com/api/v3}
|
|
- KLINGAI_ACCESS_KEY=${KLINGAI_ACCESS_KEY}
|
|
- KLINGAI_SECRET_KEY=${KLINGAI_SECRET_KEY}
|
|
- MINIMAX_API_KEY=${MINIMAX_API_KEY}
|
|
- MINIMAX_BASE_URL=${MINIMAX_BASE_URL:-https://api.minimaxi.com}
|
|
- VIDU_API_KEY=${VIDU_API_KEY}
|
|
- VIDU_BASE_URL=${VIDU_BASE_URL:-https://api.vidu.cn}
|
|
- ANYTOCOPY_API_KEY=${ANYTOCOPY_API_KEY}
|
|
- ANYTOCOPY_API_SECRET=${ANYTOCOPY_API_SECRET}
|
|
volumes:
|
|
- /opt/meijiaka-zy/data/logs:/root/Documents/Meijiaka-zy/logs
|
|
ports:
|
|
- "8081:8000"
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- meijiaka-zy
|
|
restart: unless-stopped
|
|
|
|
scheduler:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: meijiaka-zy-scheduler
|
|
env_file: .env
|
|
environment:
|
|
- ENV=production
|
|
- DEBUG=false
|
|
- DATABASE_URL=postgresql+asyncpg://postgres:postgres@db:5432/meijiaka_zy
|
|
- REDIS_HOST=redis
|
|
- REDIS_PORT=6379
|
|
- REDIS_DB=0
|
|
- SECRET_KEY=${SECRET_KEY}
|
|
- VOLCENGINE_API_KEY=${VOLCENGINE_API_KEY}
|
|
- KLINGAI_ACCESS_KEY=${KLINGAI_ACCESS_KEY}
|
|
- KLINGAI_SECRET_KEY=${KLINGAI_SECRET_KEY}
|
|
- MINIMAX_API_KEY=${MINIMAX_API_KEY}
|
|
- VIDU_API_KEY=${VIDU_API_KEY}
|
|
volumes:
|
|
- /opt/meijiaka-zy/data/logs:/root/Documents/Meijiaka-zy/logs
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
command: python -m app.scheduler.main
|
|
networks:
|
|
- meijiaka-zy
|
|
restart: unless-stopped
|
|
|
|
networks:
|
|
meijiaka-zy:
|
|
driver: bridge
|