forked from ethpandaops/ethereum-package
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c38bff9
commit 2a8ad19
Showing
9 changed files
with
113 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
shared_utils = import_module("github.com/kurtosis-tech/eth2-package/src/shared_utils/shared_utils.star") | ||
|
||
|
||
SERVICE_NAME = "el-forkmon" | ||
IMAGE_NAME = "skylenet/nodemonitor:darkmode" | ||
|
||
HTTP_PORT_ID = "http" | ||
HTTP_PORT_NUMBER = 8080 | ||
|
||
EL_FORKMON_CONFIG_FILENAME = "el-forkmon-config.toml" | ||
|
||
EL_FORKMON_CONFIG_MOUNT_DIRPATH_ON_SERVICE = "/config" | ||
|
||
USED_PORTS = { | ||
HTTP_PORT_ID:shared_utils.new_port_spec(HTTP_PORT_NUMBER, shared_utils.TCP_PROTOCOL, shared_utils.HTTP_APPLICATION_PROTOCOL) | ||
} | ||
|
||
|
||
def launch_el_forkmon( | ||
plan, | ||
config_template, | ||
el_client_contexts, | ||
): | ||
|
||
all_el_client_info = [] | ||
for client in el_client_contexts: | ||
client_info = new_el_client_info(client.ip_addr, client.rpc_port_num, client.service_name) | ||
all_el_client_info.append(client_info) | ||
|
||
template_data = new_config_template_data(HTTP_PORT_NUMBER, all_el_client_info) | ||
|
||
template_and_data = shared_utils.new_template_and_data(config_template, template_data) | ||
template_and_data_by_rel_dest_filepath = {} | ||
template_and_data_by_rel_dest_filepath[EL_FORKMON_CONFIG_FILENAME] = template_and_data | ||
|
||
config_files_artifact_name = plan.render_templates(template_and_data_by_rel_dest_filepath, "el-forkmon-config") | ||
|
||
config = get_config(config_files_artifact_name) | ||
|
||
plan.add_service(SERVICE_NAME, config) | ||
|
||
|
||
def get_config(config_files_artifact_name): | ||
config_file_path = shared_utils.path_join(EL_FORKMON_CONFIG_MOUNT_DIRPATH_ON_SERVICE, EL_FORKMON_CONFIG_FILENAME) | ||
return ServiceConfig( | ||
image = IMAGE_NAME, | ||
ports = USED_PORTS, | ||
files = { | ||
EL_FORKMON_CONFIG_MOUNT_DIRPATH_ON_SERVICE: config_files_artifact_name, | ||
}, | ||
cmd = [config_file_path] | ||
) | ||
|
||
|
||
def new_config_template_data(listen_port_num, el_client_info): | ||
return { | ||
"ListenPortNum": listen_port_num, | ||
"ELClientInfo": el_client_info, | ||
} | ||
|
||
|
||
def new_el_client_info(ip_addr, port_num, service_name): | ||
return { | ||
"IPAddr": ip_addr, | ||
"PortNum": port_num, | ||
"Name": service_name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# How often to reload data from the nodes | ||
reload_interval = "10s" | ||
# If specified, a http server will serve static content here | ||
server_address = "0.0.0.0:{{ .ListenPortNum }}" | ||
# Shown in the document title, if specified | ||
chain_name="kurtosis-chain" | ||
# Local or non third party connection require rpc kind | ||
{{ range $elClient := .ELClientInfo }} | ||
[[clients]] | ||
url = "http://{{ $elClient.IPAddr }}:{{ $elClient.PortNum }}" | ||
name = "{{ $elClient.Name }}" | ||
kind = "rpc" | ||
{{- end }} |