-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
306 lines (288 loc) · 6.9 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
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
version: '3.9'
services:
server:
restart: always
build:
context: .
env_file:
- $ENV
expose:
- 8001
volumes:
- .:/app
command: >
sh -c "cd /app/src
&& python movies/utils/wait_for_elastic.py
&& python -m uvicorn movies.main:create_app --reload --host 0.0.0.0 --port 8001"
depends_on:
elasticsearch_etl:
condition: service_healthy
redis-sentinel:
condition: service_healthy
redis:
condition: service_started
redis-slave:
condition: service_started
redis-slave-2:
condition: service_started
labels:
- "traefik.enable=true"
- "traefik.docker.network=movies_api"
- "traefik.http.routers.movies_api.rule=Host(`api-movies.localhost`,`traefik`) || HostRegexp(`eu.ngrok.io`,`{subhost:[a-zA-Z0-9-]+}.eu.ngrok.io`)"
- "traefik.http.routers.movies_api.entrypoints=movies_api"
networks:
- movies_api
- voice_assistant_api
redis-sentinel:
image: bitnami/redis-sentinel:6.2.7
environment:
- REDIS_MASTER_PASSWORD=${NMA_REDIS_PASSWORD}
- REDIS_MASTER_SET=${NMA_REDIS_MASTER_SET}
depends_on:
- redis
- redis-slave
expose:
- 26379
healthcheck:
test: redis-cli -p 26379 ping || exit 1
interval: 5s
timeout: 5s
retries: 5
networks:
- movies_api
- voice_assistant_api
redis:
image: bitnami/redis:6.2.7
environment:
- REDIS_REPLICATION_MODE=master
- REDIS_PASSWORD=${NMA_REDIS_PASSWORD}
ports:
- "6379"
volumes:
- redis_master_data:/data
networks:
- movies_api
- voice_assistant_api
redis-slave:
image: bitnami/redis:6.2.7
environment:
- REDIS_REPLICATION_MODE=slave
- REDIS_MASTER_HOST=redis
- REDIS_MASTER_PASSWORD=${NMA_REDIS_PASSWORD}
- REDIS_PASSWORD=${NMA_REDIS_PASSWORD}
ports:
- "6379"
depends_on:
- redis
volumes:
- redis_slave_data:/data
networks:
- movies_api
- voice_assistant_api
redis-slave-2:
image: bitnami/redis:6.2.7
environment:
- REDIS_REPLICATION_MODE=slave
- REDIS_MASTER_HOST=redis
- REDIS_MASTER_PASSWORD=${NMA_REDIS_PASSWORD}
- REDIS_PASSWORD=${NMA_REDIS_PASSWORD}
ports:
- "6379"
depends_on:
- redis
volumes:
- redis_slave_data:/data
networks:
- movies_api
- voice_assistant_api
traefik:
image: traefik:v2.7
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.movies_api.address=:80"
- "--entrypoints.auth_api.address=:81"
- "--tracing.jaeger=true"
- "--tracing.jaeger.samplingParam=0"
- "--tracing.jaeger.traceContextHeaderName=X-Request-Id"
ports:
- "8008:80"
- "8009:81"
- "8081:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
depends_on:
- server
- server-auth
networks:
- movies_api
db_admin:
image: yandexmiddleteamv1/netflix-admin-db:latest
environment:
- POSTGRES_USER=${NA_DB_USER}
- POSTGRES_PASSWORD=${NA_DB_PASSWORD}
- POSTGRES_DB=${NA_DB_NAME}
ports:
- "5432:5432"
volumes:
- postgres_data_admin:/var/lib/postgresql/data/
networks:
- movies_api
- voice_assistant_api
server_admin:
platform: linux/amd64
restart: always
image: yandexmiddleteamv1/netflix-admin:latest
env_file:
- $ENV
ports:
- "8000:8000"
depends_on:
- db_admin
networks:
- movies_api
- voice_assistant_api
redis_etl:
image: "redis:alpine"
expose:
- 6379
volumes:
- redis_data_etl:/data
networks:
- movies_api
- voice_assistant_api
elasticsearch_etl:
image: elasticsearch:7.17.2
environment:
- xpack.security.enabled=false
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms750m -Xmx750m
ports:
- "9200:9200"
volumes:
- es_data_etl:/usr/share/elasticsearch/data
depends_on:
- redis_etl
healthcheck:
test: curl -u elastic:elastic -s -f elasticsearch_etl:9200/_cat/health >/dev/null || exit 1
interval: 5s
timeout: 5s
retries: 5
networks:
- movies_api
- voice_assistant_api
kibana_etl:
image: kibana:7.17.2
volumes:
- kibana_data_etl:/usr/share/kibana/data
ports:
- "5601:5601"
environment:
- ELASTICSEARCH_HOSTS=http://elasticsearch_etl:9200
depends_on:
- elasticsearch_etl
networks:
- movies_api
- voice_assistant_api
etl:
platform: linux/amd64
restart: always
image: yandexmiddleteamv1/netflix-etl:latest
env_file:
- $ENV
depends_on:
elasticsearch_etl:
condition: service_healthy
redis_etl:
condition: service_started
db_admin:
condition: service_started
kibana_etl:
condition: service_started
networks:
- movies_api
- voice_assistant_api
server-auth:
platform: linux/amd64
restart: always
image: yandexmiddleteamv1/netflix-auth-api:latest
env_file:
- $ENV
ports:
- "8002:8002"
depends_on:
db-auth:
condition: service_healthy
redis-auth:
condition: service_healthy
labels:
- "traefik.enable=true"
- "traefik.http.routers.auth_api.rule=Host(`api-auth.localhost`,`traefik`)"
- "traefik.http.routers.auth_api.entrypoints=auth_api"
networks:
- movies_api
- voice_assistant_api
redis-auth:
image: redis:7.0-alpine
expose:
- 6379
volumes:
- redis_data_auth:/data
healthcheck:
test: redis-cli -p 6379 ping || exit 1
interval: 5s
timeout: 5s
retries: 5
networks:
- movies_api
- voice_assistant_api
db-auth:
image: postgres:14.2-alpine
environment:
- POSTGRES_USER=${NAA_DB_USER}
- POSTGRES_PASSWORD=${NAA_DB_PASSWORD}
- POSTGRES_DB=${NAA_DB_NAME}
ports:
- "5433:5432"
volumes:
- postgres_data_auth:/var/lib/postgresql/data/
healthcheck:
test: pg_isready -d $NAA_DB_NAME -U $NAA_DB_USER
interval: 5s
timeout: 5s
retries: 5
networks:
- movies_api
- voice_assistant_api
jaeger:
image: jaegertracing/all-in-one:latest
ports:
- "5775:5775/udp"
- "6831:6831/udp"
- "6832:6832/udp"
- "5778:5778"
- "16686:16686"
- "14268:14268"
- "14250:14250"
- "9411:9411"
depends_on:
- server-auth
networks:
- movies_api
- voice_assistant_api
volumes:
redis_master_data:
redis_slave_data:
postgres_data_admin:
redis_data_etl:
es_data_etl:
kibana_data_etl:
redis_data_auth:
postgres_data_auth:
networks:
movies_api:
name: movies_api
driver: bridge
voice_assistant_api:
external: true