-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
271 lines (230 loc) · 6.58 KB
/
docker-compose.yml
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
version: '3.7'
services:
#-------------------------------#
# zookeeper #
#-------------------------------#
zookeeper:
image: confluentinc/cp-zookeeper:6.1.1
container_name: zookeeper
hostname: zookeeper
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_SERVER_ID: "1"
ZOOKEEPER_HEAP_OPTS: -Xmx512m -Xmx512m
# mem_limit: 1g
networks:
- fmap-int
#-------------------------------#
# kafka server #
#-------------------------------#
kafkaserver:
image: confluentinc/cp-kafka:6.1.1
container_name: kafkaserver
hostname: kafkaserver
depends_on:
- zookeeper
ports:
- "9092:9092"
- "9101:9101"
environment:
KAFKA_BROKER_ID: 0
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafkaserver:9092
KAFKA_DEFAULT_REPLICATION_FACTOR: 2
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 2
KAFKA_HEAP_OPTS: -Xmx512m -Xmx512m
# mem_limit: 1g
networks:
- fmap-int
- fmap-com
#-------------------------------#
# kafka (create topics) #
#-------------------------------#
kafka-create-topics:
image: confluentinc/cp-kafka:6.1.1
depends_on:
- kafkaserver
container_name: kafka-create-topics
hostname: kafka-create-topics
command: "bash -c 'echo Waiting for Kafka to be ready... && \
cub kafka-ready -b kafkaserver:9092 1 200 && \
kafka-topics --create --topic rds-signal --if-not-exists --zookeeper zookeeper:2181 --partitions 1 --replication-factor 1 && \
kafka-topics --create --topic rds-signal-output --if-not-exists --zookeeper zookeeper:2181 --partitions 1 --replication-factor 1 &&\
sleep infinity'"
environment:
KAFKA_BROKER_ID: ignored
KAFKA_ZOOKEEPER_CONNECT: ignored
KAFKA_HEAP_OPTS: -Xmx512m -Xmx512m
# mem_limit: 1g
networks:
- fmap-int
#-------------------------------#
# kafka stream (🤮) #
#-------------------------------#
kafkastream:
build:
context: kafkastream
image: fmap:stream
container_name: kafkastream
depends_on:
- kafkaserver
- kafka-create-topics
networks:
- fmap-int
#-------------------------------#
# kafka (worker) #
#-------------------------------#
kafkaworker1:
image: confluentinc/cp-kafka:6.1.1
container_name: kafkaWorker1
depends_on:
- zookeeper
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafkaworker1:9092
KAFKA_DEFAULT_REPLICATION_FACTOR: 2
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 2
KAFKA_HEAP_OPTS: -Xmx512m -Xmx512m
# mem_limit: 1g
networks:
- fmap-int
- fmap-com
#-------------------------------#
# kafka web UI #
#-------------------------------#
webui:
image: provectuslabs/kafka-ui:latest
container_name: kafkaWebUI
environment:
KAFKA_CLUSTERS_0_NAME: my_cluster
KAFKA_CLUSTERS_0_ZOOKEEPER: zookeeper:2181
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafkaserver:9092
KAFKA_CLUSTERS_0_HEAP_OPTS: -Xmx512m -Xmx512m
ports:
- 8080:8080
depends_on:
- kafkaserver
# mem_limit: 1g
networks:
- fmap-int
#-------------------------------#
# logstash #
#-------------------------------#
logstash:
container_name: logstash
image: docker.elastic.co/logstash/logstash:7.11.2
volumes:
- $PWD/logstash/pipeline/:/usr/share/logstash/pipeline/
- $PWD/logs/:/usr/share/logstash/logs/
depends_on:
- kafkaserver
environment:
- "LS_JAVA_OPTS=-Xms1g -Xmx1g"
# mem_limit: 2g
networks:
- fmap-ext
- fmap-com
#-------------------------------#
# microcontrollers simulator #
#-------------------------------#
simulator:
container_name: simulator
image: python:3.9.5
working_dir: /usr/src/sim
command: bash -c "pip install pandas && python app.py"
volumes:
- $PWD/logs/:/usr/src/logs/
- $PWD/simulator/:/usr/src/sim
networks:
- fmap-ext
- fmap-com
#-------------------------------#
# Elasticsearch #
#-------------------------------#
elasticsearch:
container_name: elasticsearch
hostname: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.2
ports:
- "9200:9200"
- "9300:9300"
environment:
- xpack.security.enabled=false
- discovery.type=single-node
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- cluster.routing.allocation.disk.threshold_enabled=false
ulimits:
memlock:
soft: -1
hard: -1
# mem_limit: 1g
networks:
- fmap-int
#-------------------------------#
# kafka consumer to ES (python) #
#-------------------------------#
kafka-to-es:
container_name: kafka-to-es
build:
context: kafka-to-es
image: fmap:kafka-to-es
depends_on:
- kafkaserver
- elasticsearch
networks:
- fmap-int
#-------------------------------#
# Kibana #
#-------------------------------#
kibana:
image: docker.elastic.co/kibana/kibana:7.10.2
container_name: kibana
hostname: kibana
ports:
- "5601:5601"
depends_on:
- elasticsearch
networks:
- fmap-int
#-------------------------------#
# spark & spark streaming #
#-------------------------------#
spark:
build:
context: spark
image: fmap:spark
container_name: spark
command: ["structured_streaming_example.py", "org.apache.spark:spark-sql-kafka-0-10_2.12:3.1.1,org.elasticsearch:elasticsearch-spark-30_2.12:7.12.1"]
environment:
SPARK_ACTION: "spark-submit-python"
ports:
- "4040:4040"
depends_on:
- kafkaserver
- elasticsearch
networks:
- fmap-int
deploy:
resources:
limits:
cpus: '1.0'
memory: 1g
reservations:
cpus: '0.5'
memory: 500m
networks:
fmap-int:
name: fmap-int
driver: bridge
fmap-ext:
name: fmap-ext
driver: bridge
fmap-com:
name: fmap-com
driver: bridge