services: # ========================================== # Decision Engine Runtime (GHCR Images) # ========================================== open-router-pg-ghcr: image: ghcr.io/juspay/decision-engine/postgres:${DECISION_ENGINE_TAG:-v1.4} pull_policy: always platform: linux/amd64 profiles: - postgres-ghcr - dashboard-postgres-ghcr restart: unless-stopped ports: - "8080:8080" depends_on: postgresql: condition: service_healthy redis: condition: service_healthy db-migrator-postgres: condition: service_completed_successfully clickhouse: condition: service_healthy kafka: condition: service_healthy kafka-init: condition: service_completed_successfully mailpit: condition: service_healthy volumes: - ./config/docker-configuration.toml:/local/config/development.toml networks: open-router-network: aliases: - decision-engine-api environment: - GROOVY_RUNNER_HOST=host.docker.internal:8085 - GROOVY_RUNNER_AUTH_TOKEN=${GROOVY_RUNNER_AUTH_TOKEN:-local-groovy-runner-token} # Metrics are pushed to the otel-collector (monitoring profile); off unless asked for. - DECISION_ENGINE__LOG__TELEMETRY__METRICS_ENABLED=${DE_METRICS_ENABLED:-false} - DECISION_ENGINE__LOG__TELEMETRY__OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317 open-router-mysql-ghcr: image: ghcr.io/juspay/decision-engine:${DECISION_ENGINE_TAG:-v1.4} pull_policy: always platform: linux/amd64 profiles: - mysql-ghcr - dashboard-mysql-ghcr restart: unless-stopped ports: - "8080:8080" depends_on: mysql: condition: service_healthy redis: condition: service_healthy routing-config: condition: service_completed_successfully db-migrator: condition: service_completed_successfully clickhouse: condition: service_healthy kafka: condition: service_healthy kafka-init: condition: service_completed_successfully mailpit: condition: service_healthy volumes: - ./config/docker-configuration.toml:/local/config/development.toml networks: open-router-network: aliases: - decision-engine-api environment: - GROOVY_RUNNER_HOST=host.docker.internal:8085 - GROOVY_RUNNER_AUTH_TOKEN=${GROOVY_RUNNER_AUTH_TOKEN:-local-groovy-runner-token} # Metrics are pushed to the otel-collector (monitoring profile); off unless asked for. - DECISION_ENGINE__LOG__TELEMETRY__METRICS_ENABLED=${DE_METRICS_ENABLED:-false} - DECISION_ENGINE__LOG__TELEMETRY__OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317 # ========================================== # Decision Engine Runtime (Local Build) # ========================================== open-router-pg-local: build: context: . dockerfile: Dockerfile.postgres platforms: - linux/amd64 image: decision-engine-pg:local platform: linux/amd64 profiles: - postgres-local - dashboard-postgres-local restart: unless-stopped ports: - "8080:8080" depends_on: postgresql: condition: service_healthy redis: condition: service_healthy db-migrator-postgres: condition: service_completed_successfully clickhouse: condition: service_healthy kafka: condition: service_healthy kafka-init: condition: service_completed_successfully mailpit: condition: service_healthy volumes: - ./config/docker-configuration.toml:/local/config/development.toml networks: open-router-network: aliases: - decision-engine-api environment: - GROOVY_RUNNER_HOST=host.docker.internal:8085 - GROOVY_RUNNER_AUTH_TOKEN=${GROOVY_RUNNER_AUTH_TOKEN:-local-groovy-runner-token} # Metrics are pushed to the otel-collector (monitoring profile); off unless asked for. - DECISION_ENGINE__LOG__TELEMETRY__METRICS_ENABLED=${DE_METRICS_ENABLED:-false} - DECISION_ENGINE__LOG__TELEMETRY__OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317 open-router-mysql-local: build: context: . dockerfile: Dockerfile platforms: - linux/amd64 image: decision-engine-mysql:local platform: linux/amd64 profiles: - mysql-local - dashboard-mysql-local restart: unless-stopped ports: - "8080:8080" depends_on: mysql: condition: service_healthy redis: condition: service_healthy routing-config: condition: service_completed_successfully db-migrator: condition: service_completed_successfully clickhouse: condition: service_healthy kafka: condition: service_healthy kafka-init: condition: service_completed_successfully mailpit: condition: service_healthy volumes: - ./config/docker-configuration.toml:/local/config/development.toml networks: open-router-network: aliases: - decision-engine-api environment: - GROOVY_RUNNER_HOST=host.docker.internal:8085 - GROOVY_RUNNER_AUTH_TOKEN=${GROOVY_RUNNER_AUTH_TOKEN:-local-groovy-runner-token} # Metrics are pushed to the otel-collector (monitoring profile); off unless asked for. - DECISION_ENGINE__LOG__TELEMETRY__METRICS_ENABLED=${DE_METRICS_ENABLED:-false} - DECISION_ENGINE__LOG__TELEMETRY__OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317 # ========================================== # Dashboard and Docs # ========================================== nginx: build: context: ./website dockerfile: Dockerfile image: decision-engine-dashboard:local profiles: - dashboard-postgres-ghcr - dashboard-postgres-local - dashboard-mysql-ghcr - dashboard-mysql-local restart: unless-stopped ports: - "8081:8080" volumes: - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro depends_on: mintlify-docs: condition: service_healthy networks: - open-router-network mintlify-docs: build: context: . dockerfile: Dockerfile.docs profiles: - dashboard-postgres-ghcr - dashboard-postgres-local - dashboard-mysql-ghcr - dashboard-mysql-local restart: unless-stopped volumes: - ./docs:/docs expose: - "3000" networks: - open-router-network healthcheck: test: ["CMD-SHELL", "wget -qO- http://localhost:3000 > /dev/null 2>&1 || exit 1"] interval: 10s timeout: 10s retries: 10 start_period: 60s # ========================================== # Supporting Services # ========================================== # Receives OTLP metrics from the app and re-exposes them for Prometheus, as in the Hyperswitch clusters. otel-collector: image: otel/opentelemetry-collector-contrib:0.116.1 profiles: - monitoring networks: - open-router-network command: ["--config=/etc/otelcol/config.yaml"] volumes: - ./config/otel-collector.yaml:/etc/otelcol/config.yaml:ro ports: - "4317:4317" - "9898:9898" restart: unless-stopped prometheus: image: prom/prometheus:latest profiles: - monitoring networks: - open-router-network depends_on: - otel-collector volumes: - ./config/prometheus.yaml:/etc/prometheus/prometheus.yml ports: - "9090:9090" restart: unless-stopped grafana: image: grafana/grafana:latest profiles: - monitoring ports: - "3000:3000" networks: - open-router-network restart: unless-stopped environment: - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin - GF_AUTH_ANONYMOUS_ENABLED=true - GF_AUTH_BASIC_ENABLED=false volumes: - ./config/grafana-datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yml groovy-runner-ghcr: image: ghcr.io/juspay/decision-engine/groovy-runner:${GROOVY_RUNNER_TAG:-v1.4} pull_policy: always platform: linux/amd64 profiles: - groovy-ghcr restart: unless-stopped environment: - GROOVY_RUNNER_AUTH_TOKEN=${GROOVY_RUNNER_AUTH_TOKEN:-local-groovy-runner-token} ports: - "8085:8085" networks: - open-router-network healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8085/health"] interval: 5s timeout: 5s retries: 5 start_period: 10s groovy-runner-local: build: context: . dockerfile: groovy.Dockerfile args: - BUILDKIT_INLINE_CACHE=1 cache_from: - decision-engine-groovy-runner-local:latest labels: - "com.docker.compose.watchfile=groovy.Dockerfile" - "com.docker.compose.watchfile=src/Runner.groovy" image: decision-engine-groovy-runner:local platform: linux/amd64 profiles: - groovy-local restart: unless-stopped environment: - GROOVY_RUNNER_AUTH_TOKEN=${GROOVY_RUNNER_AUTH_TOKEN:-local-groovy-runner-token} ports: - "8085:8085" networks: - open-router-network healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8085/health"] interval: 5s timeout: 5s retries: 5 start_period: 10s kafka: image: apache/kafka:3.8.1 profiles: - postgres-ghcr - dashboard-postgres-ghcr - postgres-local - dashboard-postgres-local - mysql-ghcr - dashboard-mysql-ghcr - mysql-local - dashboard-mysql-local - analytics-clickhouse restart: unless-stopped ports: - "9092:9092" environment: KAFKA_NODE_ID: 1 KAFKA_PROCESS_ROLES: broker,controller KAFKA_LISTENERS: PLAINTEXT://:19092,EXTERNAL://:9092,CONTROLLER://:9093 KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:19092,EXTERNAL://localhost:9092 KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,EXTERNAL:PLAINTEXT KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093 KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false" networks: - open-router-network healthcheck: test: [ "CMD-SHELL", "/opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --list > /dev/null 2>&1", ] interval: 10s timeout: 10s retries: 10 start_period: 20s kafka-init: image: apache/kafka:3.8.1 profiles: - postgres-ghcr - dashboard-postgres-ghcr - postgres-local - dashboard-postgres-local - mysql-ghcr - dashboard-mysql-ghcr - mysql-local - dashboard-mysql-local - analytics-clickhouse depends_on: kafka: condition: service_healthy networks: - open-router-network entrypoint: - /bin/bash - -lc - | /opt/kafka/bin/kafka-topics.sh --bootstrap-server kafka:19092 --create --if-not-exists --topic api --partitions 4 --replication-factor 1 /opt/kafka/bin/kafka-topics.sh --bootstrap-server kafka:19092 --create --if-not-exists --topic domain --partitions 4 --replication-factor 1 clickhouse: image: clickhouse/clickhouse-server:26.1 profiles: - postgres-ghcr - dashboard-postgres-ghcr - postgres-local - dashboard-postgres-local - mysql-ghcr - dashboard-mysql-ghcr - mysql-local - dashboard-mysql-local - analytics-clickhouse restart: unless-stopped ports: - "8123:8123" - "9000:9000" environment: CLICKHOUSE_DB: default CLICKHOUSE_USER: decision_engine CLICKHOUSE_PASSWORD: decision_engine ANALYTICS_KAFKA_BROKERS: kafka:19092 ANALYTICS_KAFKA_API_TOPIC: api ANALYTICS_KAFKA_DOMAIN_TOPIC: domain depends_on: kafka-init: condition: service_completed_successfully networks: - open-router-network volumes: - clickhouse-data:/var/lib/clickhouse - ./clickhouse/scripts:/docker-entrypoint-initdb.d:ro healthcheck: test: ["CMD-SHELL", "wget -qO- http://localhost:8123/ping | grep -q Ok"] interval: 10s timeout: 5s retries: 10 start_period: 20s # ========================================== # Local Email Testing (Mailpit) # Captures all outgoing SMTP — nothing is actually delivered. # Web UI: http://localhost:8025 # SMTP: localhost:1025 (no auth) # ========================================== mailpit: # Pinned: on `latest`, an upstream release silently changes the API surface the oneclick # health probe depends on, and bring-up fails on a machine that pulled a newer image. image: axllent/mailpit:v1.30 profiles: - postgres-ghcr - dashboard-postgres-ghcr - postgres-local - dashboard-postgres-local - mysql-ghcr - dashboard-mysql-ghcr - mysql-local - dashboard-mysql-local restart: unless-stopped ports: - "1025:1025" # SMTP - "8025:8025" # Web UI environment: MP_MAX_MESSAGES: 500 MP_SMTP_AUTH_ACCEPT_ANY: "true" MP_SMTP_AUTH_ALLOW_INSECURE: "true" networks: - open-router-network healthcheck: test: ["CMD-SHELL", "wget -qO- http://localhost:8025/api/v1/info > /dev/null 2>&1"] interval: 10s timeout: 5s retries: 5 start_period: 5s # ========================================== # Core Infrastructure # ========================================== mysql: image: mysql:8.0 profiles: - mysql-ghcr - dashboard-mysql-ghcr - mysql-local - dashboard-mysql-local restart: unless-stopped environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: jdb MYSQL_USER: db_user MYSQL_PASSWORD: db_pass ports: - "3306:3306" volumes: - mysql-data:/var/lib/mysql networks: - open-router-network healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-proot"] interval: 10s timeout: 5s retries: 5 start_period: 30s postgresql: image: postgres:16 profiles: - postgres-ghcr - dashboard-postgres-ghcr - postgres-local - dashboard-postgres-local restart: unless-stopped environment: POSTGRES_USER: db_user POSTGRES_PASSWORD: db_pass POSTGRES_DB: decision_engine_db ports: - "5432:5432" volumes: - postgres-data:/var/lib/postgresql networks: - open-router-network healthcheck: test: ["CMD-SHELL", "pg_isready -U db_user -d decision_engine_db"] interval: 10s timeout: 5s retries: 5 start_period: 30s redis: image: redis:7-alpine profiles: - postgres-ghcr - dashboard-postgres-ghcr - postgres-local - dashboard-postgres-local - mysql-ghcr - dashboard-mysql-ghcr - mysql-local - dashboard-mysql-local restart: unless-stopped ports: - "6379:6379" volumes: - redis-data:/data networks: - open-router-network healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 start_period: 5s db-migrator: image: mysql:8.0 profiles: - mysql-ghcr - dashboard-mysql-ghcr - mysql-local - dashboard-mysql-local depends_on: mysql: condition: service_healthy volumes: - ./migrations:/app/migrations working_dir: /app entrypoint: ["/bin/sh", "-c", "for sql_file in $$(find /app/migrations -name 'up.sql' -type f | sort); do echo \"Running migration: $$sql_file\"; mysql -h mysql -uroot -proot jdb < \"$$sql_file\"; done"] networks: - open-router-network db-migrator-postgres: image: rust:latest profiles: - postgres-ghcr - dashboard-postgres-ghcr - postgres-local - dashboard-postgres-local depends_on: postgresql: condition: service_healthy environment: - PGPASSWORD=db_pass - DATABASE_URL=postgresql://db_user:db_pass@postgresql:5432/decision_engine_db volumes: - .:/app working_dir: /app command: "bash -c 'cargo install diesel_cli --no-default-features --features postgres && diesel migration run --database-url \"$$DATABASE_URL\" --migration-dir /app/migrations_pg --config-file /app/diesel_pg.toml'" networks: - open-router-network routing-config: image: python:3.10-slim profiles: - mysql-ghcr - dashboard-mysql-ghcr - mysql-local - dashboard-mysql-local depends_on: mysql: condition: service_healthy volumes: - ./routing-config:/app working_dir: /app command: bash run_setup.sh networks: - open-router-network networks: open-router-network: driver: bridge volumes: mysql-data: redis-data: postgres-data: clickhouse-data: