-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
514 lines (494 loc) · 13.5 KB
/
docker-compose.yaml
File metadata and controls
514 lines (494 loc) · 13.5 KB
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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
services:
# ==========================================
# Decision Engine Runtime (GHCR Images)
# ==========================================
open-router-pg-ghcr:
image: ghcr.io/juspay/decision-engine/postgres:${DECISION_ENGINE_TAG:-v1.4}
pull_policy: always
platform: linux/amd64
profiles:
- postgres-ghcr
- dashboard-postgres-ghcr
restart: unless-stopped
ports:
- "8080:8080"
- "9094:9094"
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
db-migrator-postgres:
condition: service_completed_successfully
clickhouse:
condition: service_healthy
kafka:
condition: service_healthy
kafka-init:
condition: service_completed_successfully
volumes:
- ./config/docker-configuration.toml:/local/config/development.toml
networks:
open-router-network:
aliases:
- decision-engine-api
environment:
- GROOVY_RUNNER_HOST=host.docker.internal:8085
open-router-mysql-ghcr:
image: ghcr.io/juspay/decision-engine:${DECISION_ENGINE_TAG:-v1.4}
pull_policy: always
platform: linux/amd64
profiles:
- mysql-ghcr
- dashboard-mysql-ghcr
restart: unless-stopped
ports:
- "8080:8080"
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
routing-config:
condition: service_completed_successfully
db-migrator:
condition: service_completed_successfully
clickhouse:
condition: service_healthy
kafka:
condition: service_healthy
kafka-init:
condition: service_completed_successfully
volumes:
- ./config/docker-configuration.toml:/local/config/development.toml
networks:
open-router-network:
aliases:
- decision-engine-api
environment:
- GROOVY_RUNNER_HOST=host.docker.internal:8085
# ==========================================
# Decision Engine Runtime (Local Build)
# ==========================================
open-router-pg-local:
build:
context: .
dockerfile: Dockerfile.postgres
platforms:
- linux/amd64
image: decision-engine-pg:local
platform: linux/amd64
profiles:
- postgres-local
- dashboard-postgres-local
restart: unless-stopped
ports:
- "8080:8080"
- "9094:9094"
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
db-migrator-postgres:
condition: service_completed_successfully
clickhouse:
condition: service_healthy
kafka:
condition: service_healthy
kafka-init:
condition: service_completed_successfully
volumes:
- ./config/docker-configuration.toml:/local/config/development.toml
networks:
open-router-network:
aliases:
- decision-engine-api
environment:
- GROOVY_RUNNER_HOST=host.docker.internal:8085
open-router-mysql-local:
build:
context: .
dockerfile: Dockerfile
platforms:
- linux/amd64
image: decision-engine-mysql:local
platform: linux/amd64
profiles:
- mysql-local
- dashboard-mysql-local
restart: unless-stopped
ports:
- "8080:8080"
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
routing-config:
condition: service_completed_successfully
db-migrator:
condition: service_completed_successfully
clickhouse:
condition: service_healthy
kafka:
condition: service_healthy
kafka-init:
condition: service_completed_successfully
volumes:
- ./config/docker-configuration.toml:/local/config/development.toml
networks:
open-router-network:
aliases:
- decision-engine-api
environment:
- GROOVY_RUNNER_HOST=host.docker.internal:8085
# ==========================================
# Dashboard and Docs
# ==========================================
nginx:
image: nginx:alpine
profiles:
- dashboard-postgres-ghcr
- dashboard-postgres-local
- dashboard-mysql-ghcr
- dashboard-mysql-local
restart: unless-stopped
ports:
- "8081:80"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./website/dist:/usr/share/nginx/html/dashboard:ro
depends_on:
mintlify-docs:
condition: service_healthy
networks:
- open-router-network
mintlify-docs:
build:
context: .
dockerfile: Dockerfile.docs
profiles:
- dashboard-postgres-ghcr
- dashboard-postgres-local
- dashboard-mysql-ghcr
- dashboard-mysql-local
restart: unless-stopped
expose:
- "3000"
networks:
- open-router-network
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:3000 > /dev/null 2>&1 || exit 1"]
interval: 10s
timeout: 10s
retries: 10
start_period: 60s
# ==========================================
# Supporting Services
# ==========================================
prometheus:
image: prom/prometheus:latest
profiles:
- monitoring
networks:
- open-router-network
volumes:
- ./config/prometheus.yaml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
restart: unless-stopped
grafana:
image: grafana/grafana:latest
profiles:
- monitoring
ports:
- "3000:3000"
networks:
- open-router-network
restart: unless-stopped
environment:
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_BASIC_ENABLED=false
volumes:
- ./config/grafana-datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yml
groovy-runner-ghcr:
image: ghcr.io/juspay/decision-engine/groovy-runner:${GROOVY_RUNNER_TAG:-v1.4}
pull_policy: always
platform: linux/amd64
profiles:
- groovy-ghcr
restart: unless-stopped
ports:
- "8085:8085"
networks:
- open-router-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8085/health"]
interval: 5s
timeout: 5s
retries: 5
start_period: 10s
groovy-runner-local:
build:
context: .
dockerfile: groovy.Dockerfile
args:
- BUILDKIT_INLINE_CACHE=1
cache_from:
- decision-engine-groovy-runner-local:latest
labels:
- "com.docker.compose.watchfile=groovy.Dockerfile"
- "com.docker.compose.watchfile=src/Runner.groovy"
image: decision-engine-groovy-runner:local
platform: linux/amd64
profiles:
- groovy-local
restart: unless-stopped
ports:
- "8085:8085"
networks:
- open-router-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8085/health"]
interval: 5s
timeout: 5s
retries: 5
start_period: 10s
kafka:
image: apache/kafka:3.8.1
profiles:
- postgres-ghcr
- dashboard-postgres-ghcr
- postgres-local
- dashboard-postgres-local
- mysql-ghcr
- dashboard-mysql-ghcr
- mysql-local
- dashboard-mysql-local
- analytics-clickhouse
restart: unless-stopped
ports:
- "9092:9092"
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_LISTENERS: PLAINTEXT://:19092,EXTERNAL://:9092,CONTROLLER://:9093
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:19092,EXTERNAL://localhost:9092
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,EXTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
networks:
- open-router-network
healthcheck:
test:
[
"CMD-SHELL",
"/opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --list > /dev/null 2>&1",
]
interval: 10s
timeout: 10s
retries: 10
start_period: 20s
kafka-init:
image: apache/kafka:3.8.1
profiles:
- postgres-ghcr
- dashboard-postgres-ghcr
- postgres-local
- dashboard-postgres-local
- mysql-ghcr
- dashboard-mysql-ghcr
- mysql-local
- dashboard-mysql-local
- analytics-clickhouse
depends_on:
kafka:
condition: service_healthy
networks:
- open-router-network
entrypoint:
- /bin/bash
- -lc
- |
/opt/kafka/bin/kafka-topics.sh --bootstrap-server kafka:19092 --create --if-not-exists --topic api --partitions 4 --replication-factor 1
/opt/kafka/bin/kafka-topics.sh --bootstrap-server kafka:19092 --create --if-not-exists --topic domain --partitions 4 --replication-factor 1
clickhouse:
image: clickhouse/clickhouse-server:26.1
profiles:
- postgres-ghcr
- dashboard-postgres-ghcr
- postgres-local
- dashboard-postgres-local
- mysql-ghcr
- dashboard-mysql-ghcr
- mysql-local
- dashboard-mysql-local
- analytics-clickhouse
restart: unless-stopped
ports:
- "8123:8123"
- "9000:9000"
environment:
CLICKHOUSE_DB: default
CLICKHOUSE_USER: decision_engine
CLICKHOUSE_PASSWORD: decision_engine
ANALYTICS_KAFKA_BROKERS: kafka:19092
ANALYTICS_KAFKA_API_TOPIC: api
ANALYTICS_KAFKA_DOMAIN_TOPIC: domain
depends_on:
kafka-init:
condition: service_completed_successfully
networks:
- open-router-network
volumes:
- clickhouse-data:/var/lib/clickhouse
- ./clickhouse/scripts:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:8123/ping | grep -q Ok"]
interval: 10s
timeout: 5s
retries: 10
start_period: 20s
# ==========================================
# Core Infrastructure
# ==========================================
mysql:
image: mysql:8.0
profiles:
- mysql-ghcr
- dashboard-mysql-ghcr
- mysql-local
- dashboard-mysql-local
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: jdb
MYSQL_USER: db_user
MYSQL_PASSWORD: db_pass
ports:
- "3306:3306"
volumes:
- mysql-data:/var/lib/mysql
networks:
- open-router-network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-proot"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
postgresql:
image: postgres:16
profiles:
- postgres-ghcr
- dashboard-postgres-ghcr
- postgres-local
- dashboard-postgres-local
restart: unless-stopped
environment:
POSTGRES_USER: db_user
POSTGRES_PASSWORD: db_pass
POSTGRES_DB: decision_engine_db
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql
networks:
- open-router-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U db_user -d decision_engine_db"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
redis:
image: redis:7-alpine
profiles:
- postgres-ghcr
- dashboard-postgres-ghcr
- postgres-local
- dashboard-postgres-local
- mysql-ghcr
- dashboard-mysql-ghcr
- mysql-local
- dashboard-mysql-local
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis-data:/data
networks:
- open-router-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
db-migrator:
image: mysql:8.0
profiles:
- mysql-ghcr
- dashboard-mysql-ghcr
- mysql-local
- dashboard-mysql-local
depends_on:
mysql:
condition: service_healthy
volumes:
- ./migrations:/app/migrations
working_dir: /app
entrypoint: ["/bin/sh", "-c", "for sql_file in $$(find /app/migrations -name 'up.sql' -type f | sort); do echo \"Running migration: $$sql_file\"; mysql -h mysql -uroot -proot jdb < \"$$sql_file\"; done"]
networks:
- open-router-network
db-migrator-postgres:
image: rust:latest
profiles:
- postgres-ghcr
- dashboard-postgres-ghcr
- postgres-local
- dashboard-postgres-local
depends_on:
postgresql:
condition: service_healthy
environment:
- PGPASSWORD=db_pass
- DATABASE_URL=postgresql://db_user:db_pass@postgresql:5432/decision_engine_db
volumes:
- .:/app
working_dir: /app
command: "bash -c 'cargo install diesel_cli --no-default-features --features postgres && diesel migration run --database-url \"$$DATABASE_URL\" --migration-dir /app/migrations_pg --config-file /app/diesel_pg.toml'"
networks:
- open-router-network
routing-config:
image: python:3.10-slim
profiles:
- mysql-ghcr
- dashboard-mysql-ghcr
- mysql-local
- dashboard-mysql-local
depends_on:
mysql:
condition: service_healthy
volumes:
- ./routing-config:/app
working_dir: /app
command: bash run_setup.sh
networks:
- open-router-network
networks:
open-router-network:
driver: bridge
volumes:
mysql-data:
redis-data:
postgres-data:
clickhouse-data: