forked from cleveragents/cleveragents-core
e13308b322
Implement the server application module (ADR-048) with: - FastAPI application factory (app.py) exposing the A2A JSON-RPC 2.0 endpoint as the sole client-facing interface. Routes: POST /a2a (JSON-RPC dispatch), GET /.well-known/agent.json (Agent Card), and GET /health (container orchestration). - RemoteGraph adapter (remote_graph.py) for invoking actor graphs via LangGraph Platform. Each actor graph deploys as a separate RemoteGraph enabling independent scaling. Includes health tracking, invocation counting, and a RemoteGraphRegistry for managing multiple graph deployments. - Database configuration (database.py) supporting PostgreSQL for production and SQLite for development. Config-driven via CLEVERAGENTS_DATABASE_URL and CLEVERAGENTS_SERVER_ENV environment variables with validated Pydantic settings model. - Docker deployment (docker/Dockerfile + docker-compose.yml) with multi-stage build, non-root user, health checks, and PostgreSQL service. - FastAPI dependency added to pyproject.toml. - 26 Behave BDD scenarios covering app factory, A2A dispatch, Agent Card, health endpoint, RemoteGraph config/adapter/registry, and database configuration. - 10 Robot Framework integration tests with helper script verifying end-to-end server functionality. ISSUES CLOSED: #693
58 lines
1.6 KiB
YAML
58 lines
1.6 KiB
YAML
# CleverAgents Server — Docker Compose deployment (ADR-048)
|
|
#
|
|
# Services:
|
|
# server — CleverAgents A2A JSON-RPC 2.0 server
|
|
# postgres — PostgreSQL database for multi-user persistence
|
|
#
|
|
# Usage:
|
|
# docker compose -f docker/docker-compose.yml up -d
|
|
#
|
|
# Environment variables:
|
|
# CLEVERAGENTS_DATABASE_URL — override database connection string
|
|
# CLEVERAGENTS_SERVER_ENV — "production" or "development"
|
|
# LANGGRAPH_PLATFORM_URL — LangGraph Platform URL
|
|
|
|
services:
|
|
server:
|
|
build:
|
|
context: ..
|
|
dockerfile: docker/Dockerfile
|
|
ports:
|
|
- "8000:8000"
|
|
environment:
|
|
CLEVERAGENTS_SERVER_ENV: "${CLEVERAGENTS_SERVER_ENV:-production}"
|
|
CLEVERAGENTS_DATABASE_URL: "postgresql://cleveragents:cleveragents@postgres:5432/cleveragents"
|
|
LANGGRAPH_PLATFORM_URL: "${LANGGRAPH_PLATFORM_URL:-http://localhost:8123}"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
start_period: 10s
|
|
retries: 3
|
|
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
environment:
|
|
POSTGRES_DB: cleveragents
|
|
POSTGRES_USER: cleveragents
|
|
POSTGRES_PASSWORD: cleveragents
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U cleveragents -d cleveragents"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
start_period: 5s
|
|
retries: 5
|
|
|
|
volumes:
|
|
pgdata:
|
|
driver: local
|