feat(service): add FastAPI agent service with 5 routers and Docker setup
- config.py: pydantic-settings with all env vars, privacy mode, per-agent overrides - app_state.py: global singletons (pool, master agent, registry, llm_router, sweep) - main.py: FastAPI lifespan startup — DB pool, LLM router, Odoo client, agents, master - routers/dispatch.py: POST /dispatch with rate limiting and webhook secret auth - routers/approval.py: GET /approval/pending, POST /approval/respond - routers/registry.py: GET/POST /registry/agents, POST /registry/backend overrides - routers/sweep.py: POST /sweep trigger, GET /sweep/status - routers/health.py: GET /health, GET /health/detailed (DB/Odoo/Ollama checks) - requirements.txt: pinned deps (fastapi, uvicorn, asyncpg, anthropic, alembic) - Dockerfile: python:3.11-slim, single uvicorn worker - docker-compose.yml: agent-service + postgres:15, bound to 192.168.2.47:8001 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
59
docker-compose.yml
Normal file
59
docker-compose.yml
Normal file
@@ -0,0 +1,59 @@
|
||||
version: '3.9'
|
||||
|
||||
services:
|
||||
agent-service:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: activeblue-agent
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
ports:
|
||||
- '192.168.2.47:8001:8001'
|
||||
depends_on:
|
||||
agent-db:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- activeblue-net
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:8001/health']
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 20s
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: '50m'
|
||||
max-file: '5'
|
||||
|
||||
agent-db:
|
||||
image: postgres:15-alpine
|
||||
container_name: activeblue-agent-db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB:-activeblue_ai}
|
||||
POSTGRES_USER: ${POSTGRES_USER:-activeblue}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
volumes:
|
||||
- agent-db-data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- activeblue-net
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'pg_isready -U ${POSTGRES_USER:-activeblue} -d ${POSTGRES_DB:-activeblue_ai}']
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: '20m'
|
||||
max-file: '3'
|
||||
|
||||
volumes:
|
||||
agent-db-data:
|
||||
|
||||
networks:
|
||||
activeblue-net:
|
||||
name: activeblue-net
|
||||
external: false
|
||||
Reference in New Issue
Block a user