version: "3.9"
services:
  graphite:
    image: graphiteapp/graphite-statsd
    container_name: graphite
    restart: always
    ports:
      - "8080:80"
      - "8125:8125/udp"
      - "8126:8126"
      - "2003:2003"
      - "2004:2004"
  migrator:
    depends_on:
      - db
    environment:
      DATABASE_URL: postgres://solana:solana@db/solana
    build:
      context: .
      dockerfile: Migrator.Dockerfile
  ingester:
    depends_on:
      - migrator
      - redis
      - db
      - graphite
      - solana
    restart: always
    environment:
      RUST_LOG: debug
      INGESTER_METRICS_PORT: 8125
      INGESTER_METRICS_HOST: graphite
      INGESTER_DATABASE_CONFIG: '{max_postgres_connections=, listener_channel="backfill_item_added", url="postgres://solana:solana@db/solana"}'
      INGESTER_MESSENGER_CONFIG: '{connection_config={batch_size=500,idle_timeout=5000,redis_connection_str="redis://redis"}, messenger_type="Redis"}'
      INGESTER_RPC_CONFIG: '{url="http://${COMPOSE_PROJECT_NAME}-solana-1:8899/", commitment="confirmed"}'
      RUST_BACKTRACE: 1
    build:
      context: .
      dockerfile: Ingest.Dockerfile
  load:
    depends_on:
      - migrator
      - ingester
      - solana
    restart: always
    environment:
      KEYPAIR_SEED: "caputure the diems and stuff and then prolly take a nap and stuff"
      NETWORK: "local"
      AMOUNT_OF_CHAOS: 1
      RPC_URL: "http://${COMPOSE_PROJECT_NAME}-solana-1:8899/"
    build:
      context: .
      dockerfile: Load.Dockerfile
  proxy:
    build:
      context: .
      dockerfile: Proxy.Dockerfile
    volumes:
      - ./metaplex-rpc-proxy/envoy-compose.yaml:/etc/envoy.yaml
    ports:
      - 9091:9091
  api:
    depends_on:
      - migrator
    restart: always
    environment:
      APP_DATABASE_URL: postgres://solana:solana@db/solana
      APP_SERVER_PORT: 9090
      APP_METRICS_PORT: 8125
      APP_METRICS_HOST: graphite
    build:
      context: .
      dockerfile: Api.Dockerfile
    ports:
      - 9090:9090
  redis:
    image: "redis:7.0.0"
    ports:
      - "6379:6379"
  db:
    image: 'postgres:14'
    command: ["postgres", "-c", "log_statement=all", "-c", "log_destination=stderr" ,"-c","max_connections=200"]
    ports:
      - 5432:5432
    environment:
      POSTGRES_USER: solana # The PostgreSQL user (useful to connect to the database)
      POSTGRES_PASSWORD: solana # The PostgreSQL password (useful to connect to the database)
      POSTGRES_DB: solana
    volumes:
      - ./db-data/:/var/lib/postgresql/data/:rw
  solana:
    image: ghcr.io/metaplex-foundation/plerkle-test-validator:v1.5.1-1.64.0-v1.14.15
    volumes:
    - ./programs:/so/:ro
    - ./ledger:/config:rw
    - ./solana-test-validator-geyser-config:/plugin-config:rw
    environment:
      RUST_LOG: error
      PLUGIN_MESSENGER_CONFIG.messenger_type: "Redis"
      PLUGIN_MESSENGER_CONFIG.connection_config: '{redis_connection_str="redis://redis"}'
    ports:
      - "8900:8900"
      - "8001:8001"
      - "8899:8899"
      - "9900:9900"
volumes:
  grafana_data: {}
  graphite_data: {}