dotb_ai-platform/compose.yaml
hungtran24 6577bb74be refactor: simplify scoring service, AI profile revisions and test suite
Phase 2 and 3 of the platform rework.

- Neutral request/response contract: external_id, metadata, X-AI-Key,
  run_id in the response; client-specific fields removed.
- AI profile is a revision table: saving creates an inactive revision,
  activation is separate, try-run does not store a run. One
  chat-completions gateway serves AIHub and OpenAI-compatible profiles.
- Add between and in rule operators.
- Contracts moved to contracts/lead-scoring/ with a score-response fixture.
- Admin Web updated for revisions, runs and the neutral fixture.
- Consolidate tests; remove rewrite_architect.md and the stale handoff doc;
  rewrite spec, CONTEXT and ARCHITECTURE for the current design.

Not verified: live AIHub/OpenAI behavior, Omni/EMS integration.
2026-10-09 08:23:21 +07:00

77 lines
2.4 KiB
YAML

name: ai-platform-local
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER:-ai_platform}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-local-change-this-password}
POSTGRES_DB: ${POSTGRES_DB:-ai_platform}
ports:
- "127.0.0.1:${POSTGRES_PORT:-55432}:5432"
volumes:
- ai_platform_pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 12
migrate:
build:
context: .
dockerfile: Dockerfile.backend
command: ["uv", "run", "--no-sync", "alembic", "upgrade", "head"]
environment:
AI_PLATFORM_DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-ai_platform}:${POSTGRES_PASSWORD:-local-change-this-password}@postgres:5432/${POSTGRES_DB:-ai_platform}
AI_PLATFORM_ENVIRONMENT: ${AI_PLATFORM_ENVIRONMENT:-development}
depends_on:
postgres:
condition: service_healthy
restart: "no"
backend:
build:
context: .
dockerfile: Dockerfile.backend
environment:
AI_PLATFORM_DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-ai_platform}:${POSTGRES_PASSWORD:-local-change-this-password}@postgres:5432/${POSTGRES_DB:-ai_platform}
AI_PLATFORM_ENVIRONMENT: ${AI_PLATFORM_ENVIRONMENT:-development}
AI_PLATFORM_OPENAI_BASE_URL: ${AI_PLATFORM_OPENAI_BASE_URL:-}
AI_PLATFORM_OPENAI_API_KEY: ${AI_PLATFORM_OPENAI_API_KEY:-}
ports:
- "127.0.0.1:${BACKEND_PORT:-8000}:8000"
depends_on:
postgres:
condition: service_healthy
migrate:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health/ready', timeout=2)"]
interval: 10s
timeout: 3s
retries: 6
start_period: 10s
web:
build:
context: .
dockerfile: apps/web/Dockerfile
environment:
NODE_ENV: production
HOST: 0.0.0.0
PORT: 3000
ORIGIN: ${WEB_ORIGIN:-http://localhost:3000}
BACKEND_INTERNAL_URL: http://backend:8000
WEB_ENVIRONMENT: ${WEB_ENVIRONMENT:-development}
LEAD_SCORING_FIXTURE_APP_API_KEY: ${LEAD_SCORING_FIXTURE_APP_API_KEY:-}
ports:
- "127.0.0.1:${WEB_PORT:-3000}:3000"
depends_on:
backend:
condition: service_healthy
volumes:
ai_platform_pgdata:
name: ai_platform_pgdata