# https://kafka.js.org/docs/running-kafka-in-development
version: '2'
services:
  zookeeper:
    image: wurstmeister/zookeeper:latest
    ports:
      - 2181:2181
    volumes:
      - ./_data/zookeeper/data:/data
  kafka:
    image: wurstmeister/kafka:2.12-2.5.0
    hostname: kafka
    #container_name: kafka
    ports:
      - 9092:9092
    environment:
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_LISTENERS: LISTENER_DOCKER_INTERNAL://:19092,LISTENER_DOCKER_EXTERNAL://:9092
      KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka:19092,LISTENER_DOCKER_EXTERNAL://127.0.0.1:9092
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_BROKER_ID: 1
      KAFKA_CREATE_TOPICS: __consumer_offsets:50:1,user.create:1:1
    volumes:
      - ./_data/kafka/data:/var/lib/kafka/data
    depends_on:
      - zookeeper

networks:
  elastic:
    driver: bridge
