Merge der Setup-Überarbeitungen aus dem Branch 'simple-consumer'
[demos/kafka/training] / docker-compose.yml
1 version: '3.2'
2 services:
3   zookeeper:
4     image: confluentinc/cp-zookeeper:7.1.3
5     environment:
6       ZOOKEEPER_CLIENT_PORT: 2181
7     ports:
8       - 2181:2181
9
10   kafka-1:
11     image: confluentinc/cp-kafka:7.1.3
12     environment:
13       KAFKA_BROKER_ID: 1
14       KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
15       KAFKA_LISTENERS: DOCKER://:9092, LOCALHOST://:9081
16       KAFKA_ADVERTISED_LISTENERS: DOCKER://kafka-1:9092, LOCALHOST://localhost:9081
17       KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER
18       KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: DOCKER:PLAINTEXT, LOCALHOST:PLAINTEXT
19       KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3
20       KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
21     ports:
22       - 9081:9081
23     depends_on:
24       - zookeeper
25
26   kafka-2:
27     image: confluentinc/cp-kafka:7.1.3
28     environment:
29       KAFKA_BROKER_ID: 2
30       KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
31       KAFKA_LISTENERS: DOCKER://:9092, LOCALHOST://:9082
32       KAFKA_ADVERTISED_LISTENERS: DOCKER://kafka-2:9092, LOCALHOST://localhost:9082
33       KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER
34       KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: DOCKER:PLAINTEXT, LOCALHOST:PLAINTEXT
35       KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3
36       KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
37     ports:
38       - 9092:9082
39       - 9082:9082
40     networks:
41       default:
42         aliases:
43           - kafka
44     depends_on:
45       - zookeeper
46
47   kafka-3:
48     image: confluentinc/cp-kafka:7.1.3
49     environment:
50       KAFKA_BROKER_ID: 3
51       KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
52       KAFKA_LISTENERS: DOCKER://:9092, LOCALHOST://:9083
53       KAFKA_ADVERTISED_LISTENERS: DOCKER://kafka-3:9092, LOCALHOST://localhost:9083
54       KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER
55       KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: DOCKER:PLAINTEXT, LOCALHOST:PLAINTEXT
56       KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3
57       KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
58     ports:
59       - 9083:9083
60     depends_on:
61       - zookeeper
62
63   setup:
64     image: juplo/toolbox
65     command: >
66       bash -c "
67         kafka-topics --bootstrap-server kafka:9092 --delete --if-exists --topic test
68         kafka-topics --bootstrap-server kafka:9092 --create --topic test --partitions 2 --replication-factor 3 --config min.insync.replicas=2
69         kafka-topics --bootstrap-server kafka:9092 --describe --topic test
70       "
71
72   cli:
73     image: juplo/toolbox
74     command: sleep infinity
75
76   producer:
77     image: juplo/rest-producer:1.0-SNAPSHOT
78     ports:
79       - 8080:8080
80     environment:
81       server.port: 8080
82       producer.bootstrap-server: kafka:9092
83       producer.client-id: producer
84       producer.topic: test
85
86
87   peter:
88     image: juplo/rest-client:1.0-SNAPSHOT
89     environment:
90       server.port: 8080
91       rest-client.baseUrl: http://producer:8080
92       rest-client.username: peter
93       rest-client.throttle-ms: 1000
94
95   klaus:
96     image: juplo/rest-client:1.0-SNAPSHOT
97     environment:
98       server.port: 8080
99       rest-client.baseUrl: http://producer:8080
100       rest-client.username: klaus
101       rest-client.throttle-ms: 1100
102
103   beate:
104     image: juplo/rest-client:1.0-SNAPSHOT
105     environment:
106       server.port: 8080
107       rest-client.baseUrl: http://producer:8080
108       rest-client.username: beate
109       rest-client.throttle-ms: 900
110
111   franz:
112     image: juplo/rest-client:1.0-SNAPSHOT
113     environment:
114       server.port: 8080
115       rest-client.baseUrl: http://producer:8080
116       rest-client.username: franz
117       rest-client.throttle-ms: 800
118
119   uschi:
120     image: juplo/rest-client:1.0-SNAPSHOT
121     environment:
122       server.port: 8080
123       rest-client.baseUrl: http://producer:8080
124       rest-client.username: uschi
125       rest-client.throttle-ms: 1200
126
127   consumer-1:
128     image: juplo/simple-consumer:1.0-SNAPSHOT
129     command: consumer-1
130
131   consumer-2:
132     image: juplo/simple-consumer:1.0-SNAPSHOT
133     command: consumer-2
134
135   consumer-3:
136     image: juplo/simple-consumer:1.0-SNAPSHOT
137     command: consumer-3
138
139   spikzettel:
140     image: juplo/toolbox
141     command: >
142       bash -c '
143         kafka-console-consumer \
144           --bootstrap-server kafka:9092 \
145           --topic __consumer_offsets --from-beginning \
146           --formatter "kafka.coordinator.group.GroupMetadataManager\$$OffsetsMessageFormatter"
147       '