Commit ce1f3373 authored by Barnabas Busa's avatar Barnabas Busa Committed by GitHub

fix: beaconchain explorer (#538)

parent 8ef5c57f
...@@ -395,6 +395,7 @@ def run(plan, args={}): ...@@ -395,6 +395,7 @@ def run(plan, args={}):
full_beaconchain_explorer.launch_full_beacon( full_beaconchain_explorer.launch_full_beacon(
plan, plan,
full_beaconchain_explorer_config_template, full_beaconchain_explorer_config_template,
el_cl_data_files_artifact_uuid,
all_cl_contexts, all_cl_contexts,
all_el_contexts, all_el_contexts,
persistent, persistent,
......
def new_cl_context( def new_cl_context(
client_name, client_name,
enr, enr,
ip_addr,
http_port,
beacon_http_url, beacon_http_url,
cl_nodes_metrics_info, cl_nodes_metrics_info,
beacon_service_name, beacon_service_name,
...@@ -14,6 +16,8 @@ def new_cl_context( ...@@ -14,6 +16,8 @@ def new_cl_context(
return struct( return struct(
client_name=client_name, client_name=client_name,
enr=enr, enr=enr,
ip_addr=ip_addr,
http_port=http_port,
beacon_http_url=beacon_http_url, beacon_http_url=beacon_http_url,
cl_nodes_metrics_info=cl_nodes_metrics_info, cl_nodes_metrics_info=cl_nodes_metrics_info,
beacon_service_name=beacon_service_name, beacon_service_name=beacon_service_name,
......
...@@ -187,6 +187,8 @@ def launch( ...@@ -187,6 +187,8 @@ def launch(
return cl_context.new_cl_context( return cl_context.new_cl_context(
"grandine", "grandine",
beacon_node_enr, beacon_node_enr,
beacon_service.ip_address,
beacon_http_port.number,
beacon_http_url, beacon_http_url,
nodes_metrics_info, nodes_metrics_info,
beacon_service_name, beacon_service_name,
......
...@@ -204,6 +204,8 @@ def launch( ...@@ -204,6 +204,8 @@ def launch(
return cl_context.new_cl_context( return cl_context.new_cl_context(
"lighthouse", "lighthouse",
beacon_node_enr, beacon_node_enr,
beacon_service.ip_address,
beacon_http_port.number,
beacon_http_url, beacon_http_url,
nodes_metrics_info, nodes_metrics_info,
beacon_service_name, beacon_service_name,
......
...@@ -196,6 +196,8 @@ def launch( ...@@ -196,6 +196,8 @@ def launch(
return cl_context.new_cl_context( return cl_context.new_cl_context(
"lodestar", "lodestar",
beacon_node_enr, beacon_node_enr,
beacon_service.ip_address,
beacon_http_port.number,
beacon_http_url, beacon_http_url,
nodes_metrics_info, nodes_metrics_info,
beacon_service_name, beacon_service_name,
......
...@@ -199,6 +199,8 @@ def launch( ...@@ -199,6 +199,8 @@ def launch(
return cl_context.new_cl_context( return cl_context.new_cl_context(
"nimbus", "nimbus",
beacon_node_enr, beacon_node_enr,
beacon_service.ip_address,
beacon_http_port.number,
beacon_http_url, beacon_http_url,
nodes_metrics_info, nodes_metrics_info,
beacon_service_name, beacon_service_name,
......
...@@ -180,6 +180,8 @@ def launch( ...@@ -180,6 +180,8 @@ def launch(
return cl_context.new_cl_context( return cl_context.new_cl_context(
"prysm", "prysm",
beacon_node_enr, beacon_node_enr,
beacon_service.ip_address,
beacon_http_port.number,
beacon_http_url, beacon_http_url,
nodes_metrics_info, nodes_metrics_info,
beacon_service_name, beacon_service_name,
......
...@@ -192,6 +192,8 @@ def launch( ...@@ -192,6 +192,8 @@ def launch(
return cl_context.new_cl_context( return cl_context.new_cl_context(
"teku", "teku",
beacon_node_enr, beacon_node_enr,
beacon_service.ip_address,
beacon_http_port.number,
beacon_http_url, beacon_http_url,
nodes_metrics_info, nodes_metrics_info,
beacon_service_name, beacon_service_name,
......
shared_utils = import_module("../shared_utils/shared_utils.star") shared_utils = import_module("../shared_utils/shared_utils.star")
postgres = import_module("github.com/kurtosis-tech/postgres-package/main.star") postgres = import_module("github.com/kurtosis-tech/postgres-package/main.star")
redis = import_module("github.com/kurtosis-tech/redis-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" IMAGE_NAME = "gobitfly/eth2-beaconchain-explorer:latest"
POSTGRES_PORT_ID = "postgres" POSTGRES_PORT_ID = "postgres"
...@@ -19,8 +19,7 @@ FRONTEND_PORT_NUMBER = 8080 ...@@ -19,8 +19,7 @@ FRONTEND_PORT_NUMBER = 8080
LITTLE_BIGTABLE_PORT_ID = "littlebigtable" LITTLE_BIGTABLE_PORT_ID = "littlebigtable"
LITTLE_BIGTABLE_PORT_NUMBER = 9000 LITTLE_BIGTABLE_PORT_NUMBER = 9000
FULL_BEACONCHAIN_CONFIG_FILENAME = "config.yml" FULL_BEACONCHAIN_CONFIG_FILENAME = "beaconchain-config.yml"
USED_PORTS = { USED_PORTS = {
FRONTEND_PORT_ID: shared_utils.new_port_spec( FRONTEND_PORT_ID: shared_utils.new_port_spec(
...@@ -94,6 +93,7 @@ FRONTEND_MAX_MEMORY = 2048 ...@@ -94,6 +93,7 @@ FRONTEND_MAX_MEMORY = 2048
def launch_full_beacon( def launch_full_beacon(
plan, plan,
config_template, config_template,
el_cl_data_files_artifact_uuid,
cl_contexts, cl_contexts,
el_contexts, el_contexts,
persistent, persistent,
...@@ -147,16 +147,14 @@ def launch_full_beacon( ...@@ -147,16 +147,14 @@ def launch_full_beacon(
) )
redis_url = "{}:{}".format(redis_output.hostname, redis_output.port_number) 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( template_data = new_config_template_data(
cl_url, cl_contexts[0].ip_addr,
cl_port, cl_contexts[0].http_port,
cl_contexts[0].client_name,
el_uri, el_uri,
little_bigtable.ip_address, little_bigtable.ip_address,
LITTLE_BIGTABLE_PORT_NUMBER, LITTLE_BIGTABLE_PORT_NUMBER,
postgres_output.url, postgres_output.service.name,
POSTGRES_PORT_NUMBER, POSTGRES_PORT_NUMBER,
redis_url, redis_url,
FRONTEND_PORT_NUMBER, FRONTEND_PORT_NUMBER,
...@@ -171,17 +169,20 @@ def launch_full_beacon( ...@@ -171,17 +169,20 @@ def launch_full_beacon(
] = template_and_data ] = template_and_data
config_files_artifact_name = plan.render_templates( 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 # Initialize the db schema
initdbschema = plan.add_service( initdbschema = plan.add_service(
name="beaconchain-schema-initializer", name="beaconchain-schema-initializer",
config=ServiceConfig( config=ServiceConfig(
image=IMAGE_NAME, image=IMAGE_NAME,
files={ files=files,
"/app/config/": config_files_artifact_name,
},
entrypoint=["tail", "-f", "/dev/null"], entrypoint=["tail", "-f", "/dev/null"],
min_cpu=INIT_MIN_CPU, min_cpu=INIT_MIN_CPU,
max_cpu=INIT_MAX_CPU, max_cpu=INIT_MAX_CPU,
...@@ -195,7 +196,13 @@ def launch_full_beacon( ...@@ -195,7 +196,13 @@ def launch_full_beacon(
plan.exec( plan.exec(
service_name=initdbschema.name, service_name=initdbschema.name,
recipe=ExecRecipe( recipe=ExecRecipe(
["./misc", "-config", "/app/config/config.yml", "-command", "applyDbSchema"] [
"./misc",
"-config",
"/app/config/beaconchain-config.yml",
"-command",
"applyDbSchema",
]
), ),
) )
...@@ -207,7 +214,7 @@ def launch_full_beacon( ...@@ -207,7 +214,7 @@ def launch_full_beacon(
[ [
"./misc", "./misc",
"-config", "-config",
"/app/config/config.yml", "/app/config/beaconchain-config.yml",
"-command", "-command",
"initBigtableSchema", "initBigtableSchema",
] ]
...@@ -219,13 +226,11 @@ def launch_full_beacon( ...@@ -219,13 +226,11 @@ def launch_full_beacon(
name="beaconchain-indexer", name="beaconchain-indexer",
config=ServiceConfig( config=ServiceConfig(
image=IMAGE_NAME, image=IMAGE_NAME,
files={ files=files,
"/app/config/": config_files_artifact_name,
},
entrypoint=["./explorer"], entrypoint=["./explorer"],
cmd=[ cmd=[
"-config", "-config",
"/app/config/config.yml", "/app/config/beaconchain-config.yml",
], ],
env_vars={ env_vars={
"INDEXER_ENABLED": "TRUE", "INDEXER_ENABLED": "TRUE",
...@@ -242,13 +247,11 @@ def launch_full_beacon( ...@@ -242,13 +247,11 @@ def launch_full_beacon(
name="beaconchain-eth1indexer", name="beaconchain-eth1indexer",
config=ServiceConfig( config=ServiceConfig(
image=IMAGE_NAME, image=IMAGE_NAME,
files={ files=files,
"/app/config/": config_files_artifact_name,
},
entrypoint=["./eth1indexer"], entrypoint=["./eth1indexer"],
cmd=[ cmd=[
"-config", "-config",
"/app/config/config.yml", "/app/config/beaconchain-config.yml",
"-blocks.concurrency", "-blocks.concurrency",
"1", "1",
"-blocks.tracemode", "-blocks.tracemode",
...@@ -269,13 +272,11 @@ def launch_full_beacon( ...@@ -269,13 +272,11 @@ def launch_full_beacon(
name="beaconchain-rewardsexporter", name="beaconchain-rewardsexporter",
config=ServiceConfig( config=ServiceConfig(
image=IMAGE_NAME, image=IMAGE_NAME,
files={ files=files,
"/app/config/": config_files_artifact_name,
},
entrypoint=["./rewards-exporter"], entrypoint=["./rewards-exporter"],
cmd=[ cmd=[
"-config", "-config",
"/app/config/config.yml", "/app/config/beaconchain-config.yml",
], ],
min_cpu=REWARDSEXPORTER_MIN_CPU, min_cpu=REWARDSEXPORTER_MIN_CPU,
max_cpu=REWARDSEXPORTER_MAX_CPU, max_cpu=REWARDSEXPORTER_MAX_CPU,
...@@ -289,13 +290,11 @@ def launch_full_beacon( ...@@ -289,13 +290,11 @@ def launch_full_beacon(
name="beaconchain-statistics", name="beaconchain-statistics",
config=ServiceConfig( config=ServiceConfig(
image=IMAGE_NAME, image=IMAGE_NAME,
files={ files=files,
"/app/config/": config_files_artifact_name,
},
entrypoint=["./statistics"], entrypoint=["./statistics"],
cmd=[ cmd=[
"-config", "-config",
"/app/config/config.yml", "/app/config/beaconchain-config.yml",
"-charts.enabled", "-charts.enabled",
"-graffiti.enabled", "-graffiti.enabled",
"-validators.enabled", "-validators.enabled",
...@@ -312,13 +311,11 @@ def launch_full_beacon( ...@@ -312,13 +311,11 @@ def launch_full_beacon(
name="beaconchain-fdu", name="beaconchain-fdu",
config=ServiceConfig( config=ServiceConfig(
image=IMAGE_NAME, image=IMAGE_NAME,
files={ files=files,
"/app/config/": config_files_artifact_name,
},
entrypoint=["./frontend-data-updater"], entrypoint=["./frontend-data-updater"],
cmd=[ cmd=[
"-config", "-config",
"/app/config/config.yml", "/app/config/beaconchain-config.yml",
], ],
min_cpu=FDU_MIN_CPU, min_cpu=FDU_MIN_CPU,
max_cpu=FDU_MAX_CPU, max_cpu=FDU_MAX_CPU,
...@@ -332,13 +329,11 @@ def launch_full_beacon( ...@@ -332,13 +329,11 @@ def launch_full_beacon(
name="beaconchain-frontend", name="beaconchain-frontend",
config=ServiceConfig( config=ServiceConfig(
image=IMAGE_NAME, image=IMAGE_NAME,
files={ files=files,
"/app/config/": config_files_artifact_name,
},
entrypoint=["./explorer"], entrypoint=["./explorer"],
cmd=[ cmd=[
"-config", "-config",
"/app/config/config.yml", "/app/config/beaconchain-config.yml",
], ],
env_vars={ env_vars={
"FRONTEND_ENABLED": "TRUE", "FRONTEND_ENABLED": "TRUE",
...@@ -360,6 +355,7 @@ def launch_full_beacon( ...@@ -360,6 +355,7 @@ def launch_full_beacon(
def new_config_template_data( def new_config_template_data(
cl_url, cl_url,
cl_port, cl_port,
cl_type,
el_uri, el_uri,
lbt_host, lbt_host,
lbt_port, lbt_port,
...@@ -371,9 +367,13 @@ def new_config_template_data( ...@@ -371,9 +367,13 @@ def new_config_template_data(
return { return {
"CLNodeHost": cl_url, "CLNodeHost": cl_url,
"CLNodePort": cl_port, "CLNodePort": cl_port,
"CLNodeType": cl_type,
"ELNodeEndpoint": el_uri, "ELNodeEndpoint": el_uri,
"LBTHost": lbt_host, "LBTHost": lbt_host,
"LBTPort": lbt_port, "LBTPort": lbt_port,
"DBName": POSTGRES_DB,
"DBUser": POSTGRES_USER,
"DBPass": POSTGRES_PASSWORD,
"DBHost": db_host, "DBHost": db_host,
"DBPort": db_port, "DBPort": db_port,
"RedisEndpoint": redis_url, "RedisEndpoint": redis_url,
......
chain: chain:
configPath: 'node' clConfigPath: 'node'
elConfigPath: '/network-configs/network-configs/genesis.json'
readerDatabase: readerDatabase:
name: db name: {{.DBName}}
host: {{.DBHost}} host: {{.DBHost}}
port: {{.DBPort}} port: {{.DBPort}}
user: postgres user: {{.DBUser}}
password: "pass" password: {{.DBPass}}
writerDatabase: writerDatabase:
name: db name: {{.DBName}}
host: {{.DBHost}} host: {{.DBHost}}
port: {{.DBPort}} port: {{.DBPort}}
user: postgres user: {{.DBUser}}
password: "pass" password: {{.DBPass}}
bigtable: bigtable:
project: explorer project: explorer
instance: explorer instance: explorer
...@@ -30,17 +31,17 @@ frontend: ...@@ -30,17 +31,17 @@ frontend:
host: '0.0.0.0' # Address to listen on host: '0.0.0.0' # Address to listen on
port: '{{.FrontendPort}}' # Port to listen on port: '{{.FrontendPort}}' # Port to listen on
readerDatabase: readerDatabase:
name: db name: {{.DBName}}
host: {{.DBHost}} host: {{.DBHost}}
port: {{.DBPort}} port: {{.DBPort}}
user: postgres user: {{.DBUser}}
password: "pass" password: {{.DBPass}}
writerDatabase: writerDatabase:
name: db name: {{.DBName}}
host: {{.DBHost}} host: {{.DBHost}}
port: {{.DBPort}} port: {{.DBPort}}
user: postgres user: {{.DBUser}}
password: "pass" password: {{.DBPass}}
sessionSecret: "11111111111111111111111111111111" sessionSecret: "11111111111111111111111111111111"
jwtSigningSecret: "1111111111111111111111111111111111111111111111111111111111111111" jwtSigningSecret: "1111111111111111111111111111111111111111111111111111111111111111"
jwtIssuer: "localhost" jwtIssuer: "localhost"
...@@ -58,5 +59,5 @@ indexer: ...@@ -58,5 +59,5 @@ indexer:
node: node:
host: '{{.CLNodeHost}}' host: '{{.CLNodeHost}}'
port: '{{.CLNodePort}}' port: '{{.CLNodePort}}'
type: lighthouse type: '{{.CLNodeType}}'
eth1DepositContractFirstBlock: 0 eth1DepositContractFirstBlock: 0
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