github.com/deanMdreon/kafka-go@v0.4.32/docker-compose.yml (about) 1 version: "3" 2 services: 3 kafka: 4 image: wurstmeister/kafka:2.12-2.3.1 5 restart: on-failure:3 6 links: 7 - zookeeper 8 ports: 9 - 9092:9092 10 - 9093:9093 11 environment: 12 KAFKA_VERSION: '2.3.1' 13 KAFKA_BROKER_ID: '1' 14 KAFKA_CREATE_TOPICS: 'test-writer-0:3:1,test-writer-1:3:1' 15 KAFKA_DELETE_TOPIC_ENABLE: 'true' 16 KAFKA_ADVERTISED_HOST_NAME: 'localhost' 17 KAFKA_ADVERTISED_PORT: '9092' 18 KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181' 19 KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true' 20 KAFKA_MESSAGE_MAX_BYTES: '200000000' 21 KAFKA_LISTENERS: 'PLAINTEXT://:9092,SASL_PLAINTEXT://:9093' 22 KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://localhost:9092,SASL_PLAINTEXT://localhost:9093' 23 KAFKA_SASL_ENABLED_MECHANISMS: 'PLAIN,SCRAM-SHA-256,SCRAM-SHA-512' 24 KAFKA_AUTHORIZER_CLASS_NAME: 'kafka.security.auth.SimpleAclAuthorizer' 25 KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: 'true' 26 KAFKA_OPTS: "-Djava.security.auth.login.config=/opt/kafka/config/kafka_server_jaas.conf" 27 CUSTOM_INIT_SCRIPT: |- 28 echo -e 'KafkaServer {\norg.apache.kafka.common.security.scram.ScramLoginModule required\n username="adminscram"\n password="admin-secret";\n org.apache.kafka.common.security.plain.PlainLoginModule required\n username="adminplain"\n password="admin-secret"\n user_adminplain="admin-secret";\n };' > /opt/kafka/config/kafka_server_jaas.conf; 29 /opt/kafka/bin/kafka-configs.sh --zookeeper zookeeper:2181 --alter --add-config 'SCRAM-SHA-256=[password=admin-secret-256],SCRAM-SHA-512=[password=admin-secret-512]' --entity-type users --entity-name adminscram 30 31 zookeeper: 32 image: wurstmeister/zookeeper 33 ports: 34 - 2181:2181