# Overlay for the latency experiment: put Toxiproxy between both schedulers and
# PostgreSQL so we can dial in network delay. Workers and Kafka are untouched.
services:
  toxiproxy:
    image: ghcr.io/shopify/toxiproxy:2.12.0
    command: ["-host=0.0.0.0", "-config=/config/toxiproxy.json"]
    volumes:
      - ${LAB_DIR:?set LAB_DIR}/toxiproxy.json:/config/toxiproxy.json:ro
    ports:
      - 127.0.0.1:8474:8474
    depends_on:
      postgres:
        condition: service_healthy
  runtime-a:
    environment:
      DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@toxiproxy:5432/${POSTGRES_DB}?sslmode=disable
    depends_on: [toxiproxy]
  runtime-b:
    environment:
      DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@toxiproxy:5432/${POSTGRES_DB}?sslmode=disable
    depends_on: [toxiproxy]
