Updated Confluent-Kafka to `7.5.1` and switched the cluster to KRAFT
[demos/kafka/wordcount] / docker-compose.yml
1 version: '3.2'
2 services:
3
4   kafka:
5     image: confluentinc/cp-kafka:7.5.1
6     environment:
7       KAFKA_NODE_ID: 1
8       KAFKA_LISTENERS: CONTROLLER://:9072, DOCKER://:9092, LOCALHOST://:9082
9       KAFKA_ADVERTISED_LISTENERS: DOCKER://kafka:9092, LOCALHOST://localhost:9082
10       KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER
11       KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT, DOCKER:PLAINTEXT, LOCALHOST:PLAINTEXT
12       KAFKA_PROCESS_ROLES: broker, controller
13       KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9072
14       KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
15       CLUSTER_ID: MkU3OEVBNTcwNTJENDM2Qk
16       KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
17       KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
18       KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
19       KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
20       KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
21     ports:
22       - 9092:9082
23       - 9082:9082
24     stop_grace_period: 120s
25
26   traefik:
27     image: "traefik:v2.5"
28     command:
29       #- "--log.level=DEBUG"
30       - "--api.insecure=true"
31       - "--providers.docker=true"
32       - "--providers.docker.exposedbydefault=false"
33       - "--entrypoints.web.address=:80"
34     ports:
35       - "80:80"
36       - "8080:8080"
37     volumes:
38       - "/var/run/docker.sock:/var/run/docker.sock:ro"
39
40   recorder:
41     image: juplo/wordcount--recorder:1.1.0
42     labels:
43       - "traefik.enable=true"
44       - "traefik.http.routers.recorder.rule=Host(`recorder.localhost`)"
45       - "traefik.http.routers.recorder.entrypoints=web"
46     environment:
47       juplo.wordcount.recorder.bootstrap-server: kafka:9092
48     depends_on:
49       - kafka
50
51   users:
52     image: juplo/wordcount--users:1.0.4
53     labels:
54       - "traefik.enable=true"
55       - "traefik.http.routers.users.rule=Host(`users.localhost`)"
56       - "traefik.http.routers.users.entrypoints=web"
57     environment:
58       juplo.wordcount.users.bootstrap-server: kafka:9092
59     depends_on:
60       - kafka
61
62   splitter:
63     image: juplo/wordcount--splitter:1.1.4
64     labels:
65       - "traefik.enable=true"
66       - "traefik.http.routers.splitter.rule=Host(`splitter.localhost`)"
67       - "traefik.http.routers.splitter.entrypoints=web"
68     environment:
69       juplo.wordcount.splitter.bootstrap-server: kafka:9092
70     depends_on:
71       - kafka
72
73   counter:
74     image: juplo/wordcount--counter:1.2.4
75     labels:
76       - "traefik.enable=true"
77       - "traefik.http.routers.counter.rule=Host(`counter.localhost`)"
78       - "traefik.http.routers.counter.entrypoints=web"
79     environment:
80       juplo.wordcount.counter.bootstrap-server: kafka:9092
81     depends_on:
82       - kafka
83
84   top10:
85     image: juplo/wordcount--top10:1.0.1
86     labels:
87       - "traefik.enable=true"
88       - "traefik.http.routers.top10.rule=Host(`top10.localhost`)"
89       - "traefik.http.routers.top10.entrypoints=web"
90     environment:
91       juplo.wordcount.top10.bootstrap-server: kafka:9092
92     depends_on:
93       - kafka
94
95   query:
96     image: juplo/wordcount--query:1.0.4
97     labels:
98       - "traefik.enable=true"
99       - "traefik.http.routers.query.rule=Host(`query.localhost`)"
100       - "traefik.http.routers.query.entrypoints=web"
101     environment:
102       juplo.wordcount.query.bootstrap-server: kafka:9092
103     depends_on:
104       - kafka
105
106   bart:
107     image: juplo/wordcount--fortune:1.0.0
108     command: bash -c "
109       while [ true ];
110       do
111         /usr/games/fortune chalkboard
112           | head -1
113           | http -v recorder:8081/bart;
114         echo;
115         sleep 1;
116       done"
117
118   nerd:
119     image: juplo/wordcount--fortune:1.0.0
120     command: bash -c "
121       while [ true ];
122       do
123         /usr/games/fortune computers
124           | grep  -v '^[[:space:]]*--'
125           | http -v recorder:8081/nerd;
126         echo;
127         sleep 1;
128       done"
129
130   riddler:
131     image: juplo/wordcount--fortune:1.0.0
132     command: bash -c "
133       while [ true ];
134       do
135         /usr/games/fortune riddles
136           | awk -F':' '/^Q/ { print $$2 }'
137           | http -v recorder:8081/riddler;
138         echo;
139         sleep 1;
140       done"
141
142   cli:
143     image: juplo/toolbox
144     command: bash -c "
145       cub kafka-ready -b kafka:9092 1 60 ;
146       kafka-topics --bootstrap-server kafka:9092 --create --partitions 10 --if-not-exists --topic recordings ;
147       kafka-topics --bootstrap-server kafka:9092 --create --partitions 10 --if-not-exists --topic users ;
148       kafka-topics --bootstrap-server kafka:9092 --create --partitions 10 --if-not-exists --topic words ;
149       kafka-topics --bootstrap-server kafka:9092 --create --partitions 10 --if-not-exists --topic countings ;
150       kafka-topics --bootstrap-server kafka:9092 --create --partitions 10 --if-not-exists --topic top10 ;
151       sleep infinity"
152
153   akhq:
154     image: tchiotludo/akhq:0.18.0
155     labels:
156       - "traefik.enable=true"
157       - "traefik.http.routers.akhq.rule=Host(`akhq.localhost`)"
158       - "traefik.http.routers.akhq.entrypoints=web"
159     expose:
160       - 8080
161     environment:
162       AKHQ_CONFIGURATION: |
163         akhq:
164           connections:
165             docker-kafka-server:
166               properties:
167                 bootstrap.servers: "kafka:9092"