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

feat: add resource requests/limits to most applications (#396)

Co-authored-by: default avatarGyanendra Mishra <anomaly.the@gmail.com>
parent 83b5b4e9
...@@ -19,8 +19,10 @@ additional_services: ...@@ -19,8 +19,10 @@ additional_services:
- dora - dora
- prometheus_grafana - prometheus_grafana
- goomy_blob - goomy_blob
- full_beaconchain_explorer
- custom_flood - custom_flood
- blobscan
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
mev_type: full mev_type: full
mev_params: mev_params:
mev_relay_image: flashbots/mev-boost-relay:0.27 mev_relay_image: flashbots/mev-boost-relay:0.27
...@@ -19,6 +19,7 @@ additional_services: ...@@ -19,6 +19,7 @@ additional_services:
- dora - dora
- prometheus_grafana - prometheus_grafana
- goomy_blob - goomy_blob
- full_beaconchain_explorer
- custom_flood - custom_flood
- blobscan - blobscan
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
...@@ -27,12 +27,12 @@ full_beaconchain_explorer = import_module( ...@@ -27,12 +27,12 @@ full_beaconchain_explorer = import_module(
) )
prometheus = import_module("./src/prometheus/prometheus_launcher.star") prometheus = import_module("./src/prometheus/prometheus_launcher.star")
grafana = import_module("./src/grafana/grafana_launcher.star") grafana = import_module("./src/grafana/grafana_launcher.star")
mev_boost = import_module("./src/mev_boost/mev_boost_launcher.star") mev_boost = import_module("./src/mev/mev_boost/mev_boost_launcher.star")
mock_mev = import_module("./src/mock_mev/mock_mev_launcher.star") mock_mev = import_module("./src/mev/mock_mev/mock_mev_launcher.star")
mev_relay = import_module("./src/mev_relay/mev_relay_launcher.star") mev_relay = import_module("./src/mev/mev_relay/mev_relay_launcher.star")
mev_flood = import_module("./src/mev_flood/mev_flood_launcher.star") mev_flood = import_module("./src/mev/mev_flood/mev_flood_launcher.star")
mev_custom_flood = import_module( mev_custom_flood = import_module(
"./src/mev_custom_flood/mev_custom_flood_launcher.star" "./src/mev/mev_custom_flood/mev_custom_flood_launcher.star"
) )
eip4788_deployment = import_module( eip4788_deployment = import_module(
"./src/eip4788_deployment/eip4788_deployment_launcher.star" "./src/eip4788_deployment/eip4788_deployment_launcher.star"
...@@ -244,8 +244,11 @@ def run(plan, args={}): ...@@ -244,8 +244,11 @@ def run(plan, args={}):
mev_boost_launcher = mev_boost.new_mev_boost_launcher( mev_boost_launcher = mev_boost.new_mev_boost_launcher(
MEV_BOOST_SHOULD_CHECK_RELAY, mev_endpoints MEV_BOOST_SHOULD_CHECK_RELAY, mev_endpoints
) )
mev_boost_service_name = "{0}{1}".format( mev_boost_service_name = "{0}-{1}-{2}-{3}".format(
input_parser.MEV_BOOST_SERVICE_NAME_PREFIX, index input_parser.MEV_BOOST_SERVICE_NAME_PREFIX,
index,
participant.cl_client_type,
participant.el_client_type,
) )
mev_boost_context = mev_boost.launch( mev_boost_context = mev_boost.launch(
plan, plan,
......
...@@ -24,6 +24,12 @@ USED_PORTS = { ...@@ -24,6 +24,12 @@ USED_PORTS = {
) )
} }
# The min/max CPU/memory that beacon-metrics-gazer can use
MIN_CPU = 10
MAX_CPU = 500
MIN_MEMORY = 20
MAX_MEMORY = 300
def launch_beacon_metrics_gazer(plan, cl_client_contexts, network_params): def launch_beacon_metrics_gazer(plan, cl_client_contexts, network_params):
config = get_config( config = get_config(
...@@ -66,4 +72,8 @@ def get_config(ip_addr, http_port_num): ...@@ -66,4 +72,8 @@ def get_config(ip_addr, http_port_num):
"0.0.0.0", "0.0.0.0",
"-v", "-v",
], ],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
) )
...@@ -3,6 +3,12 @@ SERVICE_NAME = "blob-spammer" ...@@ -3,6 +3,12 @@ SERVICE_NAME = "blob-spammer"
ENTRYPOINT_ARGS = ["/bin/sh", "-c"] ENTRYPOINT_ARGS = ["/bin/sh", "-c"]
# The min/max CPU/memory that blob-spammer can use
MIN_CPU = 100
MAX_CPU = 1000
MIN_MEMORY = 20
MAX_MEMORY = 300
def launch_blob_spammer( def launch_blob_spammer(
plan, plan,
...@@ -58,4 +64,8 @@ def get_config( ...@@ -58,4 +64,8 @@ def get_config(
] ]
) )
], ],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
) )
...@@ -28,6 +28,30 @@ API_PORTS = { ...@@ -28,6 +28,30 @@ API_PORTS = {
ENTRYPOINT_ARGS = ["/bin/sh", "-c"] ENTRYPOINT_ARGS = ["/bin/sh", "-c"]
# The min/max CPU/memory that blobscan-indexer can use
INDEX_MIN_CPU = 10
INDEX_MAX_CPU = 1000
INDEX_MIN_MEMORY = 32
INDEX_MAX_MEMORY = 1024
# The min/max CPU/memory that blobscan-api can use
API_MIN_CPU = 100
API_MAX_CPU = 1000
API_MIN_MEMORY = 1024
API_MAX_MEMORY = 2048
# The min/max CPU/memory that blobscan-web can use
WEB_MIN_CPU = 100
WEB_MAX_CPU = 1000
WEB_MIN_MEMORY = 512
WEB_MAX_MEMORY = 2048
# The min/max CPU/memory that postgres can use
POSTGRES_MIN_CPU = 10
POSTGRES_MAX_CPU = 1000
POSTGRES_MIN_MEMORY = 32
POSTGRES_MAX_MEMORY = 1024
def launch_blobscan( def launch_blobscan(
plan, plan,
...@@ -43,7 +67,13 @@ def launch_blobscan( ...@@ -43,7 +67,13 @@ def launch_blobscan(
) )
postgres_output = postgres.run( postgres_output = postgres.run(
plan, service_name="blobscan-postgres", persistent=False plan,
service_name="blobscan-postgres",
min_cpu=POSTGRES_MIN_CPU,
max_cpu=POSTGRES_MAX_CPU,
min_memory=POSTGRES_MIN_MEMORY,
max_memory=POSTGRES_MAX_MEMORY,
persistent=False,
) )
api_config = get_api_config(postgres_output.url, beacon_node_rpc_uri, chain_id) api_config = get_api_config(postgres_output.url, beacon_node_rpc_uri, chain_id)
blobscan_config = plan.add_service(API_SERVICE_NAME, api_config) blobscan_config = plan.add_service(API_SERVICE_NAME, api_config)
...@@ -72,6 +102,7 @@ def get_api_config(database_url, beacon_node_rpc, chain_id): ...@@ -72,6 +102,7 @@ def get_api_config(database_url, beacon_node_rpc, chain_id):
"CHAIN_ID": chain_id, "CHAIN_ID": chain_id,
"DATABASE_URL": database_url, "DATABASE_URL": database_url,
"SECRET_KEY": "supersecret", "SECRET_KEY": "supersecret",
"BLOBSCAN_API_PORT": str(API_HTTP_PORT_NUMBER),
}, },
cmd=["api"], cmd=["api"],
ready_conditions=ReadyCondition( ready_conditions=ReadyCondition(
...@@ -85,6 +116,10 @@ def get_api_config(database_url, beacon_node_rpc, chain_id): ...@@ -85,6 +116,10 @@ def get_api_config(database_url, beacon_node_rpc, chain_id):
interval="5s", interval="5s",
timeout="5s", timeout="5s",
), ),
min_cpu=API_MIN_CPU,
max_cpu=API_MAX_CPU,
min_memory=API_MIN_MEMORY,
max_memory=API_MAX_MEMORY,
) )
...@@ -105,6 +140,10 @@ def get_web_config(database_url, beacon_node_rpc, chain_id): ...@@ -105,6 +140,10 @@ def get_web_config(database_url, beacon_node_rpc, chain_id):
"CHAIN_ID": chain_id, "CHAIN_ID": chain_id,
}, },
cmd=["web"], cmd=["web"],
min_cpu=WEB_MIN_CPU,
max_cpu=WEB_MAX_CPU,
min_memory=WEB_MIN_MEMORY,
max_memory=WEB_MAX_MEMORY,
) )
...@@ -121,4 +160,8 @@ def get_indexer_config(beacon_node_rpc, execution_node_rpc, blobscan_api_url): ...@@ -121,4 +160,8 @@ def get_indexer_config(beacon_node_rpc, execution_node_rpc, blobscan_api_url):
}, },
entrypoint=ENTRYPOINT_ARGS, entrypoint=ENTRYPOINT_ARGS,
cmd=[" && ".join(["sleep 90", "/app/blob-indexer"])], cmd=[" && ".join(["sleep 90", "/app/blob-indexer"])],
min_cpu=INDEX_MIN_CPU,
max_cpu=INDEX_MAX_CPU,
min_memory=INDEX_MIN_MEMORY,
max_memory=INDEX_MAX_MEMORY,
) )
...@@ -2,6 +2,12 @@ IMAGE_NAME = "nethermind/broadcaster:latest" ...@@ -2,6 +2,12 @@ IMAGE_NAME = "nethermind/broadcaster:latest"
SERVICE_NAME = "broadcaster" SERVICE_NAME = "broadcaster"
PORT = 8545 PORT = 8545
# The min/max CPU/memory that broadcaster can use
MIN_CPU = 100
MAX_CPU = 1000
MIN_MEMORY = 128
MAX_MEMORY = 2048
def launch_broadcaster(plan, all_el_client_contexts): def launch_broadcaster(plan, all_el_client_contexts):
config = get_config(all_el_client_contexts) config = get_config(all_el_client_contexts)
...@@ -15,4 +21,8 @@ def get_config(all_el_client_contexts): ...@@ -15,4 +21,8 @@ def get_config(all_el_client_contexts):
"http://{0}:{1}".format(context.ip_addr, context.rpc_port_num) "http://{0}:{1}".format(context.ip_addr, context.rpc_port_num)
for context in all_el_client_contexts for context in all_el_client_contexts
], ],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
) )
...@@ -26,8 +26,8 @@ HTTP_PORT_NUM = 3500 ...@@ -26,8 +26,8 @@ HTTP_PORT_NUM = 3500
BEACON_MONITORING_PORT_NUM = 8080 BEACON_MONITORING_PORT_NUM = 8080
# The min/max CPU/memory that the beacon node can use # The min/max CPU/memory that the beacon node can use
BEACON_MIN_CPU = 50 BEACON_MIN_CPU = 100
BEACON_MAX_CPU = 1000 BEACON_MAX_CPU = 2000
BEACON_MIN_MEMORY = 256 BEACON_MIN_MEMORY = 256
BEACON_MAX_MEMORY = 1024 BEACON_MAX_MEMORY = 1024
......
...@@ -12,6 +12,11 @@ DORA_CONFIG_MOUNT_DIRPATH_ON_SERVICE = "/config" ...@@ -12,6 +12,11 @@ DORA_CONFIG_MOUNT_DIRPATH_ON_SERVICE = "/config"
VALIDATOR_RANGES_MOUNT_DIRPATH_ON_SERVICE = "/validator-ranges" VALIDATOR_RANGES_MOUNT_DIRPATH_ON_SERVICE = "/validator-ranges"
VALIDATOR_RANGES_ARTIFACT_NAME = "validator-ranges" VALIDATOR_RANGES_ARTIFACT_NAME = "validator-ranges"
# The min/max CPU/memory that dora can use
MIN_CPU = 100
MAX_CPU = 1000
MIN_MEMORY = 128
MAX_MEMORY = 2048
USED_PORTS = { USED_PORTS = {
HTTP_PORT_ID: shared_utils.new_port_spec( HTTP_PORT_ID: shared_utils.new_port_spec(
...@@ -81,6 +86,10 @@ def get_config( ...@@ -81,6 +86,10 @@ def get_config(
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_data_files_artifact_uuid, constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_data_files_artifact_uuid,
}, },
cmd=["-config", config_file_path], cmd=["-config", config_file_path],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
) )
......
PYTHON_IMAGE = "ethpandaops/python-web3" PYTHON_IMAGE = "ethpandaops/python-web3"
EIP4788_DEPLOYMENT_SERVICE_NAME = "eip4788-contract-deployment" EIP4788_DEPLOYMENT_SERVICE_NAME = "eip4788-contract-deployment"
# The min/max CPU/memory that deployer can use
MIN_CPU = 10
MAX_CPU = 100
MIN_MEMORY = 10
MAX_MEMORY = 300
def deploy_eip4788_contract_in_background(plan, sender_key, el_uri): def deploy_eip4788_contract_in_background(plan, sender_key, el_uri):
sender_script = plan.upload_files( sender_script = plan.upload_files(
...@@ -17,6 +23,10 @@ def deploy_eip4788_contract_in_background(plan, sender_key, el_uri): ...@@ -17,6 +23,10 @@ def deploy_eip4788_contract_in_background(plan, sender_key, el_uri):
"SENDER_PRIVATE_KEY": sender_key, "SENDER_PRIVATE_KEY": sender_key,
"EL_RPC_URI": el_uri, "EL_RPC_URI": el_uri,
}, },
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
), ),
) )
......
...@@ -16,7 +16,7 @@ METRICS_PORT_NUM = 9001 ...@@ -16,7 +16,7 @@ METRICS_PORT_NUM = 9001
# The min/max CPU/memory that the execution node can use # The min/max CPU/memory that the execution node can use
EXECUTION_MIN_CPU = 100 EXECUTION_MIN_CPU = 100
EXECUTION_MAX_CPU = 1000 EXECUTION_MAX_CPU = 2000
EXECUTION_MIN_MEMORY = 256 EXECUTION_MIN_MEMORY = 256
EXECUTION_MAX_MEMORY = 1024 EXECUTION_MAX_MEMORY = 1024
......
...@@ -16,10 +16,10 @@ ENGINE_RPC_PORT_NUM = 8551 ...@@ -16,10 +16,10 @@ ENGINE_RPC_PORT_NUM = 8551
METRICS_PORT_NUM = 9001 METRICS_PORT_NUM = 9001
# The min/max CPU/memory that the execution node can use # The min/max CPU/memory that the execution node can use
EXECUTION_MIN_CPU = 100 EXECUTION_MIN_CPU = 300
EXECUTION_MAX_CPU = 1000 EXECUTION_MAX_CPU = 2000
EXECUTION_MIN_MEMORY = 256 EXECUTION_MIN_MEMORY = 512
EXECUTION_MAX_MEMORY = 1024 EXECUTION_MAX_MEMORY = 2048
# Port IDs # Port IDs
RPC_PORT_ID = "rpc" RPC_PORT_ID = "rpc"
......
...@@ -19,6 +19,12 @@ USED_PORTS = { ...@@ -19,6 +19,12 @@ USED_PORTS = {
) )
} }
# The min/max CPU/memory that el-forkmon can use
MIN_CPU = 10
MAX_CPU = 100
MIN_MEMORY = 32
MAX_MEMORY = 256
def launch_el_forkmon( def launch_el_forkmon(
plan, plan,
...@@ -62,6 +68,10 @@ def get_config(config_files_artifact_name): ...@@ -62,6 +68,10 @@ def get_config(config_files_artifact_name):
EL_FORKMON_CONFIG_MOUNT_DIRPATH_ON_SERVICE: config_files_artifact_name, EL_FORKMON_CONFIG_MOUNT_DIRPATH_ON_SERVICE: config_files_artifact_name,
}, },
cmd=[config_file_path], cmd=[config_file_path],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
) )
......
...@@ -9,6 +9,12 @@ METRICS_PORT_NUMBER = 9090 ...@@ -9,6 +9,12 @@ METRICS_PORT_NUMBER = 9090
DEFAULT_ETHEREUM_METRICS_EXPORTER_IMAGE = "ethpandaops/ethereum-metrics-exporter:0.22.0" DEFAULT_ETHEREUM_METRICS_EXPORTER_IMAGE = "ethpandaops/ethereum-metrics-exporter:0.22.0"
# The min/max CPU/memory that ethereum-metrics-exporter can use
MIN_CPU = 10
MAX_CPU = 100
MIN_MEMORY = 16
MAX_MEMORY = 128
def launch( def launch(
plan, plan,
...@@ -42,6 +48,10 @@ def launch( ...@@ -42,6 +48,10 @@ def launch(
el_client_context.rpc_port_num, el_client_context.rpc_port_num,
), ),
], ],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
), ),
) )
......
shared_utils = import_module("../shared_utils/shared_utils.star") shared_utils = import_module("../shared_utils/shared_utils.star")
IMAGE_NAME = "gobitfly/eth2-beaconchain-explorer:kurtosis" postgres = import_module("github.com/kurtosis-tech/postgres-package/main.star")
redis = import_module("github.com/kurtosis-tech/redis-package/main.star")
IMAGE_NAME = "gobitfly/eth2-beaconchain-explorer:latest"
POSTGRES_PORT_ID = "postgres" POSTGRES_PORT_ID = "postgres"
POSTGRES_PORT_NUMBER = 5432 POSTGRES_PORT_NUMBER = 5432
...@@ -27,6 +30,66 @@ USED_PORTS = { ...@@ -27,6 +30,66 @@ USED_PORTS = {
) )
} }
# The min/max CPU/memory that postgres can use
POSTGRES_MIN_CPU = 10
POSTGRES_MAX_CPU = 1000
POSTGRES_MIN_MEMORY = 32
POSTGRES_MAX_MEMORY = 1024
# The min/max CPU/memory that redis can use
REDIS_MIN_CPU = 10
REDIS_MAX_CPU = 1000
REDIS_MIN_MEMORY = 32
REDIS_MAX_MEMORY = 1024
# The min/max CPU/memory that littlebigtable can use
LITTLE_BIGTABLE_MIN_CPU = 100
LITTLE_BIGTABLE_MAX_CPU = 1000
LITTLE_BIGTABLE_MIN_MEMORY = 128
LITTLE_BIGTABLE_MAX_MEMORY = 2048
# The min/max CPU/memory that the indexer can use
INDEXER_MIN_CPU = 100
INDEXER_MAX_CPU = 1000
INDEXER_MIN_MEMORY = 1024
INDEXER_MAX_MEMORY = 2048
# The min/max CPU/memory that the init can use
INIT_MIN_CPU = 10
INIT_MAX_CPU = 100
INIT_MIN_MEMORY = 32
INIT_MAX_MEMORY = 128
# The min/max CPU/memory that the eth1indexer can use
ETH1INDEXER_MIN_CPU = 100
ETH1INDEXER_MAX_CPU = 1000
ETH1INDEXER_MIN_MEMORY = 128
ETH1INDEXER_MAX_MEMORY = 1024
# The min/max CPU/memory that the rewards-exporter can use
REWARDSEXPORTER_MIN_CPU = 10
REWARDSEXPORTER_MAX_CPU = 100
REWARDSEXPORTER_MIN_MEMORY = 32
REWARDSEXPORTER_MAX_MEMORY = 128
# The min/max CPU/memory that the statistics can use
STATISTICS_MIN_CPU = 10
STATISTICS_MAX_CPU = 100
STATISTICS_MIN_MEMORY = 32
STATISTICS_MAX_MEMORY = 128
# The min/max CPU/memory that the frontend-data-updater can use
FDU_MIN_CPU = 10
FDU_MAX_CPU = 100
FDU_MIN_MEMORY = 32
FDU_MAX_MEMORY = 128
# The min/max CPU/memory that the frontend can use
FRONTEND_MIN_CPU = 100
FRONTEND_MAX_CPU = 1000
FRONTEND_MIN_MEMORY = 512
FRONTEND_MAX_MEMORY = 2048
def launch_full_beacon( def launch_full_beacon(
plan, plan,
...@@ -34,59 +97,58 @@ def launch_full_beacon( ...@@ -34,59 +97,58 @@ def launch_full_beacon(
cl_client_contexts, cl_client_contexts,
el_client_contexts, el_client_contexts,
): ):
# TODO perhaps use the official redis & postgres packages postgres_output = postgres.run(
db_services = plan.add_services( plan,
configs={ service_name="beaconchain-postgres",
# Add a Postgres server
"explorer-postgres": ServiceConfig(
image="postgres:15.2-alpine", image="postgres:15.2-alpine",
ports={ user=POSTGRES_USER,
POSTGRES_PORT_ID: PortSpec( password=POSTGRES_PASSWORD,
POSTGRES_PORT_NUMBER, application_protocol="postgresql" database=POSTGRES_DB,
), min_cpu=POSTGRES_MIN_CPU,
}, max_cpu=POSTGRES_MAX_CPU,
env_vars={ min_memory=POSTGRES_MIN_MEMORY,
"POSTGRES_DB": POSTGRES_DB, max_memory=POSTGRES_MAX_MEMORY,
"POSTGRES_USER": POSTGRES_USER, persistent=False,
"POSTGRES_PASSWORD": POSTGRES_PASSWORD, )
}, redis_output = redis.run(
), plan,
# Add a Redis server service_name="beaconchain-redis",
"explorer-redis": ServiceConfig(
image="redis:7", image="redis:7",
ports={ min_cpu=REDIS_MIN_CPU,
REDIS_PORT_ID: PortSpec( max_cpu=REDIS_MAX_CPU,
REDIS_PORT_NUMBER, application_protocol="tcp" min_memory=REDIS_MIN_MEMORY,
), max_memory=REDIS_MAX_MEMORY,
}, )
), # TODO perhaps create a new service for the littlebigtable
# Add a Bigtable Emulator server little_bigtable = plan.add_service(
"explorer-littlebigtable": ServiceConfig( name="beaconchain-littlebigtable",
config=ServiceConfig(
image="gobitfly/little_bigtable:latest", image="gobitfly/little_bigtable:latest",
ports={ ports={
LITTLE_BIGTABLE_PORT_ID: PortSpec( LITTLE_BIGTABLE_PORT_ID: PortSpec(
LITTLE_BIGTABLE_PORT_NUMBER, application_protocol="tcp" LITTLE_BIGTABLE_PORT_NUMBER, application_protocol="tcp"
), )
}, },
min_cpu=LITTLE_BIGTABLE_MIN_CPU,
max_cpu=LITTLE_BIGTABLE_MAX_CPU,
min_memory=LITTLE_BIGTABLE_MIN_MEMORY,
max_memory=LITTLE_BIGTABLE_MAX_MEMORY,
), ),
}
) )
el_uri = "http://{0}:{1}".format( el_uri = "http://{0}:{1}".format(
el_client_contexts[0].ip_addr, el_client_contexts[0].rpc_port_num el_client_contexts[0].ip_addr, el_client_contexts[0].rpc_port_num
) )
redis_uri = "{0}:{1}".format( redis_url = "{}:{}".format(redis_output.hostname, redis_output.port_number)
db_services["explorer-redis"].ip_address, REDIS_PORT_NUMBER
)
template_data = new_config_template_data( template_data = new_config_template_data(
cl_client_contexts[0], cl_client_contexts[0],
el_uri, el_uri,
db_services["explorer-littlebigtable"].ip_address, little_bigtable.ip_address,
LITTLE_BIGTABLE_PORT_NUMBER, LITTLE_BIGTABLE_PORT_NUMBER,
db_services["explorer-postgres"].ip_address, postgres_output.url,
POSTGRES_PORT_NUMBER, POSTGRES_PORT_NUMBER,
redis_uri, redis_url,
FRONTEND_PORT_NUMBER, FRONTEND_PORT_NUMBER,
) )
...@@ -104,13 +166,17 @@ def launch_full_beacon( ...@@ -104,13 +166,17 @@ def launch_full_beacon(
# Initialize the db schema # Initialize the db schema
initdbschema = plan.add_service( initdbschema = plan.add_service(
name="explorer-schema-initializer", name="beaconchain-schema-initializer",
config=ServiceConfig( config=ServiceConfig(
image=IMAGE_NAME, image=IMAGE_NAME,
files={ files={
"/app/config/": config_files_artifact_name, "/app/config/": config_files_artifact_name,
}, },
entrypoint=["tail", "-f", "/dev/null"], entrypoint=["tail", "-f", "/dev/null"],
min_cpu=INIT_MIN_CPU,
max_cpu=INIT_MAX_CPU,
min_memory=INIT_MIN_MEMORY,
max_memory=INIT_MAX_MEMORY,
), ),
) )
...@@ -139,7 +205,7 @@ def launch_full_beacon( ...@@ -139,7 +205,7 @@ def launch_full_beacon(
# Start the indexer # Start the indexer
indexer = plan.add_service( indexer = plan.add_service(
name="explorer-indexer", name="beaconchain-indexer",
config=ServiceConfig( config=ServiceConfig(
image=IMAGE_NAME, image=IMAGE_NAME,
files={ files={
...@@ -153,11 +219,15 @@ def launch_full_beacon( ...@@ -153,11 +219,15 @@ def launch_full_beacon(
env_vars={ env_vars={
"INDEXER_ENABLED": "TRUE", "INDEXER_ENABLED": "TRUE",
}, },
min_cpu=INDEXER_MIN_CPU,
max_cpu=INDEXER_MAX_CPU,
min_memory=INDEXER_MIN_MEMORY,
max_memory=INDEXER_MAX_MEMORY,
), ),
) )
# Start the eth1indexer # Start the eth1indexer
eth1indexer = plan.add_service( eth1indexer = plan.add_service(
name="explorer-eth1indexer", name="beaconchain-eth1indexer",
config=ServiceConfig( config=ServiceConfig(
image=IMAGE_NAME, image=IMAGE_NAME,
files={ files={
...@@ -175,11 +245,15 @@ def launch_full_beacon( ...@@ -175,11 +245,15 @@ def launch_full_beacon(
"1", "1",
"-balances.enabled", "-balances.enabled",
], ],
min_cpu=ETH1INDEXER_MIN_CPU,
max_cpu=ETH1INDEXER_MAX_CPU,
min_memory=ETH1INDEXER_MIN_MEMORY,
max_memory=ETH1INDEXER_MAX_MEMORY,
), ),
) )
rewardsexporter = plan.add_service( rewardsexporter = plan.add_service(
name="explorer-rewardsexporter", name="beaconchain-rewardsexporter",
config=ServiceConfig( config=ServiceConfig(
image=IMAGE_NAME, image=IMAGE_NAME,
files={ files={
...@@ -190,11 +264,15 @@ def launch_full_beacon( ...@@ -190,11 +264,15 @@ def launch_full_beacon(
"-config", "-config",
"/app/config/config.yml", "/app/config/config.yml",
], ],
min_cpu=REWARDSEXPORTER_MIN_CPU,
max_cpu=REWARDSEXPORTER_MAX_CPU,
min_memory=REWARDSEXPORTER_MIN_MEMORY,
max_memory=REWARDSEXPORTER_MAX_MEMORY,
), ),
) )
statistics = plan.add_service( statistics = plan.add_service(
name="explorer-statistics", name="beaconchain-statistics",
config=ServiceConfig( config=ServiceConfig(
image=IMAGE_NAME, image=IMAGE_NAME,
files={ files={
...@@ -208,11 +286,15 @@ def launch_full_beacon( ...@@ -208,11 +286,15 @@ def launch_full_beacon(
"-graffiti.enabled", "-graffiti.enabled",
"-validators.enabled", "-validators.enabled",
], ],
min_cpu=STATISTICS_MIN_CPU,
max_cpu=STATISTICS_MAX_CPU,
min_memory=STATISTICS_MIN_MEMORY,
max_memory=STATISTICS_MAX_MEMORY,
), ),
) )
fdu = plan.add_service( fdu = plan.add_service(
name="explorer-fdu", name="beaconchain-fdu",
config=ServiceConfig( config=ServiceConfig(
image=IMAGE_NAME, image=IMAGE_NAME,
files={ files={
...@@ -223,11 +305,15 @@ def launch_full_beacon( ...@@ -223,11 +305,15 @@ def launch_full_beacon(
"-config", "-config",
"/app/config/config.yml", "/app/config/config.yml",
], ],
min_cpu=FDU_MIN_CPU,
max_cpu=FDU_MAX_CPU,
min_memory=FDU_MIN_MEMORY,
max_memory=FDU_MAX_MEMORY,
), ),
) )
frontend = plan.add_service( frontend = plan.add_service(
name="explorer-frontend", name="beaconchain-frontend",
config=ServiceConfig( config=ServiceConfig(
image=IMAGE_NAME, image=IMAGE_NAME,
files={ files={
...@@ -246,12 +332,16 @@ def launch_full_beacon( ...@@ -246,12 +332,16 @@ def launch_full_beacon(
FRONTEND_PORT_NUMBER, application_protocol="http" FRONTEND_PORT_NUMBER, application_protocol="http"
), ),
}, },
min_cpu=FRONTEND_MIN_CPU,
max_cpu=FRONTEND_MAX_CPU,
min_memory=FRONTEND_MIN_MEMORY,
max_memory=FRONTEND_MAX_MEMORY,
), ),
) )
def new_config_template_data( def new_config_template_data(
cl_node_info, el_uri, lbt_host, lbt_port, db_host, db_port, redis_uri, frontend_port cl_node_info, el_uri, lbt_host, lbt_port, db_host, db_port, redis_url, frontend_port
): ):
return { return {
"CLNodeHost": cl_node_info.ip_addr, "CLNodeHost": cl_node_info.ip_addr,
...@@ -261,7 +351,7 @@ def new_config_template_data( ...@@ -261,7 +351,7 @@ def new_config_template_data(
"LBTPort": lbt_port, "LBTPort": lbt_port,
"DBHost": db_host, "DBHost": db_host,
"DBPort": db_port, "DBPort": db_port,
"RedisEndpoint": redis_uri, "RedisEndpoint": redis_url,
"FrontendPort": frontend_port, "FrontendPort": frontend_port,
} }
......
...@@ -3,6 +3,12 @@ IMAGE_NAME = "ethpandaops/goomy-blob:master" ...@@ -3,6 +3,12 @@ IMAGE_NAME = "ethpandaops/goomy-blob:master"
ENTRYPOINT_ARGS = ["/bin/sh", "-c"] ENTRYPOINT_ARGS = ["/bin/sh", "-c"]
# The min/max CPU/memory that goomy can use
MIN_CPU = 100
MAX_CPU = 1000
MIN_MEMORY = 20
MAX_MEMORY = 300
def launch_goomy_blob( def launch_goomy_blob(
plan, plan,
...@@ -67,4 +73,8 @@ def get_config( ...@@ -67,4 +73,8 @@ def get_config(
] ]
) )
], ],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
) )
...@@ -38,6 +38,12 @@ USED_PORTS = { ...@@ -38,6 +38,12 @@ USED_PORTS = {
) )
} }
# The min/max CPU/memory that grafana can use
MIN_CPU = 10
MAX_CPU = 1000
MIN_MEMORY = 128
MAX_MEMORY = 2048
def launch_grafana( def launch_grafana(
plan, plan,
...@@ -136,6 +142,10 @@ def get_config( ...@@ -136,6 +142,10 @@ def get_config(
GRAFANA_CONFIG_DIRPATH_ON_SERVICE: grafana_config_artifacts_name, GRAFANA_CONFIG_DIRPATH_ON_SERVICE: grafana_config_artifacts_name,
GRAFANA_DASHBOARDS_DIRPATH_ON_SERVICE: grafana_dashboards_artifacts_name, GRAFANA_DASHBOARDS_DIRPATH_ON_SERVICE: grafana_dashboards_artifacts_name,
}, },
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
) )
......
shared_utils = import_module("../shared_utils/shared_utils.star") shared_utils = import_module("../../shared_utils/shared_utils.star")
mev_boost_context_module = import_module("../mev_boost/mev_boost_context.star") mev_boost_context_module = import_module("../mev_boost/mev_boost_context.star")
input_parser = import_module("../package_io/input_parser.star") input_parser = import_module("../../package_io/input_parser.star")
FLASHBOTS_MEV_BOOST_PROTOCOL = "TCP" FLASHBOTS_MEV_BOOST_PROTOCOL = "TCP"
...@@ -16,6 +16,12 @@ NETWORK_ID_TO_NAME = { ...@@ -16,6 +16,12 @@ NETWORK_ID_TO_NAME = {
"3": "ropsten", "3": "ropsten",
} }
# The min/max CPU/memory that mev-boost can use
MIN_CPU = 10
MAX_CPU = 500
MIN_MEMORY = 16
MAX_MEMORY = 256
def launch(plan, mev_boost_launcher, service_name, network_id, mev_boost_image): def launch(plan, mev_boost_launcher, service_name, network_id, mev_boost_image):
config = get_config(mev_boost_launcher, network_id, mev_boost_image) config = get_config(mev_boost_launcher, network_id, mev_boost_image)
...@@ -50,6 +56,10 @@ def get_config(mev_boost_launcher, network_id, mev_boost_image): ...@@ -50,6 +56,10 @@ def get_config(mev_boost_launcher, network_id, mev_boost_image):
"SKIP_RELAY_SIGNATURE_CHECK": "1", "SKIP_RELAY_SIGNATURE_CHECK": "1",
"RELAYS": mev_boost_launcher.relay_end_points[0], "RELAYS": mev_boost_launcher.relay_end_points[0],
}, },
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
) )
......
PYTHON_IMAGE = "ethpandaops/python-web3" PYTHON_IMAGE = "ethpandaops/python-web3"
CUSTOM_FLOOD_SERVICE_NAME = "mev-custom-flood" CUSTOM_FLOOD_SERVICE_NAME = "mev-custom-flood"
# The min/max CPU/memory that mev-custom-flood can use
MIN_CPU = 10
MAX_CPU = 1000
MIN_MEMORY = 128
MAX_MEMORY = 1024
def spam_in_background(plan, sender_key, receiver_key, el_uri, params): def spam_in_background(plan, sender_key, receiver_key, el_uri, params):
sender_script = plan.upload_files(src="./sender.py", name="mev-custom-flood-sender") sender_script = plan.upload_files(src="./sender.py", name="mev-custom-flood-sender")
...@@ -16,6 +22,10 @@ def spam_in_background(plan, sender_key, receiver_key, el_uri, params): ...@@ -16,6 +22,10 @@ def spam_in_background(plan, sender_key, receiver_key, el_uri, params):
"RECEIVER_PUBLIC_KEY": receiver_key, "RECEIVER_PUBLIC_KEY": receiver_key,
"EL_RPC_URI": el_uri, "EL_RPC_URI": el_uri,
}, },
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
), ),
) )
......
ADMIN_KEY_INDEX = 0 ADMIN_KEY_INDEX = 0
USER_KEY_INDEX = 2 USER_KEY_INDEX = 2
# The min/max CPU/memory that mev-flood can use
MIN_CPU = 100
MAX_CPU = 2000
MIN_MEMORY = 128
MAX_MEMORY = 1024
def prefixed_address(address): def prefixed_address(address):
return "0x" + address return "0x" + address
...@@ -12,6 +18,10 @@ def launch_mev_flood(plan, image, el_uri, contract_owner, normal_user): ...@@ -12,6 +18,10 @@ def launch_mev_flood(plan, image, el_uri, contract_owner, normal_user):
config=ServiceConfig( config=ServiceConfig(
image=image, image=image,
entrypoint=["/bin/sh", "-c", "touch main.log && tail -F main.log"], entrypoint=["/bin/sh", "-c", "touch main.log && tail -F main.log"],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
), ),
) )
......
redis_module = import_module("github.com/kurtosis-tech/redis-package/main.star") redis_module = import_module("github.com/kurtosis-tech/redis-package/main.star")
postgres_module = import_module("github.com/kurtosis-tech/postgres-package/main.star") postgres_module = import_module("github.com/kurtosis-tech/postgres-package/main.star")
constants = import_module("../package_io/constants.star") constants = import_module("../../package_io/constants.star")
DUMMY_SECRET_KEY = "0x607a11b45a7219cc61a3d9c5fd08c7eebd602a6a19a977f8d3771d5711a550f2" DUMMY_SECRET_KEY = "0x607a11b45a7219cc61a3d9c5fd08c7eebd602a6a19a977f8d3771d5711a550f2"
DUMMY_PUB_KEY = "0xa55c1285d84ba83a5ad26420cd5ad3091e49c55a813eee651cd467db38a8c8e63192f47955e9376f6b42f6d190571cb5" DUMMY_PUB_KEY = "0xa55c1285d84ba83a5ad26420cd5ad3091e49c55a813eee651cd467db38a8c8e63192f47955e9376f6b42f6d190571cb5"
...@@ -21,6 +21,24 @@ NETWORK_ID_TO_NAME = { ...@@ -21,6 +21,24 @@ NETWORK_ID_TO_NAME = {
DONT_PERSIST_TO_DISK = False DONT_PERSIST_TO_DISK = False
LAUNCH_ADMINER = True LAUNCH_ADMINER = True
# The min/max CPU/memory that mev-relay can use
RELAY_MIN_CPU = 100
RELAY_MAX_CPU = 1000
RELAY_MIN_MEMORY = 128
RELAY_MAX_MEMORY = 1024
# The min/max CPU/memory that postgres can use
POSTGRES_MIN_CPU = 10
POSTGRES_MAX_CPU = 1000
POSTGRES_MIN_MEMORY = 32
POSTGRES_MAX_MEMORY = 1024
# The min/max CPU/memory that redis can use
REDIS_MIN_CPU = 10
REDIS_MAX_CPU = 1000
REDIS_MIN_MEMORY = 16
REDIS_MAX_MEMORY = 1024
def launch_mev_relay( def launch_mev_relay(
plan, plan,
...@@ -31,7 +49,14 @@ def launch_mev_relay( ...@@ -31,7 +49,14 @@ def launch_mev_relay(
builder_uri, builder_uri,
seconds_per_slot, seconds_per_slot,
): ):
redis = redis_module.run(plan) redis = redis_module.run(
plan,
service_name="mev-relay-redis",
min_cpu=REDIS_MIN_CPU,
max_cpu=REDIS_MAX_CPU,
min_memory=REDIS_MIN_MEMORY,
max_memory=REDIS_MAX_MEMORY,
)
# making the password postgres as the relay expects it to be postgres # making the password postgres as the relay expects it to be postgres
postgres = postgres_module.run( postgres = postgres_module.run(
plan, plan,
...@@ -41,6 +66,10 @@ def launch_mev_relay( ...@@ -41,6 +66,10 @@ def launch_mev_relay(
service_name="mev-relay-postgres", service_name="mev-relay-postgres",
persistent=DONT_PERSIST_TO_DISK, persistent=DONT_PERSIST_TO_DISK,
launch_adminer=LAUNCH_ADMINER, launch_adminer=LAUNCH_ADMINER,
min_cpu=POSTGRES_MIN_CPU,
max_cpu=POSTGRES_MAX_CPU,
min_memory=POSTGRES_MIN_MEMORY,
max_memory=POSTGRES_MAX_MEMORY,
) )
network_name = NETWORK_ID_TO_NAME.get(network_id, network_id) network_name = NETWORK_ID_TO_NAME.get(network_id, network_id)
...@@ -75,6 +104,10 @@ def launch_mev_relay( ...@@ -75,6 +104,10 @@ def launch_mev_relay(
] ]
+ mev_params.mev_relay_housekeeper_extra_args, + mev_params.mev_relay_housekeeper_extra_args,
env_vars=env_vars, env_vars=env_vars,
min_cpu=RELAY_MIN_CPU,
max_cpu=RELAY_MAX_CPU,
min_memory=RELAY_MIN_MEMORY,
max_memory=RELAY_MAX_MEMORY,
), ),
) )
...@@ -106,6 +139,10 @@ def launch_mev_relay( ...@@ -106,6 +139,10 @@ def launch_mev_relay(
) )
}, },
env_vars=env_vars, env_vars=env_vars,
min_cpu=RELAY_MIN_CPU,
max_cpu=RELAY_MAX_CPU,
min_memory=RELAY_MIN_MEMORY,
max_memory=RELAY_MAX_MEMORY,
), ),
) )
...@@ -134,6 +171,10 @@ def launch_mev_relay( ...@@ -134,6 +171,10 @@ def launch_mev_relay(
) )
}, },
env_vars=env_vars, env_vars=env_vars,
min_cpu=RELAY_MIN_CPU,
max_cpu=RELAY_MAX_CPU,
min_memory=RELAY_MIN_MEMORY,
max_memory=RELAY_MAX_MEMORY,
), ),
) )
......
...@@ -3,6 +3,12 @@ MOCK_MEV_SERVICE_NAME = "mock-mev" ...@@ -3,6 +3,12 @@ MOCK_MEV_SERVICE_NAME = "mock-mev"
MOCK_MEV_BUILDER_PORT = 18550 MOCK_MEV_BUILDER_PORT = 18550
DEFAULT_MOCK_MEV_PUB_KEY = "0x95fde78acd5f6886ddaf5d0056610167c513d09c1c0efabbc7cdcc69beea113779c4a81e2d24daafc5387dbf6ac5fe48" DEFAULT_MOCK_MEV_PUB_KEY = "0x95fde78acd5f6886ddaf5d0056610167c513d09c1c0efabbc7cdcc69beea113779c4a81e2d24daafc5387dbf6ac5fe48"
# The min/max CPU/memory that mev-mock-builder can use
MIN_CPU = 100
MAX_CPU = 1000
MIN_MEMORY = 128
MAX_MEMORY = 1024
def launch_mock_mev(plan, el_uri, beacon_uri, jwt_secret, global_client_log_level): def launch_mock_mev(plan, el_uri, beacon_uri, jwt_secret, global_client_log_level):
mock_builder = plan.add_service( mock_builder = plan.add_service(
...@@ -21,6 +27,10 @@ def launch_mock_mev(plan, el_uri, beacon_uri, jwt_secret, global_client_log_leve ...@@ -21,6 +27,10 @@ def launch_mock_mev(plan, el_uri, beacon_uri, jwt_secret, global_client_log_leve
"--bid-multiplier=5", # TODO: This could be customizable "--bid-multiplier=5", # TODO: This could be customizable
"--log-level={0}".format(global_client_log_level), "--log-level={0}".format(global_client_log_level),
], ],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
), ),
) )
return "http://{0}@{1}:{2}".format( return "http://{0}@{1}:{2}".format(
......
...@@ -34,7 +34,7 @@ HIGH_DENEB_VALUE_FORK_VERKLE = 20000 ...@@ -34,7 +34,7 @@ HIGH_DENEB_VALUE_FORK_VERKLE = 20000
# MEV Params # MEV Params
FLASHBOTS_MEV_BOOST_PORT = 18550 FLASHBOTS_MEV_BOOST_PORT = 18550
MEV_BOOST_SERVICE_NAME_PREFIX = "mev-boost-" MEV_BOOST_SERVICE_NAME_PREFIX = "mev-boost"
# Minimum number of validators required for a network to be valid is 64 # Minimum number of validators required for a network to be valid is 64
MIN_VALIDATORS = 64 MIN_VALIDATORS = 64
......
...@@ -30,6 +30,12 @@ USED_PORTS = { ...@@ -30,6 +30,12 @@ USED_PORTS = {
) )
} }
# The min/max CPU/memory that prometheus can use
MIN_CPU = 10
MAX_CPU = 1000
MIN_MEMORY = 128
MAX_MEMORY = 2048
def launch_prometheus( def launch_prometheus(
plan, plan,
...@@ -84,6 +90,10 @@ def get_config(config_files_artifact_name): ...@@ -84,6 +90,10 @@ def get_config(config_files_artifact_name):
"--web.console.templates=/etc/prometheus/consoles", "--web.console.templates=/etc/prometheus/consoles",
"--web.enable-lifecycle", "--web.enable-lifecycle",
], ],
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
) )
......
...@@ -18,6 +18,12 @@ SNOOPER_USED_PORTS = { ...@@ -18,6 +18,12 @@ SNOOPER_USED_PORTS = {
), ),
} }
# The min/max CPU/memory that snooper can use
MIN_CPU = 10
MAX_CPU = 100
MIN_MEMORY = 10
MAX_MEMORY = 300
def launch(plan, service_name, el_client_context): def launch(plan, service_name, el_client_context):
snooper_service_name = "{0}".format(service_name) snooper_service_name = "{0}".format(service_name)
...@@ -48,4 +54,8 @@ def get_config(service_name, el_client_context): ...@@ -48,4 +54,8 @@ def get_config(service_name, el_client_context):
ports=SNOOPER_USED_PORTS, ports=SNOOPER_USED_PORTS,
cmd=cmd, cmd=cmd,
private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER, private_ip_address_placeholder=PRIVATE_IP_ADDRESS_PLACEHOLDER,
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
) )
shared_utils = import_module("../shared_utils/shared_utils.star") shared_utils = import_module("../shared_utils/shared_utils.star")
SERVICE_NAME = "transaction-spammer" SERVICE_NAME = "transaction-spammer"
# The min/max CPU/memory that tx-spammer can use
MIN_CPU = 100
MAX_CPU = 1000
MIN_MEMORY = 20
MAX_MEMORY = 300
def launch_transaction_spammer( def launch_transaction_spammer(
plan, prefunded_addresses, el_uri, tx_spammer_params, electra_fork_epoch plan, prefunded_addresses, el_uri, tx_spammer_params, electra_fork_epoch
...@@ -33,4 +39,8 @@ def get_config(prefunded_addresses, el_uri, tx_spammer_extra_args, electra_fork_ ...@@ -33,4 +39,8 @@ def get_config(prefunded_addresses, el_uri, tx_spammer_extra_args, electra_fork_
return ServiceConfig( return ServiceConfig(
image=tx_spammer_image, image=tx_spammer_image,
cmd=cmd, cmd=cmd,
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
) )
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