docker-compose.yml•4.29 kB
# Observe Community MCP - Docker Compose Configuration
# 
# Simple unified configuration for development and production use.
# Environment variables control behavior without needing multiple files.
services:
  observe-mcp:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: observe-mcp-server
    ports:
      - "8000:8000"
      - "5678:5678"  # Debug port for development
    depends_on:
      - postgres
      - otel-collector
    environment:
      # === Core Configuration ===
      - OBSERVE_CUSTOMER_ID=${OBSERVE_CUSTOMER_ID}
      - OBSERVE_TOKEN=${OBSERVE_TOKEN}
      - OBSERVE_DOMAIN=${OBSERVE_DOMAIN:-observeinc.com}
      
      # === MCP Authentication ===
      - PUBLIC_KEY_PEM=${PUBLIC_KEY_PEM}
      
      # === Document Search (BM25) ===
      # Now using PostgreSQL BM25 search - no external dependencies needed
      
      # === Database (Semantic Graph) ===
      - POSTGRES_HOST=postgres
      - POSTGRES_PORT=5432
      - POSTGRES_DB=semantic_graph
      - POSTGRES_USER=semantic_graph
      - POSTGRES_PASSWORD=${SEMANTIC_GRAPH_PASSWORD}
      - SEMANTIC_GRAPH_PASSWORD=${SEMANTIC_GRAPH_PASSWORD}
      
      
      # === Content Directories ===
      - OBSERVE_DOCS_DIR=/app/observe-docs
      
      # === Runtime ===
      - PYTHONUNBUFFERED=1
      - LOG_LEVEL=${LOG_LEVEL:-INFO}
      - LOG_COLORS=${LOG_COLORS:-true}
      # === OpenTelemetry Configuration ===
      - OTEL_TELEMETRY_ENABLED=${OTEL_TELEMETRY_ENABLED:-true}
      - OTEL_SERVICE_NAME=${OTEL_SERVICE_NAME:-observe-community-mcp}
      - OTEL_EXPORTER_OTLP_ENDPOINT=${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-collector:4317}
      - DEPLOYMENT_ENVIRONMENT=${DEPLOYMENT_ENVIRONMENT:-development}
    volumes:
      # Documentation (always read-only)
      - ./observe-docs:/app/observe-docs:ro
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "python", "-c", "import socket; sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM); sock.settimeout(5); result = sock.connect_ex(('localhost', 8000)); sock.close(); exit(0 if result == 0 else 1)"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
  # OpenTelemetry Collector for OTEL collection
  # Receives telemetry data from instrumented applications and forwards to Observe
  otel-collector:
    image: otel/opentelemetry-collector-contrib:latest
    container_name: otel-collector
    ports:
      - "4317:4317"  # OTLP gRPC
      - "4318:4318"  # OTLP HTTP
      - "13133:13133"  # Health check
    environment:
      # Use environment variables from .env for authentication
      - OBSERVE_OTEL_TOKEN=${OBSERVE_OTEL_TOKEN}
      - OBSERVE_OTEL_CUSTOMER_ID=${OBSERVE_OTEL_CUSTOMER_ID}
      - OBSERVE_OTEL_DOMAIN=${OBSERVE_OTEL_DOMAIN}
    volumes:
      # Mount the collector configuration file
      - ./otel-collector-config.yaml:/etc/otelcol-contrib/otel-collector-config.yaml:ro
    command: ["--config=/etc/otelcol-contrib/otel-collector-config.yaml"]
    restart: unless-stopped
    healthcheck:
      test: ["CMD-SHELL", "/bin/echo > /dev/tcp/localhost/13133 2>/dev/null || exit 1"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 10s
  # PostgreSQL with pgvector + BM25 extensions
  # Required for semantic graph intelligence (query_semantic_graph) + BM25 docs search
  postgres:
    image: paradedb/paradedb:latest
    container_name: observe-semantic-graph
    environment:
      POSTGRES_DB: semantic_graph
      POSTGRES_USER: semantic_graph
      POSTGRES_PASSWORD: ${SEMANTIC_GRAPH_PASSWORD}
      POSTGRES_INITDB_ARGS: "--auth-host=scram-sha-256"
    command: >
      postgres
      -c log_statement=none
      -c log_duration=off
      -c log_line_prefix='%t [%p]: '
      -c log_min_duration_statement=100
      -c log_connections=on
      -c log_disconnections=on
      -c logging_collector=off
    volumes:
      - semantic_graph_data:/var/lib/postgresql/data
      - ./sql:/docker-entrypoint-initdb.d/
    ports:
      - "5432:5432"
    restart: unless-stopped
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U semantic_graph -d semantic_graph"]
      interval: 10s
      timeout: 5s
      retries: 5
volumes:
  semantic_graph_data:
    driver: local
networks:
  default:
    name: observe-mcp-network