-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathzk-chains-docker-compose.yml
402 lines (358 loc) · 11.2 KB
/
zk-chains-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
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
# This docker compose is setting up the full ZK Chains network, consisting of:
#
# - L1 (reth) with explorer (blockscout)
# - a single postgres (with all the databases)
# - 3 zksync chains (with ids 270, 272, 273) - 'master', 'custombase', 'validium'
# - together with their explorers
# - hyperexplorer to merge it all together.
# Ports:
#
# - hyperexplorer: http://localhost:15000
# - l1 explorer: http://localhost:15001 (also using 15001, 15002, 15003)
# - l2 explorer: http://localhost:15005 (for all the chains)
# - L1 chain (reth): 15045
# - L2 chains (each next chain is +100 for ports)
# - 15100 - http
# - 15101 - ws
# - 15102 - explorer api
#
# So 15100 - 'master', 15200 - 'custombase', 15300 - 'validium'
# Database is on 15432
# pgAdmin to manage PostgreSQL DB is on 15430
services:
reth:
restart: always
image: "ghcr.io/paradigmxyz/reth:v0.2.0-beta.2"
volumes:
- type: bind
source: ./reth_chaindata
target: /chaindata
command: node --dev --datadir /rethdata --http --http.corsdomain "*" --http.addr 0.0.0.0 --http.port 8545 --dev.block-time 300ms --chain /chaindata/reth_config
environment:
- RUST_LOG=warn
ports:
- 127.0.0.1:15045:8545
postgres:
image: "postgres:14"
shm_size: 256m
# To create necessary databases for block explorer.
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
command: postgres -c 'max_connections=400'
ports:
- 127.0.0.1:15432:5432
environment:
# We bind only to 127.0.0.1, so setting insecure password is acceptable here
- POSTGRES_PASSWORD=notsecurepassword
pgadmin4:
image: dcagatay/pwless-pgadmin4:latest
ports:
- 127.0.0.1:15430:80
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: notsecurepassword
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
restart: unless-stopped
# Master node - that will create the ZK Chain
zksync:
stdin_open: true
tty: true
image: matterlabs/local-node:hyperlocal
healthcheck:
test: curl --fail http://localhost:3071/health || exit 1
interval: 10s
timeout: 5s
retries: 200
start_period: 30s
volumes:
- shared_config:/etc/env/target
- shared_tokens:/etc/tokens
depends_on:
- reth
- postgres
ports:
- 127.0.0.1:15100:3050 # JSON RPC HTTP port
- 127.0.0.1:15101:3051 # JSON RPC WS port
environment:
- DATABASE_PROVER_URL=postgres://postgres:notsecurepassword@postgres/prover_local
- DATABASE_URL=postgres://postgres:notsecurepassword@postgres/zksync_local
- ETH_CLIENT_WEB3_URL=http://reth:8545
- LEGACY_BRIDGE_TESTING=1
zksync_custombase:
stdin_open: true
tty: true
image: matterlabs/local-node:hyperlocal
depends_on:
reth:
condition: service_started
postgres:
condition: service_started
zksync:
condition: service_healthy
healthcheck:
test: curl --fail http://localhost:3071/health || exit 1
interval: 10s
timeout: 5s
retries: 200
start_period: 30s
volumes:
- shared_config:/etc/master_env
- shared_tokens:/etc/tokens:ro
ports:
- 127.0.0.1:15200:3050 # JSON RPC HTTP port
- 127.0.0.1:15201:3051 # JSON RPC WS port
environment:
- DATABASE_PROVER_URL=postgres://postgres:notsecurepassword@postgres/prover_custombase
- DATABASE_URL=postgres://postgres:notsecurepassword@postgres/zksync_custombase
- ETH_CLIENT_WEB3_URL=http://reth:8545
- CHAIN_ETH_ZKSYNC_NETWORK_ID=272
- IN_DOCKER=true
- MASTER_URL=http://zksync:3050
- MASTER_HEALTH_URL=http://zksync:3071/health
- MASTER_ENV_FILE=/etc/master_env/dev.env
- CUSTOM_BASE_TOKEN=BAT
zksync_validium:
stdin_open: true
tty: true
image: matterlabs/local-node:hyperlocal
depends_on:
reth:
condition: service_started
postgres:
condition: service_started
zksync:
condition: service_healthy
zksync_custombase: # daisy chain
condition: service_healthy
healthcheck:
test: curl --fail http://localhost:3071/health || exit 1
interval: 10s
timeout: 5s
retries: 200
start_period: 30s
volumes:
- shared_config:/etc/master_env
- shared_tokens:/etc/tokens:ro
ports:
- 127.0.0.1:15300:3050 # JSON RPC HTTP port
- 127.0.0.1:15301:3051 # JSON RPC WS port
environment:
- DATABASE_PROVER_URL=postgres://postgres:notsecurepassword@postgres/prover_validium
- DATABASE_URL=postgres://postgres:notsecurepassword@postgres/zksync_validium
- ETH_CLIENT_WEB3_URL=http://reth:8545
- CHAIN_ETH_ZKSYNC_NETWORK_ID=273
- IN_DOCKER=true
- MASTER_URL=http://zksync:3050
- MASTER_HEALTH_URL=http://zksync_custombase:3071/health ## daisy chain
- MASTER_ENV_FILE=/etc/master_env/dev.env
- CHAIN_STATE_KEEPER_L1_BATCH_COMMIT_DATA_GENERATOR_MODE=Validium
- VALIDIUM_MODE=1
data-fetcher_main:
platform: linux/amd64
image: "matterlabs/block-explorer-data-fetcher:latest"
environment:
- PORT=3040
- LOG_LEVEL=verbose
- NODE_ENV=development
- BLOCKCHAIN_RPC_URL=http://zksync:3050
restart: unless-stopped
data-fetcher_custombase:
platform: linux/amd64
image: "matterlabs/block-explorer-data-fetcher:latest"
environment:
- PORT=3040
- LOG_LEVEL=verbose
- NODE_ENV=development
- BLOCKCHAIN_RPC_URL=http://zksync_custombase:3050
restart: unless-stopped
data-fetcher_validium:
platform: linux/amd64
image: "matterlabs/block-explorer-data-fetcher:latest"
environment:
- PORT=3040
- LOG_LEVEL=verbose
- NODE_ENV=development
- BLOCKCHAIN_RPC_URL=http://zksync_validium:3050
restart: unless-stopped
worker_main:
platform: linux/amd64
image: "matterlabs/block-explorer-worker:latest"
environment:
- PORT=3001
- LOG_LEVEL=verbose
- NODE_ENV=development
- DATABASE_HOST=postgres
- DATABASE_USER=postgres
- DATABASE_PASSWORD=notsecurepassword
- DATABASE_NAME=block-explorer
- BLOCKCHAIN_RPC_URL=http://zksync:3050
- DATA_FETCHER_URL=http://data-fetcher_main:3040
- BATCHES_PROCESSING_POLLING_INTERVAL=1000
restart: unless-stopped
worker_custombase:
platform: linux/amd64
image: "matterlabs/block-explorer-worker:latest"
environment:
- PORT=3001
- LOG_LEVEL=verbose
- NODE_ENV=development
- DATABASE_HOST=postgres
- DATABASE_USER=postgres
- DATABASE_PASSWORD=notsecurepassword
- DATABASE_NAME=block-explorer_custombase
- BLOCKCHAIN_RPC_URL=http://zksync_custombase:3050
- DATA_FETCHER_URL=http://data-fetcher_custombase:3040
- BATCHES_PROCESSING_POLLING_INTERVAL=1000
restart: unless-stopped
worker_validium:
platform: linux/amd64
image: "matterlabs/block-explorer-worker:latest"
environment:
- PORT=3001
- LOG_LEVEL=verbose
- NODE_ENV=development
- DATABASE_HOST=postgres
- DATABASE_USER=postgres
- DATABASE_PASSWORD=notsecurepassword
- DATABASE_NAME=block-explorer_validium
- BLOCKCHAIN_RPC_URL=http://zksync_validium:3050
- DATA_FETCHER_URL=http://data-fetcher_validium:3040
- BATCHES_PROCESSING_POLLING_INTERVAL=1000
restart: unless-stopped
api_main:
platform: linux/amd64
image: "matterlabs/block-explorer-api:latest"
environment:
- PORT=3020
- METRICS_PORT=3005
- LOG_LEVEL=verbose
- NODE_ENV=development
- DATABASE_URL=postgres://postgres:notsecurepassword@postgres:5432/block-explorer
ports:
- '127.0.0.1:15102:3020'
depends_on:
- worker_main
restart: unless-stopped
api_custombase:
platform: linux/amd64
image: "matterlabs/block-explorer-api:latest"
environment:
- PORT=3020
- METRICS_PORT=3005
- LOG_LEVEL=verbose
- NODE_ENV=development
- DATABASE_URL=postgres://postgres:notsecurepassword@postgres:5432/block-explorer_custombase
ports:
- '127.0.0.1:15202:3020'
depends_on:
- worker_custombase
restart: unless-stopped
api_validium:
platform: linux/amd64
image: "matterlabs/block-explorer-api:latest"
environment:
- PORT=3020
- METRICS_PORT=3005
- LOG_LEVEL=verbose
- NODE_ENV=development
- DATABASE_URL=postgres://postgres:notsecurepassword@postgres:5432/block-explorer_validium
ports:
- '127.0.0.1:15302:3020'
depends_on:
- worker_validium
restart: unless-stopped
app:
platform: linux/amd64
image: "matterlabs/block-explorer-app:latest"
volumes:
# This is super hacky - we should have a better solution.
- ./explorer_mapping.js:/usr/src/app/packages/app/dist/assets/dev.config.4e99e047.js
ports:
- '127.0.0.1:15005:3010'
depends_on:
- api_main
- api_custombase
- api_validium
restart: unless-stopped
## Blockscout
redis-db:
image: 'redis:alpine'
command: redis-server
backend:
depends_on:
- postgres
- redis-db
image: blockscout/blockscout:latest
restart: always
stop_grace_period: 5m
command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
env_file:
- blockscout/common-blockscout.env
links:
- postgres:database
environment:
- ETHEREUM_JSONRPC_VARIANT=geth
- DATABASE_URL=postgresql://postgres:notsecurepassword@postgres:5432/blockscout
- ETHEREUM_JSONRPC_HTTP_URL=http://reth:8545
- ETHEREUM_JSONRPC_TRACE_URL=http://reth:8545
frontend:
depends_on:
- backend
image: ghcr.io/blockscout/frontend:latest
platform: linux/amd64
restart: always
env_file:
- blockscout/common-frontend.env
stats:
depends_on:
- backend
image: ghcr.io/blockscout/stats:latest
platform: linux/amd64
restart: always
env_file:
- blockscout/common-stats.env
environment:
- STATS__DB_URL=postgresql://postgres:notsecurepassword@postgres:5432/blockscout_stats
- STATS__BLOCKSCOUT_DB_URL=postgresql://postgres:notsecurepassword@postgres:5432/blockscout
- STATS__CREATE_DATABASE=true
- STATS__RUN_MIGRATIONS=true
proxy:
depends_on:
- backend
- frontend
- stats
image: nginx
volumes:
- "./blockscout/proxy:/etc/nginx/templates"
environment:
BACK_PROXY_PASS: http://backend:4000
FRONT_PROXY_PASS: http://frontend:3000
ports:
- target: 80
published: 15001
- target: 8080
published: 15002
- target: 8081
published: 15003
sig-provider:
image: ghcr.io/blockscout/sig-provider:latest
platform: linux/amd64
restart: always
hyperexplorer:
depends_on:
zksync:
condition: service_healthy
zksync_validium:
condition: service_healthy
zksync_custombase:
condition: service_healthy
image: ghcr.io/mm-zk/zksync_tools:latest
ports:
- 127.0.0.1:15000:5000
volumes:
- ./hyperexplorer.json:/app/operator/config.json
volumes:
reth:
shared_config:
shared_tokens: