Commit 4f69962f authored by Barnabas Busa's avatar Barnabas Busa Committed by GitHub

feat: update blockscout with new frontend (#843)

Signed-off-by: default avatarBarnabas Busa <barnabas.busa@ethereum.org>
parent 55df658f
...@@ -637,11 +637,14 @@ additional_services: ...@@ -637,11 +637,14 @@ additional_services:
# Configuration place for blockscout explorer - https://github.com/blockscout/blockscout # Configuration place for blockscout explorer - https://github.com/blockscout/blockscout
blockscout_params: blockscout_params:
# blockscout docker image to use # blockscout docker image to use
# Defaults to blockscout/blockscout:6.8.0 # Defaults to blockscout/blockscout:latest
image: "blockscout/blockscout:6.8.0" image: "blockscout/blockscout:latest"
# blockscout smart contract verifier image to use # blockscout smart contract verifier image to use
# Defaults to ghcr.io/blockscout/smart-contract-verifier:v1.9.0 # Defaults to ghcr.io/blockscout/smart-contract-verifier:latest
verif_image: "ghcr.io/blockscout/smart-contract-verifier:v1.9.0" verif_image: "ghcr.io/blockscout/smart-contract-verifier:latest"
# Frontend image
# Defaults to ghcr.io/blockscout/frontend:latest
frontend_image: "ghcr.io/blockscout/frontend:latest"
# Configuration place for dora the explorer - https://github.com/ethpandaops/dora # Configuration place for dora the explorer - https://github.com/ethpandaops/dora
dora_params: dora_params:
......
...@@ -508,7 +508,6 @@ def run(plan, args={}): ...@@ -508,7 +508,6 @@ def run(plan, args={}):
plan.print("Successfully launched beacon metrics gazer") plan.print("Successfully launched beacon metrics gazer")
elif additional_service == "blockscout": elif additional_service == "blockscout":
plan.print("Launching blockscout") plan.print("Launching blockscout")
blockscout_params = args_with_right_defaults.blockscout_params
blockscout_sc_verif_url = blockscout.launch_blockscout( blockscout_sc_verif_url = blockscout.launch_blockscout(
plan, plan,
all_el_contexts, all_el_contexts,
...@@ -517,7 +516,8 @@ def run(plan, args={}): ...@@ -517,7 +516,8 @@ def run(plan, args={}):
args_with_right_defaults.port_publisher, args_with_right_defaults.port_publisher,
index, index,
args_with_right_defaults.docker_cache_params, args_with_right_defaults.docker_cache_params,
blockscout_params, args_with_right_defaults.blockscout_params,
network_params,
) )
plan.print("Successfully launched blockscout") plan.print("Successfully launched blockscout")
elif additional_service == "dora": elif additional_service == "dora":
......
...@@ -5,10 +5,10 @@ postgres = import_module("github.com/kurtosis-tech/postgres-package/main.star") ...@@ -5,10 +5,10 @@ postgres = import_module("github.com/kurtosis-tech/postgres-package/main.star")
POSTGRES_IMAGE = "library/postgres:alpine" POSTGRES_IMAGE = "library/postgres:alpine"
SERVICE_NAME_BLOCKSCOUT = "blockscout" SERVICE_NAME_BLOCKSCOUT = "blockscout"
SERVICE_NAME_FRONTEND = "blockscout-frontend"
HTTP_PORT_NUMBER = 4000 HTTP_PORT_NUMBER = 4000
HTTP_PORT_NUMBER_VERIF = 8050 HTTP_PORT_NUMBER_VERIF = 8050
HTTP_PORT_NUMBER_FRONTEND = 3000
BLOCKSCOUT_MIN_CPU = 100 BLOCKSCOUT_MIN_CPU = 100
BLOCKSCOUT_MAX_CPU = 1000 BLOCKSCOUT_MAX_CPU = 1000
BLOCKSCOUT_MIN_MEMORY = 1024 BLOCKSCOUT_MIN_MEMORY = 1024
...@@ -35,6 +35,14 @@ VERIF_USED_PORTS = { ...@@ -35,6 +35,14 @@ VERIF_USED_PORTS = {
) )
} }
FRONTEND_USED_PORTS = {
constants.HTTP_PORT_ID: shared_utils.new_port_spec(
HTTP_PORT_NUMBER_FRONTEND,
shared_utils.TCP_PROTOCOL,
shared_utils.HTTP_APPLICATION_PROTOCOL,
)
}
def launch_blockscout( def launch_blockscout(
plan, plan,
...@@ -45,6 +53,7 @@ def launch_blockscout( ...@@ -45,6 +53,7 @@ def launch_blockscout(
additional_service_index, additional_service_index,
docker_cache_params, docker_cache_params,
blockscout_params, blockscout_params,
network_params,
): ):
postgres_output = postgres.run( postgres_output = postgres.run(
plan, plan,
...@@ -93,6 +102,16 @@ def launch_blockscout( ...@@ -93,6 +102,16 @@ def launch_blockscout(
blockscout_service.hostname, blockscout_service.ports["http"].number blockscout_service.hostname, blockscout_service.ports["http"].number
) )
config_frontend = get_config_frontend(
plan,
el_client_rpc_url,
docker_cache_params,
blockscout_params,
network_params,
global_node_selectors,
blockscout_service,
)
plan.add_service(SERVICE_NAME_FRONTEND, config_frontend)
return blockscout_url return blockscout_url
...@@ -110,11 +129,10 @@ def get_config_verif( ...@@ -110,11 +129,10 @@ def get_config_verif(
0, 0,
) )
IMAGE_NAME_BLOCKSCOUT_VERIF = blockscout_params.verif_image
return ServiceConfig( return ServiceConfig(
image=shared_utils.docker_cache_image_calc( image=shared_utils.docker_cache_image_calc(
docker_cache_params, docker_cache_params,
IMAGE_NAME_BLOCKSCOUT_VERIF, blockscout_params.verif_image,
), ),
ports=VERIF_USED_PORTS, ports=VERIF_USED_PORTS,
public_ports=public_ports, public_ports=public_ports,
...@@ -158,12 +176,10 @@ def get_config_backend( ...@@ -158,12 +176,10 @@ def get_config_backend(
1, 1,
) )
IMAGE_NAME_BLOCKSCOUT = blockscout_params.image
return ServiceConfig( return ServiceConfig(
image=shared_utils.docker_cache_image_calc( image=shared_utils.docker_cache_image_calc(
docker_cache_params, docker_cache_params,
IMAGE_NAME_BLOCKSCOUT, blockscout_params.image,
), ),
ports=USED_PORTS, ports=USED_PORTS,
public_ports=public_ports, public_ports=public_ports,
...@@ -197,3 +213,44 @@ def get_config_backend( ...@@ -197,3 +213,44 @@ def get_config_backend(
max_memory=BLOCKSCOUT_MAX_MEMORY, max_memory=BLOCKSCOUT_MAX_MEMORY,
node_selectors=node_selectors, node_selectors=node_selectors,
) )
def get_config_frontend(
plan,
el_client_rpc_url,
docker_cache_params,
blockscout_params,
network_params,
node_selectors,
blockscout_service,
):
return ServiceConfig(
image=shared_utils.docker_cache_image_calc(
docker_cache_params,
blockscout_params.frontend_image,
),
ports=FRONTEND_USED_PORTS,
env_vars={
"NEXT_PUBLIC_API_PROTOCOL": "http",
"NEXT_PUBLIC_API_WEBSOCKET_PROTOCOL": "ws",
"NEXT_PUBLIC_NETWORK_NAME": "Kurtosis",
"NEXT_PUBLIC_NETWORK_ID": network_params.network_id,
"NEXT_PUBLIC_NETWORK_RPC_URL": el_client_rpc_url,
"NEXT_PUBLIC_APP_HOST": "0.0.0.0",
"NEXT_PUBLIC_API_HOST": blockscout_service.ip_address
+ ":"
+ str(blockscout_service.ports["http"].number),
"NEXT_PUBLIC_AD_BANNER_PROVIDER": "none",
"NEXT_PUBLIC_AD_TEXT_PROVIDER": "none",
"NEXT_PUBLIC_IS_TESTNET": "true",
"NEXT_PUBLIC_GAS_TRACKER_ENABLED": "true",
"NEXT_PUBLIC_HAS_BEACON_CHAIN": "true",
"NEXT_PUBLIC_NETWORK_VERIFICATION_TYPE": "validation",
"NEXT_PUBLIC_NETWORK_ICON": "https://ethpandaops.io/logo.png",
},
min_cpu=BLOCKSCOUT_MIN_CPU,
max_cpu=BLOCKSCOUT_MAX_CPU,
min_memory=BLOCKSCOUT_MIN_MEMORY,
max_memory=BLOCKSCOUT_MAX_MEMORY,
node_selectors=node_selectors,
)
...@@ -364,6 +364,7 @@ def input_parser(plan, input_args): ...@@ -364,6 +364,7 @@ def input_parser(plan, input_args):
blockscout_params=struct( blockscout_params=struct(
image=result["blockscout_params"]["image"], image=result["blockscout_params"]["image"],
verif_image=result["blockscout_params"]["verif_image"], verif_image=result["blockscout_params"]["verif_image"],
frontend_image=result["blockscout_params"]["frontend_image"],
), ),
dora_params=struct( dora_params=struct(
image=result["dora_params"]["image"], image=result["dora_params"]["image"],
...@@ -1011,8 +1012,9 @@ def default_participant(): ...@@ -1011,8 +1012,9 @@ def default_participant():
def get_default_blockscout_params(): def get_default_blockscout_params():
return { return {
"image": "blockscout/blockscout:6.8.0", "image": "blockscout/blockscout:latest",
"verif_image": "ghcr.io/blockscout/smart-contract-verifier:v1.9.0", "verif_image": "ghcr.io/blockscout/smart-contract-verifier:latest",
"frontend_image": "ghcr.io/blockscout/frontend:latest",
} }
......
...@@ -174,6 +174,7 @@ SUBCATEGORY_PARAMS = { ...@@ -174,6 +174,7 @@ SUBCATEGORY_PARAMS = {
"blockscout_params": [ "blockscout_params": [
"image", "image",
"verif_image", "verif_image",
"frontend_image",
], ],
"dora_params": [ "dora_params": [
"image", "image",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment