docker-compose.yml raw

   1  version: "3.8"
   2  
   3  services:
   4    # Next.orly.dev relay with Badger (fetches latest tag from git)
   5    next-orly-badger:
   6      build:
   7        context: .
   8        dockerfile: Dockerfile.next-orly
   9      container_name: benchmark-next-orly-badger
  10      environment:
  11        - ORLY_DATA_DIR=/data
  12        - ORLY_LISTEN=0.0.0.0
  13        - ORLY_PORT=8080
  14        - ORLY_LOG_LEVEL=off
  15        - ORLY_DB_TYPE=badger
  16      volumes:
  17        - ./data/next-orly-badger:/data
  18      ports:
  19        - "8001:8080"
  20      networks:
  21        - benchmark-net
  22      healthcheck:
  23        test: ["CMD", "curl", "-f", "http://localhost:8080/"]
  24        interval: 30s
  25        timeout: 10s
  26        retries: 3
  27        start_period: 40s
  28  
  29    # Next.orly.dev relay with Neo4j (fetches latest tag from git)
  30    next-orly-neo4j:
  31      build:
  32        context: .
  33        dockerfile: Dockerfile.next-orly
  34      container_name: benchmark-next-orly-neo4j
  35      environment:
  36        - ORLY_DATA_DIR=/data
  37        - ORLY_LISTEN=0.0.0.0
  38        - ORLY_PORT=8080
  39        - ORLY_LOG_LEVEL=off
  40        - ORLY_DB_TYPE=neo4j
  41        - ORLY_NEO4J_URI=bolt://neo4j:7687
  42        - ORLY_NEO4J_USER=neo4j
  43        - ORLY_NEO4J_PASSWORD=benchmark123
  44      volumes:
  45        - ./data/next-orly-neo4j:/data
  46      ports:
  47        - "8008:8080"
  48      networks:
  49        - benchmark-net
  50      depends_on:
  51        neo4j:
  52          condition: service_healthy
  53      healthcheck:
  54        test: ["CMD", "curl", "-f", "http://localhost:8080/"]
  55        interval: 30s
  56        timeout: 10s
  57        retries: 3
  58        start_period: 60s
  59  
  60    # Neo4j database
  61    neo4j:
  62      image: neo4j:5.15-community
  63      container_name: benchmark-neo4j
  64      ports:
  65        - "7474:7474"  # HTTP
  66        - "7687:7687"  # Bolt
  67      environment:
  68        - NEO4J_AUTH=neo4j/benchmark123
  69        - NEO4J_server_memory_heap_initial__size=2G
  70        - NEO4J_server_memory_heap_max__size=4G
  71        - NEO4J_server_memory_pagecache_size=2G
  72        - NEO4J_dbms_security_procedures_unrestricted=apoc.*
  73        - NEO4J_dbms_security_procedures_allowlist=apoc.*
  74        - NEO4JLABS_PLUGINS=["apoc"]
  75      volumes:
  76        - ./data/neo4j:/data
  77        - ./data/neo4j-logs:/logs
  78      networks:
  79        - benchmark-net
  80      healthcheck:
  81        test: ["CMD-SHELL", "cypher-shell -u neo4j -p benchmark123 'RETURN 1;' || exit 1"]
  82        interval: 10s
  83        timeout: 5s
  84        retries: 10
  85        start_period: 40s
  86  
  87    # Khatru with SQLite
  88    khatru-sqlite:
  89      build:
  90        context: ./external/khatru
  91        dockerfile: ../../Dockerfile.khatru-sqlite
  92      container_name: benchmark-khatru-sqlite
  93      environment:
  94        - DATABASE_TYPE=sqlite
  95        - DATABASE_PATH=/data/khatru.db
  96      volumes:
  97        - ./data/khatru-sqlite:/data
  98      ports:
  99        - "8002:3334"
 100      networks:
 101        - benchmark-net
 102      healthcheck:
 103        test: ["CMD-SHELL", "wget -q -O- http://localhost:3334 || exit 0"]
 104        interval: 30s
 105        timeout: 10s
 106        retries: 3
 107        start_period: 40s
 108  
 109    # Khatru with Badger
 110    khatru-badger:
 111      build:
 112        context: ./external/khatru
 113        dockerfile: ../../Dockerfile.khatru-badger
 114      container_name: benchmark-khatru-badger
 115      environment:
 116        - DATABASE_TYPE=badger
 117        - DATABASE_PATH=/data/badger
 118      volumes:
 119        - ./data/khatru-badger:/data
 120      ports:
 121        - "8003:3334"
 122      networks:
 123        - benchmark-net
 124      healthcheck:
 125        test: ["CMD-SHELL", "wget -q -O- http://localhost:3334 || exit 0"]
 126        interval: 30s
 127        timeout: 10s
 128        retries: 3
 129        start_period: 40s
 130  
 131    # Relayer basic example
 132    relayer-basic:
 133      build:
 134        context: ./external/relayer
 135        dockerfile: ../../Dockerfile.relayer-basic
 136      container_name: benchmark-relayer-basic
 137      environment:
 138        - POSTGRESQL_DATABASE=postgres://relayer:relayerpass@postgres:5432/relayerdb?sslmode=disable
 139      volumes:
 140        - ./data/relayer-basic:/data
 141      ports:
 142        - "8004:7447"
 143      networks:
 144        - benchmark-net
 145      depends_on:
 146        postgres:
 147          condition: service_healthy
 148      healthcheck:
 149        test: ["CMD-SHELL", "wget -q -O- http://localhost:7447 || exit 0"]
 150        interval: 30s
 151        timeout: 10s
 152        retries: 3
 153        start_period: 40s
 154  
 155    # Strfry
 156    strfry:
 157      image: ghcr.io/hoytech/strfry:latest
 158      container_name: benchmark-strfry
 159      environment:
 160        - STRFRY_DB_PATH=/data/strfry-db
 161        - STRFRY_RELAY_PORT=8080
 162      volumes:
 163        - ./data/strfry:/data
 164        - ./configs/strfry.conf:/etc/strfry.conf
 165      ports:
 166        - "8005:8080"
 167      networks:
 168        - benchmark-net
 169      entrypoint: /bin/sh
 170      command: -c "mkdir -p /data/strfry-db && exec /app/strfry relay"
 171      healthcheck:
 172        test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://127.0.0.1:8080"]
 173        interval: 30s
 174        timeout: 10s
 175        retries: 3
 176        start_period: 40s
 177  
 178    # Nostr-rs-relay
 179    nostr-rs-relay:
 180      build:
 181        context: ./external/nostr-rs-relay
 182        dockerfile: ../../Dockerfile.nostr-rs-relay
 183      container_name: benchmark-nostr-rs-relay
 184      environment:
 185        - RUST_LOG=info
 186      volumes:
 187        - ./data/nostr-rs-relay:/data
 188        - ./configs/config.toml:/app/config.toml
 189      ports:
 190        - "8006:8080"
 191      networks:
 192        - benchmark-net
 193      healthcheck:
 194        test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080"]
 195        interval: 30s
 196        timeout: 10s
 197        retries: 3
 198        start_period: 40s
 199  
 200    # Rely-SQLite relay
 201    rely-sqlite:
 202      build:
 203        context: .
 204        dockerfile: Dockerfile.rely-sqlite
 205      container_name: benchmark-rely-sqlite
 206      environment:
 207        - DATABASE_PATH=/data/relay.db
 208        - RELAY_LISTEN=0.0.0.0:3334
 209      volumes:
 210        - ./data/rely-sqlite:/data
 211      ports:
 212        - "8009:3334"
 213      networks:
 214        - benchmark-net
 215      healthcheck:
 216        test: ["CMD-SHELL", "curl -s --max-time 2 http://localhost:3334 2>&1 | head -1 | grep -q ."]
 217        interval: 10s
 218        timeout: 5s
 219        retries: 10
 220        start_period: 30s
 221  
 222    # Benchmark runner (fetches latest tag from git)
 223    benchmark-runner:
 224      build:
 225        context: .
 226        dockerfile: Dockerfile.benchmark
 227      container_name: benchmark-runner
 228      depends_on:
 229        next-orly-badger:
 230          condition: service_healthy
 231        next-orly-neo4j:
 232          condition: service_healthy
 233        khatru-sqlite:
 234          condition: service_healthy
 235        khatru-badger:
 236          condition: service_healthy
 237        relayer-basic:
 238          condition: service_healthy
 239        strfry:
 240          condition: service_healthy
 241        nostr-rs-relay:
 242          condition: service_healthy
 243        rely-sqlite:
 244          condition: service_healthy
 245      environment:
 246        - BENCHMARK_TARGETS=rely-sqlite:3334,next-orly-badger:8080,next-orly-neo4j:8080,khatru-sqlite:3334,khatru-badger:3334,relayer-basic:7447,strfry:8080,nostr-rs-relay:8080
 247        - BENCHMARK_EVENTS=50000
 248        - BENCHMARK_WORKERS=24
 249        - BENCHMARK_DURATION=60s
 250        - BENCHMARK_GRAPH_TRAVERSAL=${BENCHMARK_GRAPH_TRAVERSAL:-false}
 251      volumes:
 252        - ./reports:/reports
 253      networks:
 254        - benchmark-net
 255      command: >
 256        sh -c "
 257          echo 'Waiting for all relays to be ready...' &&
 258          sleep 30 &&
 259          echo 'Starting benchmark tests...' &&
 260          /app/benchmark-runner --output-dir=/reports &&
 261          echo 'Benchmark complete - triggering shutdown...' &&
 262          exit 0
 263        "
 264  
 265    # PostgreSQL for relayer-basic
 266    postgres:
 267      image: postgres:16-alpine
 268      container_name: benchmark-postgres
 269      environment:
 270        - POSTGRES_DB=relayerdb
 271        - POSTGRES_USER=relayer
 272        - POSTGRES_PASSWORD=relayerpass
 273      volumes:
 274        - ./data/postgres:/var/lib/postgresql/data
 275      networks:
 276        - benchmark-net
 277      healthcheck:
 278        test: ["CMD-SHELL", "pg_isready -U relayer -d relayerdb"]
 279        interval: 10s
 280        timeout: 5s
 281        retries: 5
 282        start_period: 20s
 283  
 284  networks:
 285    benchmark-net:
 286      driver: bridge
 287  
 288  volumes:
 289    benchmark-data:
 290      driver: local
 291