version: "3.9" # ─── MCP Hub — Docker Compose ───────────────────────────────────────────────── # Profiles: # default → SQLite dev mode (no external DB needed) # postgres → PostgreSQL production mode services: # ── MCP Hub Application ──────────────────────────────────────────────────── mcp-hub: build: context: . dockerfile: Dockerfile target: runtime image: mcp-hub:latest container_name: mcp-hub restart: unless-stopped ports: - "8000:8000" environment: # Override any defaults via .env or environment - APP_NAME=MCP Hub - DEBUG=false - SECRET_KEY=${SECRET_KEY:-change-me-in-production} - JWT_SECRET_KEY=${JWT_SECRET_KEY:-change-me-jwt-secret} - BOOTSTRAP_ADMIN_EMAIL=${BOOTSTRAP_ADMIN_EMAIL:-admin@localhost} - BOOTSTRAP_ADMIN_PASSWORD=${BOOTSTRAP_ADMIN_PASSWORD:-changeme} - RATE_LIMIT_RPM=${RATE_LIMIT_RPM:-60} - HEALTH_CHECK_INTERVAL=${HEALTH_CHECK_INTERVAL:-60} - AI_BACKEND=${AI_BACKEND:-mock} # SQLite (default) — mounts volume for persistence - DATABASE_URL=sqlite+aiosqlite:////app/data/mcp_hub.db volumes: - mcp-hub-data:/app/data healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/health"] interval: 30s timeout: 10s retries: 3 start_period: 20s # ── PostgreSQL (optional — use with --profile postgres) ──────────────────── postgres: image: postgres:16-alpine container_name: mcp-hub-postgres restart: unless-stopped profiles: ["postgres"] environment: POSTGRES_DB: mcp_hub POSTGRES_USER: ${POSTGRES_USER:-mcphub} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-mcphubpass} volumes: - postgres-data:/var/lib/postgresql/data ports: - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER:-mcphub}"] interval: 10s timeout: 5s retries: 5 # ── MCP Hub with PostgreSQL backend ──────────────────────────────────────── mcp-hub-pg: build: context: . dockerfile: Dockerfile target: runtime image: mcp-hub:latest container_name: mcp-hub-pg restart: unless-stopped profiles: ["postgres"] ports: - "8000:8000" depends_on: postgres: condition: service_healthy environment: - SECRET_KEY=${SECRET_KEY:-change-me-in-production} - JWT_SECRET_KEY=${JWT_SECRET_KEY:-change-me-jwt-secret} - DATABASE_URL=postgresql+asyncpg://${POSTGRES_USER:-mcphub}:${POSTGRES_PASSWORD:-mcphubpass}@postgres:5432/mcp_hub - BOOTSTRAP_ADMIN_EMAIL=${BOOTSTRAP_ADMIN_EMAIL:-admin@localhost} - BOOTSTRAP_ADMIN_PASSWORD=${BOOTSTRAP_ADMIN_PASSWORD:-changeme} healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/health"] interval: 30s timeout: 10s retries: 3 start_period: 30s volumes: mcp-hub-data: postgres-data: