Files
meijiaka-zy/python-api/docker-compose.test.yml
T
小鱼开发 e58159fc42 refactor: 第三方平台架构改造(Adapter Protocol + Gateway)
Phase 1: 异常体系统一
- 新增 PlatformError / PlatformErrorType 标准定义
- 改造所有 Provider 异常抛出为 PlatformError
- 注册全局 PlatformError exception handler

Phase 2: Adapter Protocol
- 新增 app/ai/adapters/base.py(PlatformAdapter + SyncCapable + TaskCapable + CallbackCapable)
- 新增 app/ai/adapters/constants.py(Method 常量)
- 新增 PlatformConfigLoader(config/platform-config.yaml)

Phase 3: HTTP Client 统一
- ViduProvider 从 aiohttp 迁移到 httpx(注入方式)
- VolcengineCaptionService 改为注入 http_client
- lifespan 统一管理所有 Client 创建和关闭

Phase 4: Gateway 骨架 + Adapter 实现
- 新增 ViduAdapter / VolcengineArkAdapter / VolcengineCaptionAdapter
- 新增 PlatformGateway(call_sync / submit_task / query_task / handle_webhook)
- 新增 LLMGateway(带 Fallback 降级链)
- lifespan 注册所有 Adapter 和 Gateway

Phase 6: 清理与验证
- 从 Settings 移除 VIDU_BASE_URL / VOLCENGINE_BASE_URL
- Provider 改为从 PlatformConfigLoader 读取 base_url
- 清理 volcengine_caption_service 全局单例
- config_loader 默认路径改为 platform-config.yaml
- Scheduler 注入共享 HTTP client
- vidu.py 回调路由使用 Adapter 验签和解析
- ruff 全量通过,应用启动测试通过
2026-05-04 16:07:16 +08:00

102 lines
2.4 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=staging
- 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}
- VIDU_API_KEY=${VIDU_API_KEY}
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=staging
- 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}
- 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