forked from 0xPolygonHermez/blockscout
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
612 lines (587 loc) · 22.9 KB
/
Makefile
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
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
SYSTEM := $(shell uname -s)
HOST := host.docker.internal
DOCKER_REPO := scmorgan
APP_NAME := sc-hermez-zkevm-explorer
BS_CONTAINER_IMAGE := $(DOCKER_REPO)/$(APP_NAME)
BS_CONTAINER_NAME := blockscout
PG_CONTAINER_IMAGE := postgres:14
PG_CONTAINER_NAME := db
THIS_FILE = $(lastword $(MAKEFILE_LIST))
TAG := $(RELEASE_VERSION)-prerelease-$(shell git log -1 --pretty=format:"%h")
STABLE_TAG := $(RELEASE_VERSION)
ifeq ($(SYSTEM), Linux)
HOST=localhost
endif
ifdef DATABASE_URL
DB_URL = $(DATABASE_URL)
else
DB_URL = postgresql://postgres:@$(HOST):5432/blockscout?ssl=false
ECTO_USE_SSL = 'false'
endif
BLOCKSCOUT_CONTAINER_PARAMS = -e 'MIX_ENV=prod' \
-e 'DATABASE_URL=$(DB_URL)'
ifeq ($(SYSTEM), Linux)
BLOCKSCOUT_CONTAINER_PARAMS += --network=host
endif
ifdef NETWORK
BLOCKSCOUT_CONTAINER_PARAMS += -e 'NETWORK=$(NETWORK)'
endif
ifdef SUBNETWORK
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SUBNETWORK=$(SUBNETWORK)'
endif
ifdef LOGO
BLOCKSCOUT_CONTAINER_PARAMS += -e 'LOGO=$(LOGO)'
endif
ifdef LOGO_FOOTER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'LOGO_FOOTER=$(LOGO_FOOTER)'
endif
ifdef ETHEREUM_JSONRPC_VARIANT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ETHEREUM_JSONRPC_VARIANT=$(ETHEREUM_JSONRPC_VARIANT)'
endif
ifdef ETHEREUM_JSONRPC_HTTP_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ETHEREUM_JSONRPC_HTTP_URL=$(ETHEREUM_JSONRPC_HTTP_URL)'
endif
ifdef ETHEREUM_JSONRPC_TRACE_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ETHEREUM_JSONRPC_TRACE_URL=$(ETHEREUM_JSONRPC_TRACE_URL)'
endif
ifdef ETHEREUM_JSONRPC_WS_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ETHEREUM_JSONRPC_WS_URL=$(ETHEREUM_JSONRPC_WS_URL)'
endif
ifdef ETHEREUM_JSONRPC_TRANSPORT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ETHEREUM_JSONRPC_TRANSPORT=$(ETHEREUM_JSONRPC_TRANSPORT)'
endif
ifdef ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES=$(ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES)'
endif
ifdef IPC_PATH
BLOCKSCOUT_CONTAINER_PARAMS += -e 'IPC_PATH=$(IPC_PATH)'
endif
ifdef NETWORK_PATH
BLOCKSCOUT_CONTAINER_PARAMS += -e 'NETWORK_PATH=$(NETWORK_PATH)'
endif
ifdef CHECK_ORIGIN
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CHECK_ORIGIN=$(CHECK_ORIGIN)'
endif
ifdef COIN
BLOCKSCOUT_CONTAINER_PARAMS += -e 'COIN=$(COIN)'
endif
ifdef METADATA_CONTRACT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'METADATA_CONTRACT=$(METADATA_CONTRACT)'
endif
ifdef VALIDATORS_CONTRACT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'VALIDATORS_CONTRACT=$(VALIDATORS_CONTRACT)'
endif
ifdef KEYS_MANAGER_CONTRACT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'KEYS_MANAGER_CONTRACT=$(KEYS_MANAGER_CONTRACT)'
endif
ifdef SUPPLY_MODULE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SUPPLY_MODULE=$(SUPPLY_MODULE)'
endif
ifdef POOL_SIZE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'POOL_SIZE=$(POOL_SIZE)'
endif
ifdef ECTO_USE_SSL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ECTO_USE_SSL=$(ECTO_USE_SSL)'
endif
ifdef DATADOG_HOST
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DATADOG_HOST=$(DATADOG_HOST)'
endif
ifdef DATADOG_PORT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DATADOG_PORT=$(DATADOG_PORT)'
endif
ifdef SPANDEX_BATCH_SIZE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SPANDEX_BATCH_SIZE=$(SPANDEX_BATCH_SIZE)'
endif
ifdef SPANDEX_SYNC_THRESHOLD
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SPANDEX_SYNC_THRESHOLD=$(SPANDEX_SYNC_THRESHOLD)'
endif
ifdef HEART_BEAT_TIMEOUT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'HEART_BEAT_TIMEOUT=$(HEART_BEAT_TIMEOUT)'
endif
ifdef HEART_COMMAND
BLOCKSCOUT_CONTAINER_PARAMS += -e 'HEART_COMMAND=$(HEART_COMMAND)'
endif
ifdef BLOCKSCOUT_VERSION
BLOCKSCOUT_CONTAINER_PARAMS += -e 'BLOCKSCOUT_VERSION=$(BLOCKSCOUT_VERSION)'
endif
ifdef RELEASE_LINK
BLOCKSCOUT_CONTAINER_PARAMS += -e 'RELEASE_LINK=$(RELEASE_LINK)'
endif
ifdef ELIXIR_VERSION
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ELIXIR_VERSION=$(ELIXIR_VERSION)'
endif
ifdef BLOCK_TRANSFORMER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'BLOCK_TRANSFORMER=$(BLOCK_TRANSFORMER)'
endif
ifdef GRAPHIQL_TRANSACTION
BLOCKSCOUT_CONTAINER_PARAMS += -e 'GRAPHIQL_TRANSACTION=$(GRAPHIQL_TRANSACTION)'
endif
ifdef BLOCK_RANGES
BLOCKSCOUT_CONTAINER_PARAMS += -e 'BLOCK_RANGES=$(BLOCK_RANGES)'
endif
ifdef FIRST_BLOCK
BLOCKSCOUT_CONTAINER_PARAMS += -e 'FIRST_BLOCK=$(FIRST_BLOCK)'
endif
ifdef LAST_BLOCK
BLOCKSCOUT_CONTAINER_PARAMS += -e 'LAST_BLOCK=$(LAST_BLOCK)'
endif
ifdef TRACE_FIRST_BLOCK
BLOCKSCOUT_CONTAINER_PARAMS += -e 'TRACE_FIRST_BLOCK=$(TRACE_FIRST_BLOCK)'
endif
ifdef TRACE_LAST_BLOCK
BLOCKSCOUT_CONTAINER_PARAMS += -e 'TRACE_LAST_BLOCK=$(TRACE_LAST_BLOCK)'
endif
ifdef CACHE_TXS_COUNT_PERIOD
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_TXS_COUNT_PERIOD=$(CACHE_TXS_COUNT_PERIOD)'
endif
ifdef CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=$(CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL)'
endif
ifdef LINK_TO_OTHER_EXPLORERS
BLOCKSCOUT_CONTAINER_PARAMS += -e 'LINK_TO_OTHER_EXPLORERS=$(LINK_TO_OTHER_EXPLORERS)'
endif
ifdef SUPPORTED_CHAINS
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SUPPORTED_CHAINS=$(SUPPORTED_CHAINS)'
endif
ifdef CACHE_BLOCK_COUNT_PERIOD
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_BLOCK_COUNT_PERIOD=$(CACHE_BLOCK_COUNT_PERIOD)'
endif
ifdef CACHE_ADDRESS_SUM_PERIOD
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_SUM_PERIOD=$(CACHE_ADDRESS_SUM_PERIOD)'
endif
ifdef CACHE_ADDRESS_COUNT_PERIOD
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_COUNT_PERIOD=$(CACHE_ADDRESS_COUNT_PERIOD)'
endif
ifdef ALLOWED_EVM_VERSIONS
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ALLOWED_EVM_VERSIONS=$(ALLOWED_EVM_VERSIONS)'
endif
ifdef UNCLES_IN_AVERAGE_BLOCK_TIME
BLOCKSCOUT_CONTAINER_PARAMS += -e 'UNCLES_IN_AVERAGE_BLOCK_TIME=$(UNCLES_IN_AVERAGE_BLOCK_TIME)'
endif
ifdef CACHE_AVERAGE_BLOCK_PERIOD
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_AVERAGE_BLOCK_PERIOD=$(CACHE_AVERAGE_BLOCK_PERIOD)'
endif
ifdef CACHE_MARKET_HISTORY_PERIOD
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_MARKET_HISTORY_PERIOD=$(CACHE_MARKET_HISTORY_PERIOD)'
endif
ifdef DISABLE_WEBAPP
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_WEBAPP=$(DISABLE_WEBAPP)'
endif
ifdef DISABLE_READ_API
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_READ_API=$(DISABLE_READ_API)'
endif
ifdef DISABLE_WRITE_API
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_WRITE_API=$(DISABLE_WRITE_API)'
endif
ifdef DISABLE_INDEXER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_INDEXER=$(DISABLE_INDEXER)'
endif
ifdef DISABLE_REALTIME_INDEXER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_REALTIME_INDEXER=$(DISABLE_REALTIME_INDEXER)'
endif
ifdef WEBAPP_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'WEBAPP_URL=$(WEBAPP_URL)'
endif
ifdef API_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_URL=$(API_URL)'
endif
ifdef CHAIN_SPEC_PATH
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CHAIN_SPEC_PATH=$(CHAIN_SPEC_PATH)'
endif
ifdef EMISSION_FORMAT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'EMISSION_FORMAT=$(EMISSION_FORMAT)'
endif
ifdef REWARDS_CONTRACT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'REWARDS_CONTRACT=$(REWARDS_CONTRACT)'
endif
ifdef SHOW_ADDRESS_MARKETCAP_PERCENTAGE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SHOW_ADDRESS_MARKETCAP_PERCENTAGE=$(SHOW_ADDRESS_MARKETCAP_PERCENTAGE)'
endif
ifdef BLOCKSCOUT_PROTOCOL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'BLOCKSCOUT_PROTOCOL=$(BLOCKSCOUT_PROTOCOL)'
endif
ifdef BLOCKSCOUT_HOST
BLOCKSCOUT_CONTAINER_PARAMS += -e 'BLOCKSCOUT_HOST=$(BLOCKSCOUT_HOST)'
endif
ifdef DECOMPILED_SMART_CONTRACT_TOKEN
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DECOMPILED_SMART_CONTRACT_TOKEN=$(DECOMPILED_SMART_CONTRACT_TOKEN)'
endif
ifdef SOCKET_ROOT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SOCKET_ROOT=$(SOCKET_ROOT)'
endif
ifdef API_PATH
BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_PATH=$(API_PATH)'
endif
ifdef CHECKSUM_ADDRESS_HASHES
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CHECKSUM_ADDRESS_HASHES=$(CHECKSUM_ADDRESS_HASHES)'
endif
ifdef CHECKSUM_FUNCTION
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CHECKSUM_FUNCTION=$(CHECKSUM_FUNCTION)'
endif
ifdef EXCHANGE_RATES_SOURCE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXCHANGE_RATES_SOURCE=$(EXCHANGE_RATES_SOURCE)'
endif
ifdef EXCHANGE_RATES_COINGECKO_COIN_ID
BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXCHANGE_RATES_COINGECKO_COIN_ID=$(EXCHANGE_RATES_COINGECKO_COIN_ID)'
endif
ifdef EXCHANGE_RATES_COINGECKO_API_KEY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXCHANGE_RATES_COINGECKO_API_KEY=$(EXCHANGE_RATES_COINGECKO_API_KEY)'
endif
ifdef EXCHANGE_RATES_COINMARKETCAP_API_KEY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXCHANGE_RATES_COINMARKETCAP_API_KEY=$(EXCHANGE_RATES_COINMARKETCAP_API_KEY)'
endif
ifdef DISABLE_EXCHANGE_RATES
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_EXCHANGE_RATES=$(DISABLE_EXCHANGE_RATES)'
endif
ifdef SHOW_PRICE_CHART
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SHOW_PRICE_CHART=$(SHOW_PRICE_CHART)'
endif
ifdef SHOW_TXS_CHART
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SHOW_TXS_CHART=$(SHOW_TXS_CHART)'
endif
ifdef HISTORY_FETCH_INTERVAL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'HISTORY_FETCH_INTERVAL=$(HISTORY_FETCH_INTERVAL)'
endif
ifdef TXS_HISTORIAN_INIT_LAG
BLOCKSCOUT_CONTAINER_PARAMS += -e 'TXS_HISTORIAN_INIT_LAG=$(TXS_HISTORIAN_INIT_LAG)'
endif
ifdef TXS_STATS_DAYS_TO_COMPILE_AT_INIT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'TXS_STATS_DAYS_TO_COMPILE_AT_INIT=$(TXS_STATS_DAYS_TO_COMPILE_AT_INIT)'
endif
ifdef APPS_MENU
BLOCKSCOUT_CONTAINER_PARAMS += -e 'APPS_MENU=$(APPS_MENU)'
endif
ifdef EXTERNAL_APPS
BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXTERNAL_APPS=$(EXTERNAL_APPS)'
endif
ifdef GAS_PRICE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'GAS_PRICE=$(GAS_PRICE)'
endif
ifdef TOKEN_METADATA_UPDATE_INTERVAL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'TOKEN_METADATA_UPDATE_INTERVAL=$(TOKEN_METADATA_UPDATE_INTERVAL)'
endif
ifdef WOBSERVER_ENABLED
BLOCKSCOUT_CONTAINER_PARAMS += -e 'WOBSERVER_ENABLED=$(WOBSERVER_ENABLED)'
endif
ifdef CACHE_BRIDGE_MARKET_CAP_UPDATE_INTERVAL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_BRIDGE_MARKET_CAP_UPDATE_INTERVAL=$(CACHE_BRIDGE_MARKET_CAP_UPDATE_INTERVAL)'
endif
ifdef RESTRICTED_LIST
BLOCKSCOUT_CONTAINER_PARAMS += -e 'RESTRICTED_LIST=$(RESTRICTED_LIST)'
endif
ifdef RESTRICTED_LIST_KEY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'RESTRICTED_LIST_KEY=$(RESTRICTED_LIST_KEY)'
endif
ifdef CACHE_ADDRESS_TRANSACTIONS_COUNTER_PERIOD
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_TRANSACTIONS_COUNTER_PERIOD=$(CACHE_ADDRESS_TRANSACTIONS_COUNTER_PERIOD)'
endif
ifdef CACHE_ADDRESS_TRANSACTIONS_GAS_USAGE_COUNTER_PERIOD
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_TRANSACTIONS_GAS_USAGE_COUNTER_PERIOD=$(CACHE_ADDRESS_TRANSACTIONS_GAS_USAGE_COUNTER_PERIOD)'
endif
ifdef CACHE_TOTAL_GAS_USAGE_PERIOD
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_TOTAL_GAS_USAGE_PERIOD=$(CACHE_TOTAL_GAS_USAGE_PERIOD)'
endif
ifdef CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER=$(CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER)'
endif
ifdef DISABLE_KNOWN_TOKENS
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_KNOWN_TOKENS=$(DISABLE_KNOWN_TOKENS)'
endif
ifdef DISABLE_LP_TOKENS_IN_MARKET_CAP
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_LP_TOKENS_IN_MARKET_CAP=$(DISABLE_LP_TOKENS_IN_MARKET_CAP)'
endif
ifdef CUSTOM_CONTRACT_ADDRESSES_TEST_TOKEN
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CUSTOM_CONTRACT_ADDRESSES_TEST_TOKEN=$(CUSTOM_CONTRACT_ADDRESSES_TEST_TOKEN)'
endif
ifdef HIDE_BLOCK_MINER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'HIDE_BLOCK_MINER=$(HIDE_BLOCK_MINER)'
endif
ifdef COIN_BALANCE_HISTORY_DAYS
BLOCKSCOUT_CONTAINER_PARAMS += -e 'COIN_BALANCE_HISTORY_DAYS=$(COIN_BALANCE_HISTORY_DAYS)'
endif
ifdef CACHE_TOKEN_EXCHANGE_RATE_PERIOD
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_TOKEN_EXCHANGE_RATE_PERIOD=$(CACHE_TOKEN_EXCHANGE_RATE_PERIOD)'
endif
ifdef CACHE_ADDRESS_TOKENS_USD_SUM_PERIOD
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_TOKENS_USD_SUM_PERIOD=$(CACHE_ADDRESS_TOKENS_USD_SUM_PERIOD)'
endif
ifdef SHOW_MAINTENANCE_ALERT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SHOW_MAINTENANCE_ALERT=$(SHOW_MAINTENANCE_ALERT)'
endif
ifdef MAINTENANCE_ALERT_MESSAGE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'MAINTENANCE_ALERT_MESSAGE=$(MAINTENANCE_ALERT_MESSAGE)'
endif
ifdef ENABLE_SOURCIFY_INTEGRATION
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ENABLE_SOURCIFY_INTEGRATION=$(ENABLE_SOURCIFY_INTEGRATION)'
endif
ifdef SOURCIFY_SERVER_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SOURCIFY_SERVER_URL=$(SOURCIFY_SERVER_URL)'
endif
ifdef SOURCIFY_REPO_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SOURCIFY_REPO_URL=$(SOURCIFY_REPO_URL)'
endif
ifdef CHAIN_ID
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CHAIN_ID=$(CHAIN_ID)'
endif
ifdef JSON_RPC
BLOCKSCOUT_CONTAINER_PARAMS += -e 'JSON_RPC=$(JSON_RPC)'
endif
ifdef MAX_SIZE_UNLESS_HIDE_ARRAY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'MAX_SIZE_UNLESS_HIDE_ARRAY=$(MAX_SIZE_UNLESS_HIDE_ARRAY)'
endif
ifdef DISPLAY_TOKEN_ICONS
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISPLAY_TOKEN_ICONS=$(DISPLAY_TOKEN_ICONS)'
endif
ifdef SHOW_TENDERLY_LINK
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SHOW_TENDERLY_LINK=$(SHOW_TENDERLY_LINK)'
endif
ifdef TENDERLY_CHAIN_PATH
BLOCKSCOUT_CONTAINER_PARAMS += -e 'TENDERLY_CHAIN_PATH=$(TENDERLY_CHAIN_PATH)'
endif
ifdef MAX_STRING_LENGTH_WITHOUT_TRIMMING
BLOCKSCOUT_CONTAINER_PARAMS += -e 'MAX_STRING_LENGTH_WITHOUT_TRIMMING=$(MAX_STRING_LENGTH_WITHOUT_TRIMMING)'
endif
ifdef RE_CAPTCHA_SECRET_KEY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'RE_CAPTCHA_SECRET_KEY=$(RE_CAPTCHA_SECRET_KEY)'
endif
ifdef RE_CAPTCHA_CLIENT_KEY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'RE_CAPTCHA_CLIENT_KEY=$(RE_CAPTCHA_CLIENT_KEY)'
endif
ifdef CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD=$(CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD)'
endif
ifdef API_RATE_LIMIT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_RATE_LIMIT=$(API_RATE_LIMIT)'
endif
ifdef API_RATE_LIMIT_BY_KEY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_RATE_LIMIT_BY_KEY=$(API_RATE_LIMIT_BY_KEY)'
endif
ifdef API_RATE_LIMIT_BY_IP
BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_RATE_LIMIT_BY_IP=$(API_RATE_LIMIT_BY_IP)'
endif
ifdef API_RATE_LIMIT_STATIC_API_KEY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_RATE_LIMIT_STATIC_API_KEY=$(API_RATE_LIMIT_STATIC_API_KEY)'
endif
ifdef API_RATE_LIMIT_WHITELISTED_IPS
BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_RATE_LIMIT_WHITELISTED_IPS=$(API_RATE_LIMIT_WHITELISTED_IPS)'
endif
ifdef COIN_NAME
BLOCKSCOUT_CONTAINER_PARAMS += -e 'COIN_NAME=$(COIN_NAME)'
endif
ifdef INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER=$(INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER)'
endif
ifdef INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=$(INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER)'
endif
ifdef TOKEN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES
BLOCKSCOUT_CONTAINER_PARAMS += -e 'TOKEN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES=$(TOKEN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES)'
endif
ifdef COIN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES
BLOCKSCOUT_CONTAINER_PARAMS += -e 'COIN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES=$(COIN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES)'
endif
ifdef INDEXER_MEMORY_LIMIT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_MEMORY_LIMIT=$(INDEXER_MEMORY_LIMIT)'
endif
ifdef ETHEREUM_JSONRPC_DEBUG_TRACE_TRANSACTION_TIMEOUT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ETHEREUM_JSONRPC_DEBUG_TRACE_TRANSACTION_TIMEOUT=$(ETHEREUM_JSONRPC_DEBUG_TRACE_TRANSACTION_TIMEOUT)'
endif
ifdef FETCH_REWARDS_WAY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'FETCH_REWARDS_WAY=$(FETCH_REWARDS_WAY)'
endif
ifdef INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE=$(INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE)'
endif
ifdef FOOTER_CHAT_LINK
BLOCKSCOUT_CONTAINER_PARAMS += -e 'FOOTER_CHAT_LINK=$(FOOTER_CHAT_LINK)'
endif
ifdef FOOTER_FORUM_LINK
BLOCKSCOUT_CONTAINER_PARAMS += -e 'FOOTER_FORUM_LINK=$(FOOTER_FORUM_LINK)'
endif
ifdef FOOTER_GITHUB_LINK
BLOCKSCOUT_CONTAINER_PARAMS += -e 'FOOTER_GITHUB_LINK=$(FOOTER_GITHUB_LINK)'
endif
ifdef NETWORK_ICON
BLOCKSCOUT_CONTAINER_PARAMS += -e 'NETWORK_ICON=$(NETWORK_ICON)'
endif
ifdef LOGO_TEXT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'LOGO_TEXT=$(LOGO_TEXT)'
endif
ifdef SHOW_TESTNET_LABEL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SHOW_TESTNET_LABEL=$(SHOW_TESTNET_LABEL)'
endif
ifdef TESTNET_LABEL_TEXT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'TESTNET_LABEL_TEXT=$(TESTNET_LABEL_TEXT)'
endif
ifdef OTHER_EXPLORERS
BLOCKSCOUT_CONTAINER_PARAMS += -e 'OTHER_EXPLORERS=$(OTHER_EXPLORERS)'
endif
ifdef CUSTOM_CONTRACT_ADDRESSES_DARK_FOREST
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CUSTOM_CONTRACT_ADDRESSES_DARK_FOREST=$(CUSTOM_CONTRACT_ADDRESSES_DARK_FOREST)'
endif
ifdef CUSTOM_CONTRACT_ADDRESSES_DARK_FOREST_V_0_5
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CUSTOM_CONTRACT_ADDRESSES_DARK_FOREST_V_0_5=$(CUSTOM_CONTRACT_ADDRESSES_DARK_FOREST_V_0_5)'
endif
ifdef CUSTOM_CONTRACT_ADDRESSES_CIRCLES
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CUSTOM_CONTRACT_ADDRESSES_CIRCLES=$(CUSTOM_CONTRACT_ADDRESSES_CIRCLES)'
endif
ifdef HEALTHY_BLOCKS_PERIOD
BLOCKSCOUT_CONTAINER_PARAMS += -e 'HEALTHY_BLOCKS_PERIOD=$(HEALTHY_BLOCKS_PERIOD)'
endif
ifdef EXCHANGE_RATES_FETCH_BTC_VALUE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'EXCHANGE_RATES_FETCH_BTC_VALUE=$(EXCHANGE_RATES_FETCH_BTC_VALUE)'
endif
ifdef ENABLE_TXS_STATS
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ENABLE_TXS_STATS=$(ENABLE_TXS_STATS)'
endif
ifdef INDEXER_DISABLE_BLOCK_REWARD_FETCHER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_DISABLE_BLOCK_REWARD_FETCHER=$(INDEXER_DISABLE_BLOCK_REWARD_FETCHER)'
endif
ifdef INDEXER_DISABLE_ADDRESS_COIN_BALANCE_FETCHER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_DISABLE_ADDRESS_COIN_BALANCE_FETCHER=$(INDEXER_DISABLE_ADDRESS_COIN_BALANCE_FETCHER)'
endif
ifdef INDEXER_DISABLE_CATALOGED_TOKEN_UPDATER_FETCHER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_DISABLE_CATALOGED_TOKEN_UPDATER_FETCHER=$(INDEXER_DISABLE_CATALOGED_TOKEN_UPDATER_FETCHER)'
endif
ifdef INDEXER_DISABLE_EMPTY_BLOCK_SANITIZER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_DISABLE_EMPTY_BLOCK_SANITIZER=$(INDEXER_DISABLE_EMPTY_BLOCK_SANITIZER)'
endif
ifdef SECRET_KEY_BASE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SECRET_KEY_BASE=$(SECRET_KEY_BASE)'
endif
ifdef PORT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'PORT=$(PORT)'
endif
ifdef DATABASE_READ_ONLY_API_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DATABASE_READ_ONLY_API_URL=$(DATABASE_READ_ONLY_API_URL)'
endif
ifdef POOL_SIZE_API
BLOCKSCOUT_CONTAINER_PARAMS += -e 'POOL_SIZE_API=$(POOL_SIZE_API)'
endif
ifdef ENABLE_RUST_VERIFICATION_SERVICE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ENABLE_RUST_VERIFICATION_SERVICE=$(ENABLE_RUST_VERIFICATION_SERVICE)'
endif
ifdef RUST_VERIFICATION_SERVICE_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'RUST_VERIFICATION_SERVICE_URL=$(RUST_VERIFICATION_SERVICE_URL)'
endif
migrate_only:
@echo "==> Running migrations"
@docker run --rm \
$(BLOCKSCOUT_CONTAINER_PARAMS) \
$(BS_CONTAINER_IMAGE) /bin/sh -c "echo $$MIX_ENV && ./bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\""
migrate: build postgres
@$(MAKE) -f $(THIS_FILE) migrate_only
PG_EXIST := $(shell docker ps -a --no-trunc --filter name=^/${PG_CONTAINER_NAME}$ | grep ${PG_CONTAINER_NAME})
PG_STARTED := $(shell docker ps --no-trunc --filter name=^/${PG_CONTAINER_NAME}$ | grep ${PG_CONTAINER_NAME})
postgres:
ifdef DATABASE_URL
@echo "==> DATABASE_URL of external DB provided. There is no need to start a container for DB."
@$(MAKE) -f $(THIS_FILE) migrate_only
else
ifdef PG_EXIST
@echo "==> Checking PostrgeSQL container"
ifdef PG_STARTED
@echo "==> PostgreSQL Already started"
@$(MAKE) -f $(THIS_FILE) migrate_only
else
@echo "==> Starting PostgreSQL container"
@docker start $(PG_CONTAINER_NAME)
@$(MAKE) -f $(THIS_FILE) migrate_only
endif
else
@echo "==> Creating new PostgreSQL container"
@docker run -d --name $(PG_CONTAINER_NAME) \
-e POSTGRES_PASSWORD="" \
-e POSTGRES_USER="postgres" \
-e POSTGRES_HOST_AUTH_METHOD="trust" \
-p 5432:5432 \
$(PG_CONTAINER_IMAGE)
@sleep 1
@$(MAKE) -f $(THIS_FILE) migrate_only
endif
endif
start: build postgres
@echo "==> Starting blockscout"
@docker run --rm --name $(BS_CONTAINER_NAME) \
$(BLOCKSCOUT_CONTAINER_PARAMS) \
-p 4000:4000 \
$(BS_CONTAINER_IMAGE) /bin/sh -c "./bin/blockscout start"
BS_STARTED := $(shell docker ps --no-trunc --filter name=^/${BS_CONTAINER_NAME}$)
stop:
ifdef BS_STARTED
@echo "==> Stopping BlockScout container."
@docker stop $(BS_CONTAINER_NAME)
@echo "==> BlockScout container stopped."
else
@echo "==> BlockScout container already stopped before."
endif
ifdef PG_STARTED
@echo "==> Stopping Postgres container."
@docker stop $(PG_CONTAINER_NAME)
@echo "==> Postgres container stopped."
else
@echo "==> Postgres container already stopped before."
endif
run: start
docker-login: ## login to DockerHub with credentials found in env
docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}
# Docker release - build, tag and push the container
pre-release: build publish ## Make a release by building and publishing the `{version}` ans `latest` tagged containers to hub
release: build publish-stable ## Make a release by building and publishing the `{version}` ans `latest` tagged containers to hub
# Docker publish
publish: docker-login publish-latest publish-version ## publish the `{version}` ans `latest` tagged containers to hub
publish-stable: docker-login publish-latest publish-stable-version ## publish the `{version}` ans `latest` tagged containers to hub
publish-latest: tag-latest ## publish the `latest` tagged container to hub
@echo 'publish latest to $(DOCKER_REPO)'
docker push $(BS_CONTAINER_IMAGE):latest
publish-version: tag-version ## publish the `{version}` tagged container to hub
@echo 'publish $(TAG) to $(DOCKER_REPO)'
docker push $(BS_CONTAINER_IMAGE):$(TAG)
publish-stable-version: tag-stable-version ## publish the `{version}` tagged container to hub
@echo 'publish $(STABLE_TAG) to $(DOCKER_REPO)'
docker push $(BS_CONTAINER_IMAGE):$(STABLE_TAG)
# Docker tagging
tag: tag-latest tag-version ## Generate container tags for the `{version}` ans `latest` tags
tag-stable: tag-latest tag-stable-version ## Generate container tags for the `{version}` ans `latest` tags
tag-latest: ## Generate container `latest` tag
@echo 'create latest tag'
docker tag $(BS_CONTAINER_IMAGE) $(BS_CONTAINER_IMAGE):latest
tag-version: ## Generate container `{version}` tag
@echo 'create tag $(TAG)'
docker tag $(BS_CONTAINER_IMAGE) $(BS_CONTAINER_IMAGE):$(TAG)
tag-stable-version: ## Generate container `{version}` tag
@echo 'create tag $(STABLE_TAG)'
docker tag $(BS_CONTAINER_IMAGE) $(BS_CONTAINER_IMAGE):$(STABLE_TAG)
# Polygon zkEVM
build-dev:
@docker build --build-arg BUILD_ENV=dev -f ./Dockerfile -t $(BS_CONTAINER_IMAGE) ../
build-prod:
@docker build --build-arg BUILD_ENV=prod -f ./Dockerfile -t $(BS_CONTAINER_IMAGE) ../
push:
@echo "==> Pushing image to docker hub"
@docker image tag ${BS_CONTAINER_IMAGE} ${BS_CONTAINER_IMAGE}:latest
@docker push ${BS_CONTAINER_IMAGE}:latest
start-compose:
@docker-compose -p "$(APP_NAME)" -f docker-compose.yml up -d
stop-compose:
@docker-compose -p "$(APP_NAME)" -f docker-compose.yml down --remove-orphans
.PHONY: build \
migrate \
start \
stop \
postgres \
run \
docker-login \
release \
publish \
publish-latest \
publish-version \
tag \
tag-latest \
tag-version \
build-dev \
build-prod \
build-prod-nc \
push \
start-compose \
stop-compose