docker-compose brings up PostgreSQL 16 with pgvector and Redis 7 on non-standard host ports so it never collides with an existing local database. scripts/smoke.sh is the proof: compose, migrate, boot the API, issue a token, call the real DeepSeek API and print the resulting ob_ai_call and bl_ledger rows. services/vision and services/matting are placeholders noting that the local RTX 5090 makes BiRefNet and RTMPose developable without cloud GPU.
90 lines
2.4 KiB
YAML
Executable File
90 lines
2.4 KiB
YAML
Executable File
# Local development stack (T-P1-03: 新成员一条命令起环境).
|
|
# Host ports are deliberately non-standard so this never collides with a
|
|
# PostgreSQL/Redis already running on the developer's machine.
|
|
name: meida-dev
|
|
|
|
services:
|
|
postgres:
|
|
# pgvector is required from day one (架构文档 §5, TD-08) — proving the
|
|
# extension exists here is what stops "works on my laptop" later.
|
|
image: pgvector/pgvector:pg16
|
|
container_name: meida-postgres
|
|
environment:
|
|
POSTGRES_USER: meida
|
|
POSTGRES_PASSWORD: meida
|
|
POSTGRES_DB: meida
|
|
TZ: Asia/Shanghai
|
|
ports:
|
|
- "55432:5432"
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U meida -d meida"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 20
|
|
start_period: 10s
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: meida-redis
|
|
command: ["redis-server", "--appendonly", "yes"]
|
|
ports:
|
|
- "56379:6379"
|
|
volumes:
|
|
- redisdata:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 20
|
|
|
|
# --- optional: run the app itself in containers (`--profile app`) ---------
|
|
api:
|
|
profiles: ["app"]
|
|
build:
|
|
context: ..
|
|
dockerfile: deploy/Dockerfile.api
|
|
container_name: meida-api
|
|
env_file: ../.env
|
|
environment:
|
|
DATABASE_URL: postgresql+asyncpg://meida:meida@postgres:5432/meida
|
|
REDIS_URL: redis://redis:6379/0
|
|
CELERY_BROKER_URL: redis://redis:6379/1
|
|
CELERY_RESULT_BACKEND: redis://redis:6379/2
|
|
ports:
|
|
- "8000:8000"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request;urllib.request.urlopen('http://localhost:8000/healthz')"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
worker-cpu:
|
|
profiles: ["app"]
|
|
build:
|
|
context: ..
|
|
dockerfile: deploy/Dockerfile.worker
|
|
container_name: meida-worker-cpu
|
|
env_file: ../.env
|
|
environment:
|
|
DATABASE_URL: postgresql+asyncpg://meida:meida@postgres:5432/meida
|
|
REDIS_URL: redis://redis:6379/0
|
|
CELERY_BROKER_URL: redis://redis:6379/1
|
|
CELERY_RESULT_BACKEND: redis://redis:6379/2
|
|
CELERY_QUEUES: cpu,io
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
volumes:
|
|
pgdata:
|
|
redisdata:
|