-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
268 lines (268 loc) · 8.06 KB
/
docker-compose.yml
File metadata and controls
268 lines (268 loc) · 8.06 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
# Local docker compose for crypto-hack services.
services:
mongo:
image: mongo:7.0
command: ["mongod", "--replSet", "rs0", "--bind_ip_all"]
ports:
- "27017:27017"
healthcheck:
test: ["CMD", "mongosh", "--quiet", "--eval", "db.runCommand({ ping: 1 }).ok"]
interval: 5s
timeout: 5s
retries: 12
volumes:
- mongo-data:/data/db
mongo-init:
image: mongo:7.0
depends_on:
mongo:
condition: service_healthy
entrypoint:
- sh
- -c
- >
until mongosh --host mongo --quiet --eval 'db.runCommand({ ping: 1 }).ok' >/dev/null 2>&1; do
sleep 1;
done;
mongosh --host mongo --quiet --eval 'try { rs.status() } catch (e) { rs.initiate({_id:"rs0",members:[{_id:0,host:"mongo:27017"}]}); }';
i=0;
while [ "$$i" -lt 30 ]; do
state="$$(mongosh --host mongo --quiet --eval 'try { rs.status().myState } catch (e) { print(0) }')";
if [ "$$(echo "$$state" | tr -d '\r\n')" = "1" ]; then
exit 0;
fi;
sleep 1;
i=$$((i + 1));
done;
exit 1;
redis:
image: redis:7.2-alpine
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 12
auction-engine:
image: crypto-hack-auction-engine:local
build:
context: .
target: build
depends_on:
mongo-init:
condition: service_completed_successfully
redis:
condition: service_healthy
environment:
NODE_ENV: production
SERVICE_NAME: auction-engine
HTTP_PORT: "4001"
MONGO_URI: mongodb://mongo:27017/crypto_hack?replicaSet=rs0&directConnection=true
MONGO_DB: crypto_hack
REDIS_URL: redis://redis:6379
CORE_API_TOKEN: ${CORE_API_TOKEN:-dev-core-token}
RATE_LIMIT_USER_PER_SECOND: ${RATE_LIMIT_USER_PER_SECOND:-5}
RATE_LIMIT_AUCTION_USER_PER_SECOND: ${RATE_LIMIT_AUCTION_USER_PER_SECOND:-3}
RATE_LIMIT_IP_PER_SECOND: ${RATE_LIMIT_IP_PER_SECOND:-20}
command: ["npm", "run", "dev:auction-engine"]
ports:
- "4001:4001"
volumes:
- ./src:/app/src
ledger:
image: crypto-hack-ledger:local
build:
context: .
target: build
depends_on:
mongo-init:
condition: service_completed_successfully
redis:
condition: service_healthy
environment:
NODE_ENV: production
SERVICE_NAME: ledger
HTTP_PORT: "4002"
MONGO_URI: mongodb://mongo:27017/crypto_hack?replicaSet=rs0&directConnection=true
MONGO_DB: crypto_hack
REDIS_URL: redis://redis:6379
CORE_API_TOKEN: ${CORE_API_TOKEN:-dev-core-token}
command: ["npm", "run", "dev:ledger"]
ports:
- "4002:4002"
volumes:
- ./src:/app/src
crypto-gateway:
image: crypto-hack-crypto-gateway:local
build:
context: .
target: build
depends_on:
mongo-init:
condition: service_completed_successfully
redis:
condition: service_healthy
environment:
NODE_ENV: production
SERVICE_NAME: crypto-gateway
HTTP_PORT: "4003"
MONGO_URI: mongodb://mongo:27017/crypto_hack?replicaSet=rs0&directConnection=true
MONGO_DB: crypto_hack
REDIS_URL: redis://redis:6379
CORE_API_TOKEN: ${CORE_API_TOKEN:-dev-core-token}
CRYPTO_SUPPORTED_CURRENCIES: USDT
CRYPTO_WALLET_STRATEGY: memo_tag
CRYPTO_MEMO_DEPOSIT_ADDRESS: USDT:DEMO_DEPOSIT_ADDRESS
CRYPTO_HOT_WALLET_ADDRESS: USDT:DEMO_HOT_WALLET
CRYPTO_SIGNER_URL: ${CRYPTO_SIGNER_URL:-http://mock-rpc:9000}
CRYPTO_SIGNER_TOKEN: ${CRYPTO_SIGNER_TOKEN}
CRYPTO_ADMIN_TOKEN: ${CRYPTO_ADMIN_TOKEN}
CRYPTO_USD_RATES: ${CRYPTO_USD_RATES}
CRYPTO_OBSERVER_URL: ${CRYPTO_OBSERVER_URL:-http://mock-rpc:9000}
command: ["npm", "run", "dev:crypto-gateway"]
ports:
- "4003:4003"
volumes:
- ./src:/app/src
mock-rpc:
image: crypto-hack-mock-rpc:local
build:
context: .
target: build
environment:
NODE_ENV: production
SERVICE_NAME: mock-rpc
HTTP_PORT: "9000"
command: ["npm", "run", "dev:mock-rpc"]
ports:
- "9000:9000"
volumes:
- ./src:/app/src
signer:
image: crypto-hack-signer:local
build:
context: .
target: build
environment:
NODE_ENV: production
SERVICE_NAME: signer
HTTP_HOST: 0.0.0.0
HTTP_PORT: "4007"
SIGNER_API_TOKEN: ${SIGNER_API_TOKEN}
SIGNER_PRIVATE_KEY: ${SIGNER_PRIVATE_KEY:-MC4CAQAwBQYDK2VwBCIEIBpCwcU7fI9wO+CCxvkLK9SQCW9uWpNVVAvEWP56s0SX}
SIGNER_ALLOWED_IPS: ${SIGNER_ALLOWED_IPS:-*}
command: ["npm", "run", "dev:signer"]
ports:
- "4007:4007"
volumes:
- ./src:/app/src
bot:
image: crypto-hack-bot:local
build:
context: .
target: build
depends_on:
mongo-init:
condition: service_completed_successfully
redis:
condition: service_healthy
environment:
NODE_ENV: production
SERVICE_NAME: bot
HTTP_PORT: "4004"
MONGO_URI: mongodb://mongo:27017/crypto_hack?replicaSet=rs0&directConnection=true
MONGO_DB: crypto_hack
REDIS_URL: redis://redis:6379
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
TELEGRAM_API_BASE: ${TELEGRAM_API_BASE:-https://api.telegram.org}
command: ["npm", "run", "dev:bot"]
ports:
- "4004:4004"
volumes:
- ./src:/app/src
web:
image: crypto-hack-web:local
build:
context: .
target: build
depends_on:
mongo-init:
condition: service_completed_successfully
redis:
condition: service_healthy
environment:
NODE_ENV: production
SERVICE_NAME: web
HTTP_PORT: "4005"
MONGO_URI: mongodb://mongo:27017/crypto_hack?replicaSet=rs0&directConnection=true
MONGO_DB: crypto_hack
REDIS_URL: redis://redis:6379
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
TELEGRAM_API_BASE: ${TELEGRAM_API_BASE:-https://api.telegram.org}
CRYPTO_SUPPORTED_CURRENCIES: USDT
CRYPTO_WALLET_STRATEGY: memo_tag
CRYPTO_MEMO_DEPOSIT_ADDRESS: USDT:DEMO_DEPOSIT_ADDRESS
CRYPTO_SIGNER_URL: ${CRYPTO_SIGNER_URL:-http://mock-rpc:9000}
CRYPTO_SIGNER_TOKEN: ${CRYPTO_SIGNER_TOKEN}
CRYPTO_OBSERVER_URL: ${CRYPTO_OBSERVER_URL:-http://mock-rpc:9000}
WEB_ALLOWED_ORIGINS: ${WEB_ALLOWED_ORIGINS:-*}
WEB_ALLOW_DEMO_USER: ${WEB_ALLOW_DEMO_USER:-true}
command: ["npm", "run", "dev:web"]
ports:
- "4005:4005"
volumes:
- ./src:/app/src
workers:
image: crypto-hack-workers:local
build:
context: .
target: build
depends_on:
mongo-init:
condition: service_completed_successfully
redis:
condition: service_healthy
environment:
NODE_ENV: production
SERVICE_NAME: workers
HTTP_PORT: "4006"
MONGO_URI: mongodb://mongo:27017/crypto_hack?replicaSet=rs0&directConnection=true
MONGO_DB: crypto_hack
REDIS_URL: redis://redis:6379
command: ["npm", "run", "dev:workers"]
ports:
- "4006:4006"
volumes:
- ./src:/app/src
prometheus:
image: prom/prometheus:v2.47.0
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.enable-lifecycle'
volumes:
- ./docker/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
ports:
- "9090:9090"
grafana:
image: grafana/grafana:10.2.0
depends_on:
- prometheus
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Viewer
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
volumes:
- ./docker/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources:ro
- ./docker/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:ro
- ./docker/grafana/dashboards:/var/lib/grafana/dashboards:ro
- grafana-data:/var/lib/grafana
ports:
- "3001:3000"
volumes:
mongo-data:
prometheus-data:
grafana-data: