forked from juspay/hyperswitch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
297 lines (261 loc) · 6.55 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
version: "3.7"
volumes:
cargo_cache:
pg_data:
cargo_build_cache:
p_cargo_build_cache:
c_cargo_build_cache:
redisinsight_store:
networks:
router_net:
services:
promtail:
image: grafana/promtail:latest
volumes:
- ./logs:/var/log/router
- ./config:/etc/promtail
- /var/run/docker.sock:/var/run/docker.sock
command: -config.file=/etc/promtail/promtail.yaml
profiles:
- monitoring
networks:
- router_net
loki:
image: grafana/loki:latest
ports:
- "3100"
command: -config.file=/etc/loki/loki.yaml
networks:
- router_net
profiles:
- monitoring
volumes:
- ./config:/etc/loki
otel-collector:
image: otel/opentelemetry-collector-contrib:latest
command: --config=/etc/otel-collector.yaml
networks:
- router_net
profiles:
- monitoring
volumes:
- ./config/otel-collector.yaml:/etc/otel-collector.yaml
ports:
- "4317"
- "8888"
- "8889"
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
networks:
- router_net
profiles:
- monitoring
restart: unless-stopped
environment:
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_BASIC_ENABLED=false
volumes:
- ./config/grafana.ini:/etc/grafana/grafana.ini
- ./config/grafana-datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yml
pg:
image: postgres:14.5
ports:
- "5432"
networks:
- router_net
volumes:
- pg_data:/VAR/LIB/POSTGRESQL/DATA
environment:
- POSTGRES_USER=db_user
- POSTGRES_PASSWORD=db_pass
- POSTGRES_DB=hyperswitch_db
migration_runner:
image: rust:1.65
command: "bash -c 'cargo install diesel_cli --no-default-features --features \"postgres\" && diesel migration --database-url postgres://db_user:db_pass@pg:5432/hyperswitch_db run'"
working_dir: /app
networks:
- router_net
volumes:
- ./:/app
hyperswitch-server-init:
image: rust:1.65
command: cargo build --bin router
working_dir: /app
networks:
- router_net
volumes:
- ./:/app
- cargo_cache:/cargo_cache
- cargo_build_cache:/cargo_build_cache
environment:
- CARGO_TARGET_DIR=/cargo_build_cache
hyperswitch-server:
image: rust:1.65
command: /cargo_build_cache/debug/router -f ./config/docker_compose.toml
working_dir: /app
ports:
- "8080:8080"
networks:
- router_net
volumes:
- ./:/app
- cargo_cache:/cargo_cache
- cargo_build_cache:/cargo_build_cache
environment:
- CARGO_TARGET_DIR=/cargo_build_cache
- OTEL_EXPORTER_OTLP_ENDPOINT=https://otel-collector:4317
labels:
logs: "promtail"
healthcheck:
test: curl --fail http://localhost:8080/health || exit 1
interval: 100s
retries: 3
start_period: 20s
timeout: 10s
depends_on:
hyperswitch-server-init:
condition: service_completed_successfully
hyperswitch-producer:
image: rust:1.65
command: cargo run --bin scheduler -- -f ./config/docker_compose.toml
working_dir: /app
networks:
- router_net
profiles:
- scheduler
volumes:
- ./:/app
- cargo_cache:/cargo_cache
- p_cargo_build_cache:/cargo_build_cache
environment:
- CARGO_TARGET_DIR=/cargo_build_cache
- OTEL_EXPORTER_OTLP_ENDPOINT=https://otel-collector:4317
- SCHEDULER_FLOW=producer
depends_on:
hyperswitch-consumer:
condition: service_healthy
labels:
logs: "promtail"
hyperswitch-consumer:
image: rust:1.65
command: cargo run --bin scheduler -- -f ./config/docker_compose.toml
working_dir: /app
networks:
- router_net
profiles:
- scheduler
volumes:
- ./:/app
- cargo_cache:/cargo_cache
- c_cargo_build_cache:/cargo_build_cache
environment:
- CARGO_TARGET_DIR=/cargo_build_cache
- OTEL_EXPORTER_OTLP_ENDPOINT=https://otel-collector:4317
- SCHEDULER_FLOW=consumer
depends_on:
hyperswitch-server:
condition: service_started
labels:
logs: "promtail"
healthcheck:
test: (ps -e | grep scheduler) || exit 1
interval: 120s
retries: 3
start_period: 30s
timeout: 10s
redis-queue:
image: redis:7
deploy:
replicas: ${REDIS_CLUSTER_COUNT:-3}
command: redis-server /usr/local/etc/redis/redis.conf
volumes:
- ./config/redis.conf:/usr/local/etc/redis/redis.conf
labels:
- redis
networks:
- router_net
ports:
- "6379"
- "16379"
redis-init:
image: redis:7
depends_on:
- redis-queue
networks:
- router_net
command: "bash -c 'export COUNT=${REDIS_CLUSTER_COUNT:-3}
\ if [ $$COUNT -lt 3 ]
\ then
\ echo \"Minimum 3 nodes are needed for redis cluster\"
\ exit 1
\ fi
\ HOSTS=\"\"
\ for ((c=1; c<=$$COUNT;c++))
\ do
\ NODE=$COMPOSE_PROJECT_NAME-redis-queue-$$c:6379
\ echo $$NODE
\ HOSTS=\"$$HOSTS $$NODE\"
\ done
\ echo Creating a cluster with $$HOSTS
\ redis-cli --cluster create $$HOSTS --cluster-yes
\ '"
redis-insight:
image: redislabs/redisinsight:latest
networks:
- router_net
profiles:
- full_kv
ports:
- "8001:8001"
volumes:
- redisinsight_store:/db
prometheus:
image: prom/prometheus:latest
networks:
- router_net
profiles:
- monitoring
volumes:
- ./config/prometheus.yaml:/etc/prometheus/prometheus.yml
ports:
- "9090"
restart: unless-stopped
tempo:
image: grafana/tempo:latest
command: -config.file=/etc/tempo.yaml
volumes:
- ./config/tempo.yaml:/etc/tempo.yaml
networks:
- router_net
profiles:
- monitoring
ports:
- "3200" # tempo
- "4317" # otlp grpc
restart: unless-stopped
hyperswitch-drainer:
image: rust:1.65
command: cargo run --bin drainer -- -f ./config/docker_compose.toml
working_dir: /app
deploy:
replicas: ${DRAINER_INSTANCE_COUNT:-1}
networks:
- router_net
profiles:
- full_kv
volumes:
- ./:/app
- cargo_cache:/cargo_cache
- cargo_build_cache:/cargo_build_cache
environment:
- CARGO_TARGET_DIR=/cargo_build_cache
- OTEL_EXPORTER_OTLP_ENDPOINT=https://otel-collector:4317
restart: unless-stopped
depends_on:
hyperswitch-server:
condition: service_started
labels:
logs: "promtail"