Skip to content

Commit

Permalink
feat: Add-blockscout_params (#838)
Browse files Browse the repository at this point in the history
fix #837 
the default blockscout image version does not work on my machine. 
so i added the blockscout_params for blockscout service. now user can
customize the image versions they want to use.
it contains two params:
```yaml
blockscout_params:
  # blockscout docker image to use
  # Defaults to the latest image
  image: "blockscout/blockscout:latest"
  # blockscout smart contract verifier image to use
  # Defaults to ghcr.io/blockscout/smart-contract-verifier:v1.9.0
  verif_image: "ghcr.io/blockscout/smart-contract-verifier:v1.9.0"
```

i already tested it on my machine and it worke well.

---------

Co-authored-by: Barnabas Busa <[email protected]>
Co-authored-by: Barnabas Busa <[email protected]>
  • Loading branch information
3 people authored Nov 29, 2024
1 parent 3ba9e51 commit 777ec06
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,15 @@ additional_services:
- apache
- tracoor

# Configuration place for blockscout explorer - https://github.com/blockscout/blockscout
blockscout_params:
# blockscout docker image to use
# Defaults to blockscout/blockscout:6.8.0
image: "blockscout/blockscout:6.8.0"
# blockscout smart contract verifier image to use
# Defaults to ghcr.io/blockscout/smart-contract-verifier:v1.9.0
verif_image: "ghcr.io/blockscout/smart-contract-verifier:v1.9.0"

# Configuration place for dora the explorer - https://github.com/ethpandaops/dora
dora_params:
# Dora docker image to use
Expand Down
2 changes: 2 additions & 0 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ def run(plan, args={}):
plan.print("Successfully launched beacon metrics gazer")
elif additional_service == "blockscout":
plan.print("Launching blockscout")
blockscout_params = args_with_right_defaults.blockscout_params
blockscout_sc_verif_url = blockscout.launch_blockscout(
plan,
all_el_contexts,
Expand All @@ -516,6 +517,7 @@ def run(plan, args={}):
args_with_right_defaults.port_publisher,
index,
args_with_right_defaults.docker_cache_params,
blockscout_params,
)
plan.print("Successfully launched blockscout")
elif additional_service == "dora":
Expand Down
15 changes: 12 additions & 3 deletions src/blockscout/blockscout_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ shared_utils = import_module("../shared_utils/shared_utils.star")
constants = import_module("../package_io/constants.star")
postgres = import_module("github.com/kurtosis-tech/postgres-package/main.star")

IMAGE_NAME_BLOCKSCOUT = "blockscout/blockscout:6.8.0"
IMAGE_NAME_BLOCKSCOUT_VERIF = "ghcr.io/blockscout/smart-contract-verifier:v1.9.0"
POSTGRES_IMAGE = "library/postgres:alpine"

SERVICE_NAME_BLOCKSCOUT = "blockscout"
Expand Down Expand Up @@ -46,6 +44,7 @@ def launch_blockscout(
port_publisher,
additional_service_index,
docker_cache_params,
blockscout_params,
):
postgres_output = postgres.run(
plan,
Expand All @@ -68,6 +67,7 @@ def launch_blockscout(
port_publisher,
additional_service_index,
docker_cache_params,
blockscout_params,
)
verif_service_name = "{}-verif".format(SERVICE_NAME_BLOCKSCOUT)
verif_service = plan.add_service(verif_service_name, config_verif)
Expand All @@ -84,6 +84,7 @@ def launch_blockscout(
port_publisher,
additional_service_index,
docker_cache_params,
blockscout_params,
)
blockscout_service = plan.add_service(SERVICE_NAME_BLOCKSCOUT, config_backend)
plan.print(blockscout_service)
Expand All @@ -96,7 +97,11 @@ def launch_blockscout(


def get_config_verif(
node_selectors, port_publisher, additional_service_index, docker_cache_params
node_selectors,
port_publisher,
additional_service_index,
docker_cache_params,
blockscout_params,
):
public_ports = shared_utils.get_additional_service_standard_public_port(
port_publisher,
Expand All @@ -105,6 +110,7 @@ def get_config_verif(
0,
)

IMAGE_NAME_BLOCKSCOUT_VERIF = blockscout_params.verif_image
return ServiceConfig(
image=shared_utils.docker_cache_image_calc(
docker_cache_params,
Expand Down Expand Up @@ -134,6 +140,7 @@ def get_config_backend(
port_publisher,
additional_service_index,
docker_cache_params,
blockscout_params,
):
database_url = "{protocol}://{user}:{password}@{hostname}:{port}/{database}".format(
protocol="postgresql",
Expand All @@ -151,6 +158,8 @@ def get_config_backend(
1,
)

IMAGE_NAME_BLOCKSCOUT = blockscout_params.image

return ServiceConfig(
image=shared_utils.docker_cache_image_calc(
docker_cache_params,
Expand Down
17 changes: 17 additions & 0 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ ATTR_TO_BE_SKIPPED_AT_ROOT = (
"network_params",
"participants",
"mev_params",
"blockscout_params",
"dora_params",
"docker_cache_params",
"assertoor_params",
Expand All @@ -92,6 +93,7 @@ def input_parser(plan, input_args):
sanity_check.sanity_check(plan, input_args)
result = parse_network_params(plan, input_args)
# add default eth2 input params
result["blockscout_params"] = get_default_blockscout_params()
result["dora_params"] = get_default_dora_params()
result["docker_cache_params"] = get_default_docker_cache_params()
result["mev_params"] = get_default_mev_params(
Expand Down Expand Up @@ -136,6 +138,10 @@ def input_parser(plan, input_args):
if attr not in ATTR_TO_BE_SKIPPED_AT_ROOT and attr in input_args:
result[attr] = value
# custom eth2 attributes config
elif attr == "blockscout_params":
for sub_attr in input_args["blockscout_params"]:
sub_value = input_args["blockscout_params"][sub_attr]
result["blockscout_params"][sub_attr] = sub_value
elif attr == "dora_params":
for sub_attr in input_args["dora_params"]:
sub_value = input_args["dora_params"][sub_attr]
Expand Down Expand Up @@ -355,6 +361,10 @@ def input_parser(plan, input_args):
)
if result["mev_params"]
else None,
blockscout_params=struct(
image=result["blockscout_params"]["image"],
verif_image=result["blockscout_params"]["verif_image"],
),
dora_params=struct(
image=result["dora_params"]["image"],
env=result["dora_params"]["env"],
Expand Down Expand Up @@ -999,6 +1009,13 @@ def default_participant():
}


def get_default_blockscout_params():
return {
"image": "blockscout/blockscout:6.8.0",
"verif_image": "ghcr.io/blockscout/smart-contract-verifier:v1.9.0",
}


def get_default_dora_params():
return {
"image": "ethpandaops/dora:latest",
Expand Down
4 changes: 4 additions & 0 deletions src/package_io/sanity_check.star
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ SUBCATEGORY_PARAMS = {
"devnet_repo",
"prefunded_accounts",
],
"blockscout_params": [
"image",
"verif_image",
],
"dora_params": [
"image",
"env",
Expand Down

0 comments on commit 777ec06

Please sign in to comment.