diff --git a/main.star b/main.star index 44b048d38..581fe7c9a 100644 --- a/main.star +++ b/main.star @@ -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, diff --git a/src/cl/cl_context.star b/src/cl/cl_context.star index d54d4fbe8..58e983be3 100644 --- a/src/cl/cl_context.star +++ b/src/cl/cl_context.star @@ -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, @@ -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, diff --git a/src/cl/grandine/grandine_launcher.star b/src/cl/grandine/grandine_launcher.star index 46bf3a418..e1188b9de 100644 --- a/src/cl/grandine/grandine_launcher.star +++ b/src/cl/grandine/grandine_launcher.star @@ -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, diff --git a/src/cl/lighthouse/lighthouse_launcher.star b/src/cl/lighthouse/lighthouse_launcher.star index fbe2de1b7..1c404c966 100644 --- a/src/cl/lighthouse/lighthouse_launcher.star +++ b/src/cl/lighthouse/lighthouse_launcher.star @@ -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, diff --git a/src/cl/lodestar/lodestar_launcher.star b/src/cl/lodestar/lodestar_launcher.star index 7b0301c4f..d6f422392 100644 --- a/src/cl/lodestar/lodestar_launcher.star +++ b/src/cl/lodestar/lodestar_launcher.star @@ -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, diff --git a/src/cl/nimbus/nimbus_launcher.star b/src/cl/nimbus/nimbus_launcher.star index 7e619ed94..712a9d050 100644 --- a/src/cl/nimbus/nimbus_launcher.star +++ b/src/cl/nimbus/nimbus_launcher.star @@ -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, diff --git a/src/cl/prysm/prysm_launcher.star b/src/cl/prysm/prysm_launcher.star index 0b4d59723..e738daefa 100644 --- a/src/cl/prysm/prysm_launcher.star +++ b/src/cl/prysm/prysm_launcher.star @@ -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, diff --git a/src/cl/teku/teku_launcher.star b/src/cl/teku/teku_launcher.star index bec521a74..537f6c54a 100644 --- a/src/cl/teku/teku_launcher.star +++ b/src/cl/teku/teku_launcher.star @@ -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, diff --git a/src/full_beaconchain/full_beaconchain_launcher.star b/src/full_beaconchain/full_beaconchain_launcher.star index 3de037a2d..ff663f15b 100644 --- a/src/full_beaconchain/full_beaconchain_launcher.star +++ b/src/full_beaconchain/full_beaconchain_launcher.star @@ -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" @@ -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( @@ -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, @@ -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, @@ -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, @@ -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", + ] ), ) @@ -207,7 +214,7 @@ def launch_full_beacon( [ "./misc", "-config", - "/app/config/config.yml", + "/app/config/beaconchain-config.yml", "-command", "initBigtableSchema", ] @@ -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", @@ -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", @@ -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, @@ -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", @@ -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, @@ -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", @@ -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, @@ -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, diff --git a/static_files/full-beaconchain-config/config.yaml.tmpl b/static_files/full-beaconchain-config/config.yaml.tmpl index 1bd1de883..b4ece4298 100644 --- a/static_files/full-beaconchain-config/config.yaml.tmpl +++ b/static_files/full-beaconchain-config/config.yaml.tmpl @@ -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 @@ -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" @@ -58,5 +59,5 @@ indexer: node: host: '{{.CLNodeHost}}' port: '{{.CLNodePort}}' - type: lighthouse + type: '{{.CLNodeType}}' eth1DepositContractFirstBlock: 0