version: '2.2'
services:
  zookeeper:
    image: confluentinc/cp-zookeeper
    expose:
      - "2181"
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
  kafka:
    image: wurstmeister/kafka
    expose:
      - "9092"
    #ports:
    #  - 19092:19092
    environment:
      KAFKA_LISTENERS: PLAINTEXT://:9092,CONNECTIONS_FROM_HOST://:19092
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,CONNECTIONS_FROM_HOST://localhost:19092
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,CONNECTIONS_FROM_HOST:PLAINTEXT
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_ZOOKEEPER_CONNECTION_TIMEOUT_MS: 30000
      KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
      KAFKA_CREATE_TOPICS: "input:3:1,output:3:1,configuration:3:1,aggregation-feedback:3:1"
  kcat:
    image: edenhill/kcat:1.7.1
    entrypoint: "sh"
    tty: true
  schema-registry:
    image: confluentinc/cp-schema-registry:7.0.1
    depends_on:
      - zookeeper
      - kafka
    restart: "on-failure"
    expose:
      - "8081"
    #ports:
    #  - 8081:8081
    environment:
      SCHEMA_REGISTRY_HOST_NAME: schema-registry
      SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: kafka:9092
  load-generator: 
    image: ghcr.io/cau-se/theodolite-uc4-workload-generator:${THEODOLITE_TAG:-latest}
    depends_on:
      - schema-registry
      - kafka
    environment:
      BOOTSTRAP_SERVER: load-generator:5701
      PORT: 5701
      KAFKA_BOOTSTRAP_SERVERS: kafka:9092
      SCHEMA_REGISTRY_URL: http://schema-registry:8081
      NUM_SENSORS: 4
      NUM_NESTED_GROUPS: 3
  benchmark-jobmanager:
      image: ghcr.io/cau-se/theodolite-uc4-beam-flink:${THEODOLITE_TAG:-latest}
      #ports:
      #  - "8080:8081"
      command: >
        standalone-job
        --job-classname rocks.theodolite.benchmarks.uc4.beam.flink.Uc4BeamFlink
        --disableMetrics=true 
        --fasterCopy 
      environment:
        - KAFKA_BOOTSTRAP_SERVERS=kafka:9092
        - SCHEMA_REGISTRY_URL=http://schema-registry:8081
        - |
          FLINK_PROPERTIES=
          jobmanager.rpc.address: benchmark-jobmanager
          parallelism.default: 1
          state.backend: rocksdb
          state.checkpoints.dir: file:///data/flink/checkpoints
        - GRACE_PERIOD_MS=5000
        - TRIGGER_INTERVAL_SECONDS=1
      depends_on:
        - schema-registry
        - kafka
  benchmark-taskmanager:
      image: ghcr.io/cau-se/theodolite-uc4-beam-flink:${THEODOLITE_TAG:-latest}
      scale: 1
      command: taskmanager
      environment:
        - |
          FLINK_PROPERTIES=
          jobmanager.rpc.address: benchmark-jobmanager
          state.backend: rocksdb
          state.checkpoints.dir: file:///data/flink/checkpoints
      depends_on:
        - schema-registry
        - kafka
