-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yml
More file actions
308 lines (291 loc) · 9.14 KB
/
compose.yml
File metadata and controls
308 lines (291 loc) · 9.14 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
services:
### -- Service Bundles -- Start Here -- ###
all:
image: alpine
depends_on:
evm:
condition: service_healthy
deploy:
condition: service_completed_successfully
subgraph:
condition: service_completed_successfully
subgraph-node:
condition: service_healthy
postgres:
condition: service_healthy
ipfs:
condition: service_healthy
command: tail -f /dev/null
# Blockchain
evm:
image: ghcr.io/foundry-rs/foundry
working_dir: /anvil
volumes:
- ./:/app
ports:
- '8545:8545'
environment:
ANVIL_IP_ADDR: '0.0.0.0'
command: anvil --gas-limit 100000000 --host 0.0.0.0
healthcheck:
test: ["CMD-SHELL", "cast rpc eth_chainId --rpc-url http://127.0.0.1:8545 || exit 1"]
interval: 5s
timeout: 5s
retries: 10
deploy:
image: node:22
working_dir: /app
volumes:
- ./:/app
command:
- /bin/sh
- -c
- |
npx hardhat ignition deploy evm/modules/00_MockDependencies.ts --network compose --build-profile=default
npx hardhat run evm/ignition/localparams.ts --network compose
npx hardhat ignition deploy evm/modules/01_Market.ts --parameters evm/ignition/parameters/localhost.json --network compose --build-profile=default
depends_on:
evm:
condition: service_healthy
# Subgraph Stack
subgraph:
image: node:20
working_dir: /app
volumes:
- ./:/app
command:
- /bin/sh
- -c
- |
npm run subgraph:codegen
npx tsx subgraph/generate-networks.json.ts
npx graph create -g http://subgraph-node:8020 hardhat
npx graph deploy hardhat subgraph/subgraph.yaml --network 31337 -g http://subgraph-node:8020 --ipfs http://ipfs:5001 -l v0.0.1 --network-file subgraph/networks.json -o .cache/subgraph/build
echo "Waiting for subgraph to sync..."
node -e "
const url = 'http://subgraph-node:8030/graphql';
const query = { query: '{ indexingStatuses { synced } }' };
const poll = async () => {
while(true) {
try {
const res = await fetch(url, { method: 'POST', body: JSON.stringify(query), headers: { 'Content-Type': 'application/json' } });
const json = await res.json();
console.log(JSON.stringify(json));
const status = json?.data?.indexingStatuses?.[0];
if (status) {
if (status.synced) {
console.log('Subgraph successfully synced!');
process.exit(0);
}
}
} catch (e) {}
await new Promise(r => setTimeout(r, 2000));
}
};
poll();
"
depends_on:
subgraph-node:
condition: service_healthy
deploy:
condition: service_completed_successfully
# Frontend Dev Web Server
web:
image: node:20
working_dir: /app
volumes:
- ./:/app
ports:
- '5173:5173'
environment:
- HOST=0.0.0.0
command: npm run dev -- --host
depends_on:
evm:
condition: service_healthy
subgraph-node:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:5173/ || exit 1"]
interval: 5s
timeout: 5s
retries: 20
blockscout:
depends_on:
redis-db:
condition: service_healthy
blockscout-user-ops-indexer:
condition: service_started
blockscout-sig-provider:
condition: service_started
blockscout-visualizer:
condition: service_started
blockscout-backend:
condition: service_healthy
blockscout-frontend:
condition: service_healthy
image: nginx
ports:
- "80:80"
volumes:
- "./blockscout/docker-compose/proxy/explorer.conf.template:/etc/nginx/templates/default.conf.template"
environment:
BACK_PROXY_PASS: 'http://blockscout-backend:4000'
FRONT_PROXY_PASS: 'http://blockscout-frontend:3000'
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost/ || wget -qO- http://localhost/ || exit 1"]
interval: 5s
timeout: 5s
retries: 5
# --- Subservices (runs automatically by compose) ---
subgraph-node:
image: graphprotocol/graph-node:v0.35.0
ports:
- '8000:8000'
- '8001:8001'
- '8020:8020'
- '8030:8030'
- '8040:8040'
depends_on:
ipfs:
condition: service_healthy
postgres:
condition: service_healthy
evm:
condition: service_healthy
environment:
node_id: default
ipfs: 'ipfs:5001'
postgres_host: postgres
postgres_user: graph-node
postgres_pass: let-me-in
postgres_db: graph-node
ethereum: '31337:http://evm:8545'
GRAPH_LOG: debug
healthcheck:
test: [ "CMD-SHELL", "nc -w0 localhost 8020" ]
interval: 5s
timeout: 2s
retries: 3
start_period: 20s
blockscout-backend:
depends_on:
redis-db:
condition: service_healthy
postgres:
condition: service_healthy
image: ghcr.io/blockscout/blockscout:latest
stop_grace_period: 5m
command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
env_file:
- ./blockscout/docker-compose/envs/common-blockscout.env
volumes:
- blockscout:/app/logs/
- blockscout:/app/dets/
environment:
DATABASE_URL: "postgresql://graph-node:let-me-in@postgres:5432/blockscout"
ETHEREUM_JSONRPC_VARIANT: 'anvil'
ETHEREUM_JSONRPC_HTTP_URL: 'http://evm:8545/'
ETHEREUM_JSONRPC_WS_URL: 'ws://evm:8545/'
ETHEREUM_JSONRPC_TRACE_URL: 'http://evm:8545/'
CHAIN_ID: '31337'
POOL_SIZE: 5
POOL_SIZE_API: 2
INDEXER_CATCHUP_BLOCKS_CONCURRENCY: 1
INDEXER_RECEIPTS_CONCURRENCY: 1
INDEXER_INTERNAL_TRANSACTIONS_CONCURRENCY: 1
INDEXER_TOKEN_BALANCES_CONCURRENCY: 1
INDEXER_COIN_BALANCES_CONCURRENCY: 1
INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER: 'false'
INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER: 'true'
NFT_MEDIA_HANDLER_ENABLED: 'false'
TXS_STATS_ENABLED: 'false'
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:4000/api/v2/stats || wget -qO- http://localhost:4000/api/v2/stats || exit 1"]
interval: 5s
timeout: 5s
retries: 5
start_period: 2m
blockscout-frontend:
image: ghcr.io/blockscout/frontend:latest
platform: linux/amd64
env_file:
- ./blockscout/docker-compose/envs/common-frontend.env
depends_on:
blockscout-backend:
condition: service_healthy
environment:
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID: ${WALLET_CONNECT_PROJECT_ID}
NEXT_PUBLIC_NETWORK_RPC_URL: 'http://localhost:8545'
NEXT_PUBLIC_AD_BANNER_PROVIDER: none
NEXT_PUBLIC_NETWORK_NAME: localhost
NEXT_PUBLIC_NETWORK_SHORT_NAME: localhost
NEXT_PUBLIC_HOMEPAGE_CHARTS: '[]'
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:3000/ || wget -qO- http://localhost:3000/ || exit 1"]
interval: 5s
timeout: 5s
retries: 5
blockscout-visualizer:
image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest}
platform: linux/amd64
env_file:
- ./blockscout/docker-compose/envs/common-visualizer.env
blockscout-sig-provider:
image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-latest}
platform: linux/amd64
blockscout-user-ops-indexer:
depends_on:
blockscout-backend:
condition: service_healthy
image: ghcr.io/blockscout/user-ops-indexer:${USER_OPS_INDEXER_DOCKER_TAG:-latest}
platform: linux/amd64
env_file:
- ./blockscout/docker-compose/envs/common-user-ops-indexer.env
environment:
USER_OPS_INDEXER__INDEXER__RPC_URL: 'ws://evm:8545/'
USER_OPS_INDEXER__DATABASE__CONNECT__URL: "postgresql://graph-node:let-me-in@postgres:5432/blockscout"
USER_OPS_INDEXER__DATABASE__RUN_MIGRATIONS: true
redis-db:
image: 'redis:alpine'
command: redis-server
volumes:
- blockscout:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
postgres:
image: postgres:17
ports:
- '5432:5432'
command: ['postgres', '-cshared_preload_libraries=pg_stat_statements', '-cmax_connections=200']
environment:
POSTGRES_USER: graph-node
POSTGRES_PASSWORD: let-me-in
POSTGRES_DB: graph-node
POSTGRES_INITDB_ARGS: '-E UTF8 --locale=C'
volumes:
# Postgres uses /var/lib/postgresql/data. Data will be stored in volume root under 'data/'
- subgraph:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U graph-node -d graph-node"]
interval: 5s
timeout: 5s
retries: 5
ipfs:
image: ipfs/kubo:v0.17.0
ports:
- '5001:5001'
volumes:
# IPFS uses /data/ipfs. Data will be stored in volume root under 'ipfs/'
- subgraph:/data
healthcheck:
test: ["CMD", "ipfs", "id"]
interval: 5s
timeout: 5s
retries: 5
volumes:
subgraph:
blockscout: