-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yaml
227 lines (212 loc) · 6.06 KB
/
docker-compose.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
version: '3.8'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
container_name: zookeeper
hostname: zookeeper
restart: unless-stopped
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
# ports:
# - 2181:2181
kafka:
image: confluentinc/cp-kafka:latest
container_name: kafka
hostname: kafka
restart: unless-stopped
depends_on:
- zookeeper
#ports:
# - 19092:9092
environment:
- KAFKA_BROKER_ID=1
- KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
- KAFKA_ADVERTISED_LISTENERS=INSIDE://:9092
- KAFKA_LISTENERS=INSIDE://:9092
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INSIDE:PLAINTEXT
- KAFKA_INTER_BROKER_LISTENER_NAME=INSIDE
- KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
- KAFKA_AUTO_CREATE_TOPICS_ENABLE=true
kafka_ui:
image: provectuslabs/kafka-ui:latest
container_name: kafka_ui
restart: unless-stopped
depends_on:
- kafka
ports:
- 18080:8080
environment:
- KAFKA_CLUSTERS_0_NAME=local
- KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka:9092
- KAFKA_CLUSTERS_0_ZOOKEEPER=zookeeper:2181
kafka_init:
image: confluentinc/cp-kafka:latest
container_name: kafka_init
depends_on:
- zookeeper
- kafka
entrypoint: [ '/bin/sh', '-c' ]
command: |
"
# blocks until kafka is reachable
kafka-topics --bootstrap-server kafka:9092 --list
echo -e 'Creating kafka topics'
kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --replication-factor 1 --partitions 1 --topic start
kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --replication-factor 1 --partitions 1 --topic stage2
kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --replication-factor 1 --partitions 1 --topic stage3
kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --replication-factor 1 --partitions 1 --topic stage4
kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --replication-factor 1 --partitions 1 --topic stage5
kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --replication-factor 1 --partitions 1 --topic stage6
kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --replication-factor 1 --partitions 1 --topic finish
echo -e 'Successfully created the following topics:'
kafka-topics --bootstrap-server kafka:9092 --list
"
postgres:
image: postgres:latest
container_name: postgres
hostname: postgres
restart: unless-stopped
#ports:
# - 15432:5432
environment:
- POSTGRES_USER=flow
- POSTGRES_PASSWORD=uyrT1hM72cecTTu6
- POSTGRES_DB=flow_results
postgres_ui:
container_name: postgres_ui
restart: unless-stopped
image: sosedoff/pgweb
ports:
- 18081:8081
environment:
- DATABASE_URL=postgres://flow:uyrT1hM72cecTTu6@postgres:5432/flow_results?sslmode=disable
depends_on:
- postgres
stage0:
build:
context: ./src/numbergenerator
dockerfile: Dockerfile
container_name: flow_stage0
restart: unless-stopped
depends_on:
- kafka_init
- postgres
environment:
- STAGE_NUMBER=stage0
- BOOTSTRAP_SERVERS=kafka:9092
- OUTPUT_TOPIC=start
- DB_HOST=postgres
- DB_NAME=flow_results
- DB_USER=flow
- DB_PASSWORD=uyrT1hM72cecTTu6
stage1:
build:
context: ./src/python_math
dockerfile: Dockerfile
container_name: flow_stage1
restart: unless-stopped
depends_on:
- kafka_init
- postgres
environment:
- STAGE_NUMBER=stage1
- OPERATION_TYPE=add
- BOOTSTRAP_SERVERS=kafka:9092
- INPUT_TOPIC=start
- OUTPUT_TOPIC=stage2
- DB_HOST=postgres
- DB_NAME=flow_results
- DB_USER=flow
- DB_PASSWORD=uyrT1hM72cecTTu6
stage2:
build:
context: ./src/python_math
dockerfile: Dockerfile
container_name: flow_stage2
restart: unless-stopped
depends_on:
- kafka_init
- postgres
environment:
- STAGE_NUMBER=stage2
- OPERATION_TYPE=multiply
- BOOTSTRAP_SERVERS=kafka:9092
- INPUT_TOPIC=stage2
- OUTPUT_TOPIC=stage3
- DB_HOST=postgres
- DB_NAME=flow_results
- DB_USER=flow
- DB_PASSWORD=uyrT1hM72cecTTu6
stage3:
build:
context: ./src/lcm
dockerfile: Dockerfile
container_name: flow_stage3
restart: unless-stopped
depends_on:
- kafka_init
- postgres
environment:
- STAGE_NUMBER=stage3
- BOOTSTRAP_SERVERS=kafka:9092
- INPUT_TOPIC=stage3
- OUTPUT_TOPIC=stage4
- DB_HOST=postgres
- DB_NAME=flow_results
- DB_USER=flow
- DB_PASSWORD=uyrT1hM72cecTTu6
stage4:
build:
context: ./src/average
dockerfile: Dockerfile
container_name: flow_stage4
restart: unless-stopped
depends_on:
- kafka_init
- postgres
environment:
- STAGE_NUMBER=stage4
- BOOTSTRAP_SERVERS=kafka:9092
- INPUT_TOPIC=stage4
- OUTPUT_TOPIC=stage5
- DB_HOST=postgres
- DB_NAME=flow_results
- DB_USER=flow
- DB_PASSWORD=uyrT1hM72cecTTu6
stage5:
build:
context: ./src/sin
dockerfile: Dockerfile
container_name: flow_stage5
restart: unless-stopped
depends_on:
- kafka_init
- postgres
environment:
- STAGE_NUMBER=stage5
- BOOTSTRAP_SERVERS=kafka:9092
- INPUT_TOPIC=stage5
- OUTPUT_TOPIC=stage6
- DB_HOST=postgres
- DB_NAME=flow_results
- DB_USER=flow
- DB_PASSWORD=uyrT1hM72cecTTu6
stage6:
build:
context: ./src/squareroot
dockerfile: Dockerfile
container_name: flow_stage6
restart: unless-stopped
depends_on:
- kafka_init
- postgres
environment:
- STAGE_NUMBER=stage6
- BOOTSTRAP_SERVERS=kafka:9092
- INPUT_TOPIC=stage6
- OUTPUT_TOPIC=finish
- DB_HOST=postgres
- DB_NAME=flow_results
- DB_USER=flow
- DB_PASSWORD=uyrT1hM72cecTTu6