87338db2c2e0ed5228f79f1f3e6a955d3b2ed248
[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   counter:
65     image: juplo/wordcount--counter:1.0.1
66     labels:
67       - "traefik.enable=true"
68       - "traefik.http.routers.counter.rule=Host(`counter.localhost`)"
69       - "traefik.http.routers.counter.entrypoints=web"
70     environment:
71       juplo.wordcount.counter.bootstrap-server: kafka:9092
72     depends_on:
73       - kafka
74
75   top10:
76     image: juplo/wordcount--top10:1.0.1
77     labels:
78       - "traefik.enable=true"
79       - "traefik.http.routers.top10.rule=Host(`top10.localhost`)"
80       - "traefik.http.routers.top10.entrypoints=web"
81     environment:
82       juplo.wordcount.top10.bootstrap-server: kafka:9092
83     depends_on:
84       - kafka
85
86   query:
87     image: juplo/wordcount--query:1.0.4
88     labels:
89       - "traefik.enable=true"
90       - "traefik.http.routers.query.rule=Host(`query.localhost`)"
91       - "traefik.http.routers.query.entrypoints=web"
92     environment:
93       juplo.wordcount.query.bootstrap-server: kafka:9092
94     depends_on:
95       - kafka
96
97   bart:
98     image: juplo/wordcount--fortune:1.0.0
99     command: bash -c "
100       while [ true ];
101       do
102         /usr/games/fortune chalkboard
103           | head -1
104           | http -v recorder:8081/bart;
105         echo;
106         sleep 1;
107       done"
108
109   nerd:
110     image: juplo/wordcount--fortune:1.0.0
111     command: bash -c "
112       while [ true ];
113       do
114         /usr/games/fortune computers
115           | grep  -v '^[[:space:]]*--'
116           | http -v recorder:8081/nerd;
117         echo;
118         sleep 1;
119       done"
120
121   riddler:
122     image: juplo/wordcount--fortune:1.0.0
123     command: bash -c "
124       while [ true ];
125       do
126         /usr/games/fortune riddles
127           | awk -F':' '/^Q/ { print $$2 }'
128           | http -v recorder:8081/riddler;
129         echo;
130         sleep 1;
131       done"
132
133   cli:
134     image: juplo/toolbox
135     command: bash -c "
136       cub kafka-ready -b kafka:9092 1 60 ;
137       kafka-topics --bootstrap-server kafka:9092 --create --partitions 10 --topic recordings ;
138       kafka-topics --bootstrap-server kafka:9092 --create --partitions 10 --topic users ;
139       kafka-topics --bootstrap-server kafka:9092 --create --partitions 10 --topic countings ;
140       kafka-topics --bootstrap-server kafka:9092 --create --partitions 10 --topic top10 ;
141       sleep infinity"
142
143   akhq:
144     image: tchiotludo/akhq:0.18.0
145     labels:
146       - "traefik.enable=true"
147       - "traefik.http.routers.akhq.rule=Host(`akhq.localhost`)"
148       - "traefik.http.routers.akhq.entrypoints=web"
149     expose:
150       - 8080
151     environment:
152       AKHQ_CONFIGURATION: |
153         akhq:
154           connections:
155             docker-kafka-server:
156               properties:
157                 bootstrap.servers: "kafka:9092"
158
159 networks:
160   default:
161     external:
162       name: trion