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

feat: add tracoor (#651)

cc: @samcm

min config:
```yaml
 additional_services:
  - tracoor
```

---------
Co-authored-by: default avatarSam Calder-Mason <sam@puritydev.io>
parent e79c5101
...@@ -25,6 +25,7 @@ additional_services: ...@@ -25,6 +25,7 @@ additional_services:
- dugtrio - dugtrio
- blutgang - blutgang
- apache - apache
- tracoor
ethereum_metrics_exporter_enabled: true ethereum_metrics_exporter_enabled: true
snooper_enabled: true snooper_enabled: true
mev_type: flashbots mev_type: flashbots
......
...@@ -27,6 +27,7 @@ additional_services: ...@@ -27,6 +27,7 @@ additional_services:
- dugtrio - dugtrio
- blutgang - blutgang
- apache - apache
- tracoor
ethereum_metrics_exporter_enabled: true ethereum_metrics_exporter_enabled: true
snooper_enabled: true snooper_enabled: true
keymanager_enabled: true keymanager_enabled: true
...@@ -27,6 +27,7 @@ additional_services: ...@@ -27,6 +27,7 @@ additional_services:
- dugtrio - dugtrio
- blutgang - blutgang
- apache - apache
- tracoor
ethereum_metrics_exporter_enabled: true ethereum_metrics_exporter_enabled: true
snooper_enabled: true snooper_enabled: true
keymanager_enabled: true keymanager_enabled: true
...@@ -592,6 +592,7 @@ additional_services: ...@@ -592,6 +592,7 @@ additional_services:
- blutgang - blutgang
- forky - forky
- apache - apache
- tracoor
# Configuration place for dora the explorer - https://github.com/ethpandaops/dora # Configuration place for dora the explorer - https://github.com/ethpandaops/dora
dora_params: dora_params:
......
...@@ -25,6 +25,7 @@ dugtrio = import_module("./src/dugtrio/dugtrio_launcher.star") ...@@ -25,6 +25,7 @@ dugtrio = import_module("./src/dugtrio/dugtrio_launcher.star")
blutgang = import_module("./src/blutgang/blutgang_launcher.star") blutgang = import_module("./src/blutgang/blutgang_launcher.star")
blobscan = import_module("./src/blobscan/blobscan_launcher.star") blobscan = import_module("./src/blobscan/blobscan_launcher.star")
forky = import_module("./src/forky/forky_launcher.star") forky = import_module("./src/forky/forky_launcher.star")
tracoor = import_module("./src/tracoor/tracoor_launcher.star")
apache = import_module("./src/apache/apache_launcher.star") apache = import_module("./src/apache/apache_launcher.star")
full_beaconchain_explorer = import_module( full_beaconchain_explorer = import_module(
"./src/full_beaconchain/full_beaconchain_launcher.star" "./src/full_beaconchain/full_beaconchain_launcher.star"
...@@ -507,6 +508,22 @@ def run(plan, args={}): ...@@ -507,6 +508,22 @@ def run(plan, args={}):
final_genesis_timestamp, final_genesis_timestamp,
) )
plan.print("Successfully launched forky") plan.print("Successfully launched forky")
elif additional_service == "tracoor":
plan.print("Launching tracoor")
tracoor_config_template = read_file(
static_files.TRACOOR_CONFIG_TEMPLATE_FILEPATH
)
tracoor.launch_tracoor(
plan,
tracoor_config_template,
all_participants,
args_with_right_defaults.participants,
el_cl_data_files_artifact_uuid,
network_params,
global_node_selectors,
final_genesis_timestamp,
)
plan.print("Successfully launched tracoor")
elif additional_service == "apache": elif additional_service == "apache":
plan.print("Launching apache") plan.print("Launching apache")
apache.launch_apache( apache.launch_apache(
......
...@@ -29,7 +29,9 @@ BLUTGANG_CONFIG_TEMPLATE_FILEPATH = ( ...@@ -29,7 +29,9 @@ BLUTGANG_CONFIG_TEMPLATE_FILEPATH = (
STATIC_FILES_DIRPATH + "/blutgang-config/config.toml.tmpl" STATIC_FILES_DIRPATH + "/blutgang-config/config.toml.tmpl"
) )
FORKY_CONFIG_TEMPLATE_FILEPATH = STATIC_FILES_DIRPATH + "/forky-config/config.yaml.tmpl" FORKY_CONFIG_TEMPLATE_FILEPATH = STATIC_FILES_DIRPATH + "/forky-config/config.yaml.tmpl"
TRACOOR_CONFIG_TEMPLATE_FILEPATH = (
STATIC_FILES_DIRPATH + "/tracoor-config/config.yaml.tmpl"
)
FULL_BEACONCHAIN_CONFIG_TEMPLATE_FILEPATH = ( FULL_BEACONCHAIN_CONFIG_TEMPLATE_FILEPATH = (
STATIC_FILES_DIRPATH + "/full-beaconchain-config/config.yaml.tmpl" STATIC_FILES_DIRPATH + "/full-beaconchain-config/config.yaml.tmpl"
) )
......
shared_utils = import_module("../shared_utils/shared_utils.star")
constants = import_module("../package_io/constants.star")
IMAGE_NAME = "ethpandaops/tracoor:0.0.18"
SERVICE_NAME = "tracoor"
HTTP_PORT_ID = "http"
HTTP_PORT_NUMBER = 7007
TRACOOR_CONFIG_FILENAME = "tracoor-config.yaml"
TRACOOR_CONFIG_MOUNT_DIRPATH_ON_SERVICE = "/config"
# The min/max CPU/memory that tracoor can use
MIN_CPU = 100
MAX_CPU = 1000
MIN_MEMORY = 128
MAX_MEMORY = 2048
USED_PORTS = {
HTTP_PORT_ID: shared_utils.new_port_spec(
HTTP_PORT_NUMBER,
shared_utils.TCP_PROTOCOL,
shared_utils.HTTP_APPLICATION_PROTOCOL,
)
}
def launch_tracoor(
plan,
config_template,
participant_contexts,
participant_configs,
el_cl_data_files_artifact_uuid,
network_params,
global_node_selectors,
final_genesis_timestamp,
):
all_client_info = []
for index, participant in enumerate(participant_contexts):
full_name, cl_client, el_client, _ = shared_utils.get_client_names(
participant, index, participant_contexts, participant_configs
)
beacon = new_cl_client_info(cl_client.beacon_http_url, full_name)
execution = new_el_client_info(
"http://{0}:{1}".format(
el_client.ip_addr,
el_client.rpc_port_num,
),
full_name,
)
client_info = {
"Beacon": beacon,
"Execution": execution,
"Network": network_params.network,
}
all_client_info.append(client_info)
plan.print(network_params.network)
template_data = new_config_template_data(
HTTP_PORT_NUMBER,
all_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[TRACOOR_CONFIG_FILENAME] = template_and_data
config_files_artifact_name = plan.render_templates(
template_and_data_by_rel_dest_filepath, "tracoor-config"
)
el_cl_data_files_artifact_uuid = el_cl_data_files_artifact_uuid
config = get_config(
config_files_artifact_name,
el_cl_data_files_artifact_uuid,
network_params,
global_node_selectors,
)
plan.add_service(SERVICE_NAME, config)
def get_config(
config_files_artifact_name,
el_cl_data_files_artifact_uuid,
network_params,
node_selectors,
):
config_file_path = shared_utils.path_join(
TRACOOR_CONFIG_MOUNT_DIRPATH_ON_SERVICE,
TRACOOR_CONFIG_FILENAME,
)
return ServiceConfig(
image=IMAGE_NAME,
ports=USED_PORTS,
files={
TRACOOR_CONFIG_MOUNT_DIRPATH_ON_SERVICE: config_files_artifact_name,
},
cmd=[
"single",
"--single-config={0}".format(config_file_path),
],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
node_selectors=node_selectors,
)
def new_config_template_data(
listen_port_num,
client_info,
):
return {
"ListenPortNum": listen_port_num,
"ParticipantClientInfo": client_info,
}
def new_cl_client_info(beacon_http_url, full_name):
return {
"Beacon_HTTP_URL": beacon_http_url,
"FullName": full_name,
}
def new_el_client_info(execution_http_url, full_name):
return {
"Execution_HTTP_URL": execution_http_url,
"FullName": full_name,
}
...@@ -47,9 +47,9 @@ beaconapi: ...@@ -47,9 +47,9 @@ beaconapi:
executionapi: executionapi:
endpoints: endpoints:
{{ range $clClient := .ELClientInfo }} {{ range $elClient := .ELClientInfo }}
- url: "{{ $clClient.Execution_HTTP_URL }}" - url: "{{ $elClient.Execution_HTTP_URL }}"
name: "{{ $clClient.FullName }}" name: "{{ $elClient.FullName }}"
archive: true archive: true
{{- end }} {{- end }}
depositLogBatchSize: 1000 depositLogBatchSize: 1000
......
server:
addr: ":8081"
metricsAddr: ":9091"
pprofAddr: ":6060"
gatewayAddr: ":{{ .ListenPortNum }}"
preStopSleepSeconds: 1
ntpServer: time.google.com
persistence:
dsn: "file:/tmp/tracoor.db"
driver_name: sqlite
services:
indexer:
retention:
beaconStates: 30m
executionBlockTraces: 30m
beaconBlocks: 30m
agents:
{{- range $client := .ParticipantClientInfo }}
- name: "{{ $client.Beacon.FullName }}"
ethereum:
overrideNetworkName: "{{ $client.Network }}"
beacon:
nodeAddress: "{{ $client.Beacon.Beacon_HTTP_URL }}"
execution:
nodeAddress: "{{ $client.Execution.Execution_HTTP_URL }}"
{{- end }}
shared:
metricsAddr: ":9091"
logging: "debug"
indexer:
address: 0.0.0.0:8081
store:
type: fs
config:
base_path: "/data/tracoor"
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