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