Skip to content

Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.

4.5 KB
Raw Blame
services:
  clickhouse:
    image: clickhouse/clickhouse-server:24.4.1
    container_name: clickhouse
    environment:
      CLICKHOUSE_PASSWORD: ${OPENLIT_DB_PASSWORD:-OPENLIT}
      CLICKHOUSE_USER: ${OPENLIT_DB_USER:-default}
      CLICKHOUSE_DATABASE: ${OPENLIT_DB_NAME:-openlit}
      CLICKHOUSE_ALWAYS_RUN_INITDB_SCRIPTS: true
    volumes:
      - clickhouse-data:/var/lib/clickhouse
      - ./assets/clickhouse-config.xml:/etc/clickhouse-server/config.d/custom-config.xml:ro
      - ./assets/clickhouse-init.sh:/docker-entrypoint-initdb.d/init.sh:ro
    ports:
      - "9000:9000"
      - "8123:8123"
    healthcheck:
      test: ["CMD-SHELL", "clickhouse-client --user=$${CLICKHOUSE_USER} --password=$${CLICKHOUSE_PASSWORD} --query='SELECT 1' || exit 1"]
      interval: 5s
      timeout: 3s
      retries: 10
      start_period: 100s
    restart: always

  nats:
    image: nats:2.10-alpine
    container_name: nats
    # Auth, per-user permissions, and JetStream limits live in nats.conf.
    # No ports are published: only containers on this network reach NATS,
    # and the monitoring endpoint listens on loopback inside the container.
    command: ["-c", "/etc/nats/nats.conf"]
    environment:
      # Change both passwords for any deployment reachable by others.
      NATS_RECEIVER_PASSWORD: ${NATS_RECEIVER_PASSWORD:-openlit-receiver-change-me}
      NATS_ENGINE_PASSWORD: ${NATS_ENGINE_PASSWORD:-openlit-engine-change-me}
    volumes:
      - nats-data:/data
      - ./assets/nats.conf:/etc/nats/nats.conf:ro
    healthcheck:
      test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8222/healthz?js-enabled-only=true || exit 1"]
      interval: 5s
      timeout: 3s
      retries: 10
      start_period: 10s
    restart: always

  openlit:
    image: ghcr.io/openlit/openlit:latest
    container_name: openlit
    environment:
      TELEMETRY_ENABLED: "true"
      INIT_DB_HOST: clickhouse
      INIT_DB_PORT: 8123
      INIT_DB_DATABASE: ${OPENLIT_DB_NAME:-openlit}
      INIT_DB_USERNAME: ${OPENLIT_DB_USER:-default}
      INIT_DB_PASSWORD: ${OPENLIT_DB_PASSWORD:-OPENLIT}
      SQLITE_DATABASE_URL: file:/app/client/data/data.db
      # Realtime signal fan-out (receiver publishes, engine consumes).
      # Set NATS_URL to an empty string to disable realtime findings.
      NATS_URL: ${NATS_URL-nats://nats:4222}
      NATS_RECEIVER_USER: ${NATS_RECEIVER_USER:-openlit-receiver}
      NATS_RECEIVER_PASSWORD: ${NATS_RECEIVER_PASSWORD:-openlit-receiver-change-me}
      NATS_ENGINE_USER: ${NATS_ENGINE_USER:-openlit-engine}
      NATS_ENGINE_PASSWORD: ${NATS_ENGINE_PASSWORD:-openlit-engine-change-me}
      # Rules can use any span attribute except personal ones (user, session,
      # conversation, email, phone, ip, address, path keys); list those here,
      # comma-separated, to allow them.
      OPENLIT_SIGNAL_ATTRIBUTES: ${OPENLIT_SIGNAL_ATTRIBUTES:-}
      PORT: ${PORT:-3000}
      DOCKER_PORT: ${PORT:-3000}
      
      # OAuth Environment Variables
      GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID:-}
      GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET:-}
      GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID:-}
      GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET:-}
      AZURE_AD_CLIENT_ID: ${AZURE_AD_CLIENT_ID:-}
      AZURE_AD_CLIENT_SECRET: ${AZURE_AD_CLIENT_SECRET:-}
      AZURE_AD_TENANT_ID: ${AZURE_AD_TENANT_ID:-}
      OKTA_CLIENT_ID: ${OKTA_CLIENT_ID:-}
      OKTA_CLIENT_SECRET: ${OKTA_CLIENT_SECRET:-}
      OKTA_ISSUER: ${OKTA_ISSUER:-}

    env_file:
      - path: .env
        required: false
    ports:
      - "${PORT:-3000}:${DOCKER_PORT:-3000}"
      - "4317:4317"  # OTLP gRPC receiver
      - "4318:4318"  # OTLP HTTP receiver
    depends_on:
      clickhouse:
        condition: service_healthy
      nats:
        condition: service_healthy
    volumes:
      - openlit-data:/app/client/data
    healthcheck:
      test: ["CMD", "node", "-e", "const ui=process.env.DOCKER_PORT||process.env.PORT||3000;let raw=process.env.OTLP_HTTP_ADDR||'0.0.0.0:4318',host='127.0.0.1',port='4318';if(raw.startsWith('[')){const end=raw.indexOf(']');if(end>1&&raw[end+1]===':'){host=raw.slice(1,end);port=raw.slice(end+2)}}else{const i=raw.lastIndexOf(':');if(i>=0){host=raw.slice(0,i);port=raw.slice(i+1)}}if(host===''||host==='0.0.0.0'||host==='::')host='127.0.0.1';const h=host.includes(':')?'['+host+']':host;Promise.all([fetch('http://127.0.0.1:'+ui),fetch('http://'+h+':'+port+'/health')]).then(rs=>process.exit(rs.every(r=>r.ok)?0:1)).catch(()=>process.exit(1))"]
      interval: 5s
      timeout: 3s
      retries: 10
      start_period: 30s
    restart: always

volumes:
  clickhouse-data:
  openlit-data:
  nats-data: