Docker Compose Guide

This guide demonstrates how to run the PRISM MEV Platform using Docker Compose.

NOTE: This is a generic guide. For production on Coolify, prefer the per-app compose files under deploy/coolify/ (e.g., prism-api.compose.yml, coroot.compose.yml). The OTLP example below previously referenced coroot:8080/v1/traces which is not an OTLP collector. Use an actual OTLP collector (e.g., Jaeger all-in-one at http://jaeger:4318) or your OTel Collector endpoint.

Overview

  • Build an image for the service.
  • Configure environment variables.
  • Start services with Compose.

Production-focused configuration at a glance

  • Ports: API on 8080, Metrics/Health on 9090 (default metrics_port).
  • Health endpoints (from src/metrics/metrics_server.rs):
    • GET /health on metrics port (9090)
    • GET /api/v1/providers/health on metrics port (9090)
    • GET /metrics Prometheus text exposition on 9090
  • Key env vars (from real config):
    • MEV_MONITORING_METRICS_PORT=9090 (default)
    • MEV_OBSERVABILITY_PERCENTILES_ENABLED=true
    • OTEL_EXPORTER_OTLP_ENDPOINT=http://jaeger:4318 (or your OTLP collector)
    • RUST_LOG=info or MEV_MONITORING_LOG_LEVEL=info, MEV_MONITORING_LOG_FORMAT=json
  • Security: run as non-root, read-only FS, drop capabilities; keep secrets out of env when possible.
  • Prometheus: scrape http://<host>:9090/metrics.

Example docker-compose.yml

version: "3.9"
services:
  prism:
    image: prism-mev:local
    build:
      context: .
      dockerfile: Dockerfile
    user: "10001:10001"           # run as non-root
    read_only: true                # read-only root filesystem
    cap_drop: ["ALL"]            # drop Linux capabilities
    environment:
      # Logging & monitoring
      RUST_LOG: info
      MEV_MONITORING_LOG_LEVEL: info
      MEV_MONITORING_LOG_FORMAT: "json"
      MEV_MONITORING_METRICS_PORT: 9090
      MEV_OBSERVABILITY_PERCENTILES_ENABLED: "true"
      # Tracing (OTLP/OTEL export)
      OTEL_EXPORTER_OTLP_ENDPOINT: "http://jaeger:4318"
      # Application config (examples — prefer docker secrets or files for sensitive values)
      # MEV_RPC_PRIMARY_URL: "https://api.mainnet-beta.solana.com"
      # MEV_PROVIDERS_JUPITER_BASE_URL: "https://quote-api.jup.ag"
      # MEV_WALLET_PUBKEY: "<your-wallet-pubkey>"
    volumes:
      - type: bind
        source: ./secrets
        target: /run/secrets
        read_only: true
    ports:
      - "8080:8080"   # API
      - "9090:9090"   # Metrics/Health
    healthcheck:
      test: ["CMD-SHELL", "curl -fsS http://localhost:9090/health || exit 1"]
      interval: 15s
      timeout: 5s
      retries: 5
    restart: unless-stopped
    deploy:
      resources:
        limits:
          cpus: "2.0"
          memory: 2g
        reservations:
          cpus: "1.0"
          memory: 1g
networks:
  default:
    driver: bridge

Steps

  1. Build image: docker compose build
  2. Start: docker compose up -d
  3. Check logs: docker compose logs -f prism
  4. Verify health: curl -f http://localhost:9090/health
  5. Verify providers health: curl -f http://localhost:9090/api/v1/providers/health
  6. Verify Prometheus metrics: curl -f http://localhost:9090/metrics | head

Notes

  • Adjust exposed port and env vars as needed.
  • For production, add proper volumes, secrets, and healthchecks.