Skip to content

Commit 4f69962

Browse files
authored
feat: update blockscout with new frontend (ethereum#843)
Signed-off-by: Barnabas Busa <barnabas.busa@ethereum.org>
1 parent 55df658 commit 4f69962

File tree

5 files changed

+78
-15
lines changed

5 files changed

+78
-15
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,11 +637,14 @@ additional_services:
637637
# Configuration place for blockscout explorer - https://github.com/blockscout/blockscout
638638
blockscout_params:
639639
# blockscout docker image to use
640-
# Defaults to blockscout/blockscout:6.8.0
641-
image: "blockscout/blockscout:6.8.0"
640+
# Defaults to blockscout/blockscout:latest
641+
image: "blockscout/blockscout:latest"
642642
# blockscout smart contract verifier image to use
643-
# Defaults to ghcr.io/blockscout/smart-contract-verifier:v1.9.0
644-
verif_image: "ghcr.io/blockscout/smart-contract-verifier:v1.9.0"
643+
# Defaults to ghcr.io/blockscout/smart-contract-verifier:latest
644+
verif_image: "ghcr.io/blockscout/smart-contract-verifier:latest"
645+
# Frontend image
646+
# Defaults to ghcr.io/blockscout/frontend:latest
647+
frontend_image: "ghcr.io/blockscout/frontend:latest"
645648

646649
# Configuration place for dora the explorer - https://github.com/ethpandaops/dora
647650
dora_params:

main.star

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,6 @@ def run(plan, args={}):
508508
plan.print("Successfully launched beacon metrics gazer")
509509
elif additional_service == "blockscout":
510510
plan.print("Launching blockscout")
511-
blockscout_params = args_with_right_defaults.blockscout_params
512511
blockscout_sc_verif_url = blockscout.launch_blockscout(
513512
plan,
514513
all_el_contexts,
@@ -517,7 +516,8 @@ def run(plan, args={}):
517516
args_with_right_defaults.port_publisher,
518517
index,
519518
args_with_right_defaults.docker_cache_params,
520-
blockscout_params,
519+
args_with_right_defaults.blockscout_params,
520+
network_params,
521521
)
522522
plan.print("Successfully launched blockscout")
523523
elif additional_service == "dora":

src/blockscout/blockscout_launcher.star

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ postgres = import_module("github.com/kurtosis-tech/postgres-package/main.star")
55
POSTGRES_IMAGE = "library/postgres:alpine"
66

77
SERVICE_NAME_BLOCKSCOUT = "blockscout"
8-
8+
SERVICE_NAME_FRONTEND = "blockscout-frontend"
99
HTTP_PORT_NUMBER = 4000
1010
HTTP_PORT_NUMBER_VERIF = 8050
11-
11+
HTTP_PORT_NUMBER_FRONTEND = 3000
1212
BLOCKSCOUT_MIN_CPU = 100
1313
BLOCKSCOUT_MAX_CPU = 1000
1414
BLOCKSCOUT_MIN_MEMORY = 1024
@@ -35,6 +35,14 @@ VERIF_USED_PORTS = {
3535
)
3636
}
3737

38+
FRONTEND_USED_PORTS = {
39+
constants.HTTP_PORT_ID: shared_utils.new_port_spec(
40+
HTTP_PORT_NUMBER_FRONTEND,
41+
shared_utils.TCP_PROTOCOL,
42+
shared_utils.HTTP_APPLICATION_PROTOCOL,
43+
)
44+
}
45+
3846

3947
def launch_blockscout(
4048
plan,
@@ -45,6 +53,7 @@ def launch_blockscout(
4553
additional_service_index,
4654
docker_cache_params,
4755
blockscout_params,
56+
network_params,
4857
):
4958
postgres_output = postgres.run(
5059
plan,
@@ -93,6 +102,16 @@ def launch_blockscout(
93102
blockscout_service.hostname, blockscout_service.ports["http"].number
94103
)
95104

105+
config_frontend = get_config_frontend(
106+
plan,
107+
el_client_rpc_url,
108+
docker_cache_params,
109+
blockscout_params,
110+
network_params,
111+
global_node_selectors,
112+
blockscout_service,
113+
)
114+
plan.add_service(SERVICE_NAME_FRONTEND, config_frontend)
96115
return blockscout_url
97116

98117

@@ -110,11 +129,10 @@ def get_config_verif(
110129
0,
111130
)
112131

113-
IMAGE_NAME_BLOCKSCOUT_VERIF = blockscout_params.verif_image
114132
return ServiceConfig(
115133
image=shared_utils.docker_cache_image_calc(
116134
docker_cache_params,
117-
IMAGE_NAME_BLOCKSCOUT_VERIF,
135+
blockscout_params.verif_image,
118136
),
119137
ports=VERIF_USED_PORTS,
120138
public_ports=public_ports,
@@ -158,12 +176,10 @@ def get_config_backend(
158176
1,
159177
)
160178

161-
IMAGE_NAME_BLOCKSCOUT = blockscout_params.image
162-
163179
return ServiceConfig(
164180
image=shared_utils.docker_cache_image_calc(
165181
docker_cache_params,
166-
IMAGE_NAME_BLOCKSCOUT,
182+
blockscout_params.image,
167183
),
168184
ports=USED_PORTS,
169185
public_ports=public_ports,
@@ -197,3 +213,44 @@ def get_config_backend(
197213
max_memory=BLOCKSCOUT_MAX_MEMORY,
198214
node_selectors=node_selectors,
199215
)
216+
217+
218+
def get_config_frontend(
219+
plan,
220+
el_client_rpc_url,
221+
docker_cache_params,
222+
blockscout_params,
223+
network_params,
224+
node_selectors,
225+
blockscout_service,
226+
):
227+
return ServiceConfig(
228+
image=shared_utils.docker_cache_image_calc(
229+
docker_cache_params,
230+
blockscout_params.frontend_image,
231+
),
232+
ports=FRONTEND_USED_PORTS,
233+
env_vars={
234+
"NEXT_PUBLIC_API_PROTOCOL": "http",
235+
"NEXT_PUBLIC_API_WEBSOCKET_PROTOCOL": "ws",
236+
"NEXT_PUBLIC_NETWORK_NAME": "Kurtosis",
237+
"NEXT_PUBLIC_NETWORK_ID": network_params.network_id,
238+
"NEXT_PUBLIC_NETWORK_RPC_URL": el_client_rpc_url,
239+
"NEXT_PUBLIC_APP_HOST": "0.0.0.0",
240+
"NEXT_PUBLIC_API_HOST": blockscout_service.ip_address
241+
+ ":"
242+
+ str(blockscout_service.ports["http"].number),
243+
"NEXT_PUBLIC_AD_BANNER_PROVIDER": "none",
244+
"NEXT_PUBLIC_AD_TEXT_PROVIDER": "none",
245+
"NEXT_PUBLIC_IS_TESTNET": "true",
246+
"NEXT_PUBLIC_GAS_TRACKER_ENABLED": "true",
247+
"NEXT_PUBLIC_HAS_BEACON_CHAIN": "true",
248+
"NEXT_PUBLIC_NETWORK_VERIFICATION_TYPE": "validation",
249+
"NEXT_PUBLIC_NETWORK_ICON": "https://ethpandaops.io/logo.png",
250+
},
251+
min_cpu=BLOCKSCOUT_MIN_CPU,
252+
max_cpu=BLOCKSCOUT_MAX_CPU,
253+
min_memory=BLOCKSCOUT_MIN_MEMORY,
254+
max_memory=BLOCKSCOUT_MAX_MEMORY,
255+
node_selectors=node_selectors,
256+
)

src/package_io/input_parser.star

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ def input_parser(plan, input_args):
364364
blockscout_params=struct(
365365
image=result["blockscout_params"]["image"],
366366
verif_image=result["blockscout_params"]["verif_image"],
367+
frontend_image=result["blockscout_params"]["frontend_image"],
367368
),
368369
dora_params=struct(
369370
image=result["dora_params"]["image"],
@@ -1011,8 +1012,9 @@ def default_participant():
10111012

10121013
def get_default_blockscout_params():
10131014
return {
1014-
"image": "blockscout/blockscout:6.8.0",
1015-
"verif_image": "ghcr.io/blockscout/smart-contract-verifier:v1.9.0",
1015+
"image": "blockscout/blockscout:latest",
1016+
"verif_image": "ghcr.io/blockscout/smart-contract-verifier:latest",
1017+
"frontend_image": "ghcr.io/blockscout/frontend:latest",
10161018
}
10171019

10181020

src/package_io/sanity_check.star

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ SUBCATEGORY_PARAMS = {
174174
"blockscout_params": [
175175
"image",
176176
"verif_image",
177+
"frontend_image",
177178
],
178179
"dora_params": [
179180
"image",

0 commit comments

Comments
 (0)