Skip to content

Commit

Permalink
fix: beaconchain explorer (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasbusa authored Apr 3, 2024
1 parent 8ef5c57 commit ce1f337
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 53 deletions.
1 change: 1 addition & 0 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ def run(plan, args={}):
full_beaconchain_explorer.launch_full_beacon(
plan,
full_beaconchain_explorer_config_template,
el_cl_data_files_artifact_uuid,
all_cl_contexts,
all_el_contexts,
persistent,
Expand Down
4 changes: 4 additions & 0 deletions src/cl/cl_context.star
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
def new_cl_context(
client_name,
enr,
ip_addr,
http_port,
beacon_http_url,
cl_nodes_metrics_info,
beacon_service_name,
Expand All @@ -14,6 +16,8 @@ def new_cl_context(
return struct(
client_name=client_name,
enr=enr,
ip_addr=ip_addr,
http_port=http_port,
beacon_http_url=beacon_http_url,
cl_nodes_metrics_info=cl_nodes_metrics_info,
beacon_service_name=beacon_service_name,
Expand Down
2 changes: 2 additions & 0 deletions src/cl/grandine/grandine_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ def launch(
return cl_context.new_cl_context(
"grandine",
beacon_node_enr,
beacon_service.ip_address,
beacon_http_port.number,
beacon_http_url,
nodes_metrics_info,
beacon_service_name,
Expand Down
2 changes: 2 additions & 0 deletions src/cl/lighthouse/lighthouse_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ def launch(
return cl_context.new_cl_context(
"lighthouse",
beacon_node_enr,
beacon_service.ip_address,
beacon_http_port.number,
beacon_http_url,
nodes_metrics_info,
beacon_service_name,
Expand Down
2 changes: 2 additions & 0 deletions src/cl/lodestar/lodestar_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ def launch(
return cl_context.new_cl_context(
"lodestar",
beacon_node_enr,
beacon_service.ip_address,
beacon_http_port.number,
beacon_http_url,
nodes_metrics_info,
beacon_service_name,
Expand Down
2 changes: 2 additions & 0 deletions src/cl/nimbus/nimbus_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ def launch(
return cl_context.new_cl_context(
"nimbus",
beacon_node_enr,
beacon_service.ip_address,
beacon_http_port.number,
beacon_http_url,
nodes_metrics_info,
beacon_service_name,
Expand Down
2 changes: 2 additions & 0 deletions src/cl/prysm/prysm_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ def launch(
return cl_context.new_cl_context(
"prysm",
beacon_node_enr,
beacon_service.ip_address,
beacon_http_port.number,
beacon_http_url,
nodes_metrics_info,
beacon_service_name,
Expand Down
2 changes: 2 additions & 0 deletions src/cl/teku/teku_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ def launch(
return cl_context.new_cl_context(
"teku",
beacon_node_enr,
beacon_service.ip_address,
beacon_http_port.number,
beacon_http_url,
nodes_metrics_info,
beacon_service_name,
Expand Down
78 changes: 39 additions & 39 deletions src/full_beaconchain/full_beaconchain_launcher.star
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
shared_utils = import_module("../shared_utils/shared_utils.star")
postgres = import_module("github.com/kurtosis-tech/postgres-package/main.star")
redis = import_module("github.com/kurtosis-tech/redis-package/main.star")

constants = import_module("../package_io/constants.star")
IMAGE_NAME = "gobitfly/eth2-beaconchain-explorer:latest"

POSTGRES_PORT_ID = "postgres"
Expand All @@ -19,8 +19,7 @@ FRONTEND_PORT_NUMBER = 8080
LITTLE_BIGTABLE_PORT_ID = "littlebigtable"
LITTLE_BIGTABLE_PORT_NUMBER = 9000

FULL_BEACONCHAIN_CONFIG_FILENAME = "config.yml"

FULL_BEACONCHAIN_CONFIG_FILENAME = "beaconchain-config.yml"

USED_PORTS = {
FRONTEND_PORT_ID: shared_utils.new_port_spec(
Expand Down Expand Up @@ -94,6 +93,7 @@ FRONTEND_MAX_MEMORY = 2048
def launch_full_beacon(
plan,
config_template,
el_cl_data_files_artifact_uuid,
cl_contexts,
el_contexts,
persistent,
Expand Down Expand Up @@ -147,16 +147,14 @@ def launch_full_beacon(
)
redis_url = "{}:{}".format(redis_output.hostname, redis_output.port_number)

cl_url = cl_contexts[0].beacon_http_url[7:] # Remove the "http://"
cl_port = cl_contexts[0].beacon_http_url.split(":")[2] # Get the port number

template_data = new_config_template_data(
cl_url,
cl_port,
cl_contexts[0].ip_addr,
cl_contexts[0].http_port,
cl_contexts[0].client_name,
el_uri,
little_bigtable.ip_address,
LITTLE_BIGTABLE_PORT_NUMBER,
postgres_output.url,
postgres_output.service.name,
POSTGRES_PORT_NUMBER,
redis_url,
FRONTEND_PORT_NUMBER,
Expand All @@ -171,17 +169,20 @@ def launch_full_beacon(
] = template_and_data

config_files_artifact_name = plan.render_templates(
template_and_data_by_rel_dest_filepath, "config.yml"
template_and_data_by_rel_dest_filepath, "beaconchain-config.yml"
)

files = {
"/app/config/": config_files_artifact_name,
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_data_files_artifact_uuid,
}

# Initialize the db schema
initdbschema = plan.add_service(
name="beaconchain-schema-initializer",
config=ServiceConfig(
image=IMAGE_NAME,
files={
"/app/config/": config_files_artifact_name,
},
files=files,
entrypoint=["tail", "-f", "/dev/null"],
min_cpu=INIT_MIN_CPU,
max_cpu=INIT_MAX_CPU,
Expand All @@ -195,7 +196,13 @@ def launch_full_beacon(
plan.exec(
service_name=initdbschema.name,
recipe=ExecRecipe(
["./misc", "-config", "/app/config/config.yml", "-command", "applyDbSchema"]
[
"./misc",
"-config",
"/app/config/beaconchain-config.yml",
"-command",
"applyDbSchema",
]
),
)

Expand All @@ -207,7 +214,7 @@ def launch_full_beacon(
[
"./misc",
"-config",
"/app/config/config.yml",
"/app/config/beaconchain-config.yml",
"-command",
"initBigtableSchema",
]
Expand All @@ -219,13 +226,11 @@ def launch_full_beacon(
name="beaconchain-indexer",
config=ServiceConfig(
image=IMAGE_NAME,
files={
"/app/config/": config_files_artifact_name,
},
files=files,
entrypoint=["./explorer"],
cmd=[
"-config",
"/app/config/config.yml",
"/app/config/beaconchain-config.yml",
],
env_vars={
"INDEXER_ENABLED": "TRUE",
Expand All @@ -242,13 +247,11 @@ def launch_full_beacon(
name="beaconchain-eth1indexer",
config=ServiceConfig(
image=IMAGE_NAME,
files={
"/app/config/": config_files_artifact_name,
},
files=files,
entrypoint=["./eth1indexer"],
cmd=[
"-config",
"/app/config/config.yml",
"/app/config/beaconchain-config.yml",
"-blocks.concurrency",
"1",
"-blocks.tracemode",
Expand All @@ -269,13 +272,11 @@ def launch_full_beacon(
name="beaconchain-rewardsexporter",
config=ServiceConfig(
image=IMAGE_NAME,
files={
"/app/config/": config_files_artifact_name,
},
files=files,
entrypoint=["./rewards-exporter"],
cmd=[
"-config",
"/app/config/config.yml",
"/app/config/beaconchain-config.yml",
],
min_cpu=REWARDSEXPORTER_MIN_CPU,
max_cpu=REWARDSEXPORTER_MAX_CPU,
Expand All @@ -289,13 +290,11 @@ def launch_full_beacon(
name="beaconchain-statistics",
config=ServiceConfig(
image=IMAGE_NAME,
files={
"/app/config/": config_files_artifact_name,
},
files=files,
entrypoint=["./statistics"],
cmd=[
"-config",
"/app/config/config.yml",
"/app/config/beaconchain-config.yml",
"-charts.enabled",
"-graffiti.enabled",
"-validators.enabled",
Expand All @@ -312,13 +311,11 @@ def launch_full_beacon(
name="beaconchain-fdu",
config=ServiceConfig(
image=IMAGE_NAME,
files={
"/app/config/": config_files_artifact_name,
},
files=files,
entrypoint=["./frontend-data-updater"],
cmd=[
"-config",
"/app/config/config.yml",
"/app/config/beaconchain-config.yml",
],
min_cpu=FDU_MIN_CPU,
max_cpu=FDU_MAX_CPU,
Expand All @@ -332,13 +329,11 @@ def launch_full_beacon(
name="beaconchain-frontend",
config=ServiceConfig(
image=IMAGE_NAME,
files={
"/app/config/": config_files_artifact_name,
},
files=files,
entrypoint=["./explorer"],
cmd=[
"-config",
"/app/config/config.yml",
"/app/config/beaconchain-config.yml",
],
env_vars={
"FRONTEND_ENABLED": "TRUE",
Expand All @@ -360,6 +355,7 @@ def launch_full_beacon(
def new_config_template_data(
cl_url,
cl_port,
cl_type,
el_uri,
lbt_host,
lbt_port,
Expand All @@ -371,9 +367,13 @@ def new_config_template_data(
return {
"CLNodeHost": cl_url,
"CLNodePort": cl_port,
"CLNodeType": cl_type,
"ELNodeEndpoint": el_uri,
"LBTHost": lbt_host,
"LBTPort": lbt_port,
"DBName": POSTGRES_DB,
"DBUser": POSTGRES_USER,
"DBPass": POSTGRES_PASSWORD,
"DBHost": db_host,
"DBPort": db_port,
"RedisEndpoint": redis_url,
Expand Down
29 changes: 15 additions & 14 deletions static_files/full-beaconchain-config/config.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
chain:
configPath: 'node'
clConfigPath: 'node'
elConfigPath: '/network-configs/network-configs/genesis.json'
readerDatabase:
name: db
name: {{.DBName}}
host: {{.DBHost}}
port: {{.DBPort}}
user: postgres
password: "pass"
user: {{.DBUser}}
password: {{.DBPass}}
writerDatabase:
name: db
name: {{.DBName}}
host: {{.DBHost}}
port: {{.DBPort}}
user: postgres
password: "pass"
user: {{.DBUser}}
password: {{.DBPass}}
bigtable:
project: explorer
instance: explorer
Expand All @@ -30,17 +31,17 @@ frontend:
host: '0.0.0.0' # Address to listen on
port: '{{.FrontendPort}}' # Port to listen on
readerDatabase:
name: db
name: {{.DBName}}
host: {{.DBHost}}
port: {{.DBPort}}
user: postgres
password: "pass"
user: {{.DBUser}}
password: {{.DBPass}}
writerDatabase:
name: db
name: {{.DBName}}
host: {{.DBHost}}
port: {{.DBPort}}
user: postgres
password: "pass"
user: {{.DBUser}}
password: {{.DBPass}}
sessionSecret: "11111111111111111111111111111111"
jwtSigningSecret: "1111111111111111111111111111111111111111111111111111111111111111"
jwtIssuer: "localhost"
Expand All @@ -58,5 +59,5 @@ indexer:
node:
host: '{{.CLNodeHost}}'
port: '{{.CLNodePort}}'
type: lighthouse
type: '{{.CLNodeType}}'
eth1DepositContractFirstBlock: 0

0 comments on commit ce1f337

Please sign in to comment.