forked from nickcacci/hypermeme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gpu-compose.yaml
306 lines (292 loc) · 9.55 KB
/
gpu-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
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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# https://docs.docker.com/compose/profiles/
services:
# Data pipeline stuff
zookeeper:
image: tap:kafka
container_name: kafkaZK
environment:
- KAFKA_ACTION=start-zk
networks:
tap:
ipv4_address: 10.0.100.22
profiles: ["kafka", "ingestion", "logstash", "pipeline"]
kafkaServer:
image: tap:kafka
container_name: kafkaServer
environment:
- KAFKA_ACTION=start-kafka
#- KAFKA_HEAP_OPTS=-Xmx256M
#ports:
# - 9092:9092
networks:
tap:
ipv4_address: 10.0.100.23
profiles: ["kafka", "ingestion", "logstash", "pipeline"]
depends_on:
- zookeeper
topic:
image: tap:kafka
container_name: kafkaTopic1
environment:
- KAFKA_ACTION=create-topic
- KAFKA_PARTITION=2
- KAFKA_TOPIC=reddit-posts
networks:
tap:
depends_on:
- zookeeper
- kafkaServer
profiles: ["kafka", "ingestion", "logstash", "pipeline"]
kafka-ui:
image: provectuslabs/kafka-ui:latest
container_name: kafkaWebUI
environment:
- KAFKA_CLUSTERS_0_NAME=local
- KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafkaServer:9092
ports:
- 8080:8080
networks:
- tap
depends_on:
- kafkaServer
profiles: ["kafka", "ingestion", "logstash", "pipeline"]
praw_streaming:
image: tap:praw_python
build:
context: ./praw-python
dockerfile: Dockerfile
container_name: praw_streaming
volumes:
- ./dataset:/usr/src/app/dataset
- ./praw-python/bin:/usr/src/app/bin
- ./.env:/usr/src/app/bin/.env
# https://www.jaided.ai/easyocr/documentation/
- ocr_model:/root/.EasyOCR/
- captioning_model:/tmp
networks:
- tap
# command: ["-m", "streaming", "-a", "http://logstash:8081", "-t", "1", "--do-not-save"]
command: ["-m", "streaming", "-a", "http://logstash:8081", "-t", "1"]
environment:
TAP_USE_GPU: "True"
profiles: ["ingestion", "streaming", "pipeline"]
depends_on:
logstash:
condition: service_healthy
topic:
condition: service_completed_successfully
kafkaServer:
condition: service_started
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
sendn:
image: tap:praw_python
build:
context: ./praw-python
dockerfile: Dockerfile
container_name: sendn
volumes:
- ./dataset:/usr/src/app/dataset
- ./praw-python/bin:/usr/src/app/bin
- ./.env:/usr/src/app/bin/.env
# https://www.jaided.ai/easyocr/documentation/
- ocr_model:/root/.EasyOCR/
- captioning_model:/tmp
networks:
- tap
command:
[
"-m",
"sendn",
"-n",
"500",
"-a",
"http://logstash:8081",
"-t",
"5",
]
environment:
TAP_USE_GPU: "True"
profiles: ["ingestion", "pipeline"]
depends_on:
logstash:
condition: service_healthy
topic:
condition: service_completed_successfully
kafkaServer:
condition: service_started
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
download_dataset:
image: tap:praw_python
build:
context: ./praw-python
dockerfile: Dockerfile
container_name: download_dataset
volumes:
- ./dataset:/usr/src/app/dataset
- ./praw-python/bin:/usr/src/app/bin
- ./.env:/usr/src/app/bin/.env
- ocr_model:/root/.EasyOCR/
- captioning_model:/tmp
networks:
- tap
command: ["-m", "downloadn", "-n", "500"]
environment:
TAP_USE_GPU: "True"
profiles: ["download-dataset"]
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
es_settings:
image: tap:es_settings_python
build:
context: ./es_settings_python
dockerfile: Dockerfile
container_name: es_settings
volumes:
- ./es_settings_python/bin:/usr/src/app/bin
networks:
- tap
profiles: ["pipeline", "elasticsearch"]
depends_on:
elasticsearch:
condition: service_healthy
spark_streaming:
image: tap:spark
build:
context: ./spark
dockerfile: Dockerfile
hostname: spark
container_name: spark_streaming
volumes:
- ./spark/:/opt/tap/
- sparknlplibs:/tmp
command: >
/opt/spark/bin/spark-submit --py-files /opt/tap/code/categories.py --conf spark.serializer="org.apache.spark.serializer.KryoSerializer" --conf spark.driver.memory="24G" --conf spark.jsl.settings.pretrained.cache_folder="/tmp" --conf spark.driver.extraJavaOptions="-Divy.cache.dir=/tmp -Divy.home=/tmp" --packages org.apache.spark:spark-sql-kafka-0-10_2.12:3.5.1,org.elasticsearch:elasticsearch-spark-30_2.12:8.13.4,com.johnsnowlabs.nlp:spark-nlp_2.12:5.4.2 /opt/tap/code/streaming.py
networks:
- tap
profiles: ["spark", "streaming", "pipeline"]
depends_on:
es_settings:
condition: service_completed_successfully
spark_model_builder:
image: tap:spark
build:
context: ./spark
dockerfile: Dockerfile
hostname: spark
container_name: spark_model_builder
volumes:
- ./spark/:/opt/tap/
- sparknlplibs:/tmp
- ./dataset:/opt/dataset/
command: >
/opt/spark/bin/spark-submit --py-files /opt/tap/code/categories.py --conf spark.driver.memory="24G" --conf spark.driver.extraJavaOptions="-Divy.cache.dir=/tmp -Divy.home=/tmp" --conf spark.jsl.settings.pretrained.cache_folder="/tmp" --packages org.apache.spark:spark-sql-kafka-0-10_2.12:3.5.1,com.johnsnowlabs.nlp:spark-nlp_2.12:5.4.2 /opt/tap/code/model_builder.py
networks:
- tap
profiles: ["build-model"]
# createTopicRedditComments:
# image: tap:kafka
# container_name: kafkaTopic2
# environment:
# - KAFKA_ACTION=create-topic
# - KAFKA_PARTITION=2
# - KAFKA_TOPIC=reddit-comments
# networks:
# tap:
# depends_on:
# - zookeeper
# - kafkaServer
# kafkaConnector:
# image: kafka-connect-reddit
# container_name: kafkaConnector
# networks:
# - tap
# depends_on:
# - zookeeper
# - kafkaServer
# - createTopicRedditPosts
# - createTopicRedditComments
logstash:
image: docker.elastic.co/logstash/logstash:8.13.0
container_name: logstash
ports:
- 8081:8081
networks:
tap:
ipv4_address: 10.0.100.24
environment:
XPACK_MONITORING_ENABLED: "false"
#LOG_LEVEL: "debug"
volumes:
- ./logstash/pipeline/reddit.conf:/usr/share/logstash/pipeline/logstash.conf
depends_on:
- kafkaServer
- topic
healthcheck:
test: bin/logstash -t
interval: 60s
timeout: 50s
retries: 5
profiles: ["logstash", "ingestion", "pipeline"]
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.13.4
container_name: elasticsearch
environment:
- discovery.type=single-node
- xpack.security.enabled=false
mem_limit: 1 GB
networks:
- tap
profiles: ["elasticsearch", "pipeline"]
healthcheck:
test:
[
"CMD-SHELL",
"curl --silent --fail localhost:9200/_cluster/health || exit 1",
]
interval: 30s
timeout: 30s
retries: 3
kibana:
hostname: kibana
container_name: kibana
image: docker.elastic.co/kibana/kibana:8.13.4
ports:
- 5601:5601
volumes:
- ./kibana/kibana.yml:/usr/share/kibana/config/kibana.yml
depends_on:
topic:
condition: service_completed_successfully
networks:
- tap
profiles: ["kibana", "pipeline"]
networks:
tap:
name: tap
driver: bridge
ipam:
config:
- subnet: 10.0.100.1/24
external: true
# https://docs.docker.com/reference/compose-file/volumes/
volumes:
sparknlplibs:
ocr_model:
captioning_model: