diff --git a/src/ethereum_metrics_exporter/ethereum_metrics_exporter_launcher.star b/src/ethereum_metrics_exporter/ethereum_metrics_exporter_launcher.star index 4fc6a2fd5..21c564133 100644 --- a/src/ethereum_metrics_exporter/ethereum_metrics_exporter_launcher.star +++ b/src/ethereum_metrics_exporter/ethereum_metrics_exporter_launcher.star @@ -6,6 +6,9 @@ ethereum_metrics_exporter_context = import_module( HTTP_PORT_ID = "http" METRICS_PORT_NUMBER = 9090 +path_to_el_db = "/data/execution-db" +path_to_cl_db = "/data/consensus-db" + DEFAULT_ETHEREUM_METRICS_EXPORTER_IMAGE = "ethpandaops/ethereum-metrics-exporter:latest" # The min/max CPU/memory that ethereum-metrics-exporter can use @@ -25,6 +28,7 @@ def launch( port_publisher, global_other_index, docker_cache_params, + persistent, ): public_ports = shared_utils.get_other_public_port( port_publisher, @@ -32,7 +36,33 @@ def launch( global_other_index, 0, ) + files = {} + cmd = [ + "--metrics-port", + str(METRICS_PORT_NUMBER), + "--consensus-url", + "{0}".format( + cl_context.beacon_http_url, + ), + "--execution-url", + "http://{}:{}".format( + el_context.ip_addr, + el_context.rpc_port_num, + ), + ] + + if persistent: + cmd.append("--monitored-directories") + cmd.append(path_to_cl_db) + cmd.append("--monitored-directories") + cmd.append(path_to_el_db) + files[path_to_el_db] = Directory( + persistent_key="data-{0}".format(el_context.service_name), + ) + files[path_to_cl_db] = Directory( + persistent_key="data-{0}".format(cl_context.beacon_service_name), + ) exporter_service = plan.add_service( ethereum_metrics_exporter_service_name, ServiceConfig( @@ -48,19 +78,8 @@ def launch( ) }, public_ports=public_ports, - cmd=[ - "--metrics-port", - str(METRICS_PORT_NUMBER), - "--consensus-url", - "{0}".format( - cl_context.beacon_http_url, - ), - "--execution-url", - "http://{}:{}".format( - el_context.ip_addr, - el_context.rpc_port_num, - ), - ], + cmd=cmd, + files=files, min_cpu=MIN_CPU, max_cpu=MAX_CPU, min_memory=MIN_MEMORY, diff --git a/src/participant_network.star b/src/participant_network.star index cc1312dc4..1567e37f2 100644 --- a/src/participant_network.star +++ b/src/participant_network.star @@ -230,6 +230,7 @@ def launch_participant_network( args_with_right_defaults.port_publisher, global_other_index, args_with_right_defaults.docker_cache_params, + persistent, ) global_other_index += 1 plan.print(