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