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:
- dora
- prometheus_grafana
- goomy_blob
- full_beaconchain_explorer
- custom_flood
- blobscan
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
mev_type: full
mev_params:
mev_relay_image: flashbots/mev-boost-relay:0.27
......@@ -19,6 +19,7 @@ additional_services:
- dora
- prometheus_grafana
- goomy_blob
- full_beaconchain_explorer
- custom_flood
- blobscan
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
......@@ -27,12 +27,12 @@ full_beaconchain_explorer = import_module(
)
prometheus = import_module("./src/prometheus/prometheus_launcher.star")
grafana = import_module("./src/grafana/grafana_launcher.star")
mev_boost = import_module("./src/mev_boost/mev_boost_launcher.star")
mock_mev = import_module("./src/mock_mev/mock_mev_launcher.star")
mev_relay = import_module("./src/mev_relay/mev_relay_launcher.star")
mev_flood = import_module("./src/mev_flood/mev_flood_launcher.star")
mev_boost = import_module("./src/mev/mev_boost/mev_boost_launcher.star")
mock_mev = import_module("./src/mev/mock_mev/mock_mev_launcher.star")
mev_relay = import_module("./src/mev/mev_relay/mev_relay_launcher.star")
mev_flood = import_module("./src/mev/mev_flood/mev_flood_launcher.star")
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(
"./src/eip4788_deployment/eip4788_deployment_launcher.star"
......@@ -244,8 +244,11 @@ def run(plan, args={}):
mev_boost_launcher = mev_boost.new_mev_boost_launcher(
MEV_BOOST_SHOULD_CHECK_RELAY, mev_endpoints
)
mev_boost_service_name = "{0}{1}".format(
input_parser.MEV_BOOST_SERVICE_NAME_PREFIX, index
mev_boost_service_name = "{0}-{1}-{2}-{3}".format(
input_parser.MEV_BOOST_SERVICE_NAME_PREFIX,
index,
participant.cl_client_type,
participant.el_client_type,
)
mev_boost_context = mev_boost.launch(
plan,
......
......@@ -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):
config = get_config(
......@@ -66,4 +72,8 @@ def get_config(ip_addr, http_port_num):
"0.0.0.0",
"-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"
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(
plan,
......@@ -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 = {
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(
plan,
......@@ -43,7 +67,13 @@ def launch_blobscan(
)
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)
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):
"CHAIN_ID": chain_id,
"DATABASE_URL": database_url,
"SECRET_KEY": "supersecret",
"BLOBSCAN_API_PORT": str(API_HTTP_PORT_NUMBER),
},
cmd=["api"],
ready_conditions=ReadyCondition(
......@@ -85,6 +116,10 @@ def get_api_config(database_url, beacon_node_rpc, chain_id):
interval="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):
"CHAIN_ID": chain_id,
},
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):
},
entrypoint=ENTRYPOINT_ARGS,
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"
SERVICE_NAME = "broadcaster"
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):
config = 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)
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
BEACON_MONITORING_PORT_NUM = 8080
# The min/max CPU/memory that the beacon node can use
BEACON_MIN_CPU = 50
BEACON_MAX_CPU = 1000
BEACON_MIN_CPU = 100
BEACON_MAX_CPU = 2000
BEACON_MIN_MEMORY = 256
BEACON_MAX_MEMORY = 1024
......
......@@ -12,6 +12,11 @@ DORA_CONFIG_MOUNT_DIRPATH_ON_SERVICE = "/config"
VALIDATOR_RANGES_MOUNT_DIRPATH_ON_SERVICE = "/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 = {
HTTP_PORT_ID: shared_utils.new_port_spec(
......@@ -81,6 +86,10 @@ def get_config(
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_data_files_artifact_uuid,
},
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"
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):
sender_script = plan.upload_files(
......@@ -17,6 +23,10 @@ def deploy_eip4788_contract_in_background(plan, sender_key, el_uri):
"SENDER_PRIVATE_KEY": sender_key,
"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
# The min/max CPU/memory that the execution node can use
EXECUTION_MIN_CPU = 100
EXECUTION_MAX_CPU = 1000
EXECUTION_MAX_CPU = 2000
EXECUTION_MIN_MEMORY = 256
EXECUTION_MAX_MEMORY = 1024
......
......@@ -16,10 +16,10 @@ ENGINE_RPC_PORT_NUM = 8551
METRICS_PORT_NUM = 9001
# The min/max CPU/memory that the execution node can use
EXECUTION_MIN_CPU = 100
EXECUTION_MAX_CPU = 1000
EXECUTION_MIN_MEMORY = 256
EXECUTION_MAX_MEMORY = 1024
EXECUTION_MIN_CPU = 300
EXECUTION_MAX_CPU = 2000
EXECUTION_MIN_MEMORY = 512
EXECUTION_MAX_MEMORY = 2048
# Port IDs
RPC_PORT_ID = "rpc"
......
......@@ -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(
plan,
......@@ -62,6 +68,10 @@ def get_config(config_files_artifact_name):
EL_FORKMON_CONFIG_MOUNT_DIRPATH_ON_SERVICE: config_files_artifact_name,
},
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
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(
plan,
......@@ -42,6 +48,10 @@ def launch(
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")
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_NUMBER = 5432
......@@ -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(
plan,
......@@ -34,59 +97,58 @@ def launch_full_beacon(
cl_client_contexts,
el_client_contexts,
):
# TODO perhaps use the official redis & postgres packages
db_services = plan.add_services(
configs={
# Add a Postgres server
"explorer-postgres": ServiceConfig(
postgres_output = postgres.run(
plan,
service_name="beaconchain-postgres",
image="postgres:15.2-alpine",
ports={
POSTGRES_PORT_ID: PortSpec(
POSTGRES_PORT_NUMBER, application_protocol="postgresql"
),
},
env_vars={
"POSTGRES_DB": POSTGRES_DB,
"POSTGRES_USER": POSTGRES_USER,
"POSTGRES_PASSWORD": POSTGRES_PASSWORD,
},
),
# Add a Redis server
"explorer-redis": ServiceConfig(
user=POSTGRES_USER,
password=POSTGRES_PASSWORD,
database=POSTGRES_DB,
min_cpu=POSTGRES_MIN_CPU,
max_cpu=POSTGRES_MAX_CPU,
min_memory=POSTGRES_MIN_MEMORY,
max_memory=POSTGRES_MAX_MEMORY,
persistent=False,
)
redis_output = redis.run(
plan,
service_name="beaconchain-redis",
image="redis:7",
ports={
REDIS_PORT_ID: PortSpec(
REDIS_PORT_NUMBER, application_protocol="tcp"
),
},
),
# Add a Bigtable Emulator server
"explorer-littlebigtable": ServiceConfig(
min_cpu=REDIS_MIN_CPU,
max_cpu=REDIS_MAX_CPU,
min_memory=REDIS_MIN_MEMORY,
max_memory=REDIS_MAX_MEMORY,
)
# TODO perhaps create a new service for the littlebigtable
little_bigtable = plan.add_service(
name="beaconchain-littlebigtable",
config=ServiceConfig(
image="gobitfly/little_bigtable:latest",
ports={
LITTLE_BIGTABLE_PORT_ID: PortSpec(
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_client_contexts[0].ip_addr, el_client_contexts[0].rpc_port_num
)
redis_uri = "{0}:{1}".format(
db_services["explorer-redis"].ip_address, REDIS_PORT_NUMBER
)
redis_url = "{}:{}".format(redis_output.hostname, redis_output.port_number)
template_data = new_config_template_data(
cl_client_contexts[0],
el_uri,
db_services["explorer-littlebigtable"].ip_address,
little_bigtable.ip_address,
LITTLE_BIGTABLE_PORT_NUMBER,
db_services["explorer-postgres"].ip_address,
postgres_output.url,
POSTGRES_PORT_NUMBER,
redis_uri,
redis_url,
FRONTEND_PORT_NUMBER,
)
......@@ -104,13 +166,17 @@ def launch_full_beacon(
# Initialize the db schema
initdbschema = plan.add_service(
name="explorer-schema-initializer",
name="beaconchain-schema-initializer",
config=ServiceConfig(
image=IMAGE_NAME,
files={
"/app/config/": config_files_artifact_name,
},
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(
# Start the indexer
indexer = plan.add_service(
name="explorer-indexer",
name="beaconchain-indexer",
config=ServiceConfig(
image=IMAGE_NAME,
files={
......@@ -153,11 +219,15 @@ def launch_full_beacon(
env_vars={
"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
eth1indexer = plan.add_service(
name="explorer-eth1indexer",
name="beaconchain-eth1indexer",
config=ServiceConfig(
image=IMAGE_NAME,
files={
......@@ -175,11 +245,15 @@ def launch_full_beacon(
"1",
"-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(
name="explorer-rewardsexporter",
name="beaconchain-rewardsexporter",
config=ServiceConfig(
image=IMAGE_NAME,
files={
......@@ -190,11 +264,15 @@ def launch_full_beacon(
"-config",
"/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(
name="explorer-statistics",
name="beaconchain-statistics",
config=ServiceConfig(
image=IMAGE_NAME,
files={
......@@ -208,11 +286,15 @@ def launch_full_beacon(
"-graffiti.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(
name="explorer-fdu",
name="beaconchain-fdu",
config=ServiceConfig(
image=IMAGE_NAME,
files={
......@@ -223,11 +305,15 @@ def launch_full_beacon(
"-config",
"/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(
name="explorer-frontend",
name="beaconchain-frontend",
config=ServiceConfig(
image=IMAGE_NAME,
files={
......@@ -246,12 +332,16 @@ def launch_full_beacon(
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(
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 {
"CLNodeHost": cl_node_info.ip_addr,
......@@ -261,7 +351,7 @@ def new_config_template_data(
"LBTPort": lbt_port,
"DBHost": db_host,
"DBPort": db_port,
"RedisEndpoint": redis_uri,
"RedisEndpoint": redis_url,
"FrontendPort": frontend_port,
}
......
......@@ -3,6 +3,12 @@ IMAGE_NAME = "ethpandaops/goomy-blob:master"
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(
plan,
......@@ -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 = {
)
}
# The min/max CPU/memory that grafana can use
MIN_CPU = 10
MAX_CPU = 1000
MIN_MEMORY = 128
MAX_MEMORY = 2048
def launch_grafana(
plan,
......@@ -136,6 +142,10 @@ def get_config(
GRAFANA_CONFIG_DIRPATH_ON_SERVICE: grafana_config_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")
input_parser = import_module("../package_io/input_parser.star")
input_parser = import_module("../../package_io/input_parser.star")
FLASHBOTS_MEV_BOOST_PROTOCOL = "TCP"
......@@ -16,6 +16,12 @@ NETWORK_ID_TO_NAME = {
"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):
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):
"SKIP_RELAY_SIGNATURE_CHECK": "1",
"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"
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):
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):
"RECEIVER_PUBLIC_KEY": receiver_key,
"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
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):
return "0x" + address
......@@ -12,6 +18,10 @@ def launch_mev_flood(plan, image, el_uri, contract_owner, normal_user):
config=ServiceConfig(
image=image,
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")
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_PUB_KEY = "0xa55c1285d84ba83a5ad26420cd5ad3091e49c55a813eee651cd467db38a8c8e63192f47955e9376f6b42f6d190571cb5"
......@@ -21,6 +21,24 @@ NETWORK_ID_TO_NAME = {
DONT_PERSIST_TO_DISK = False
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(
plan,
......@@ -31,7 +49,14 @@ def launch_mev_relay(
builder_uri,
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
postgres = postgres_module.run(
plan,
......@@ -41,6 +66,10 @@ def launch_mev_relay(
service_name="mev-relay-postgres",
persistent=DONT_PERSIST_TO_DISK,
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)
......@@ -75,6 +104,10 @@ def launch_mev_relay(
]
+ mev_params.mev_relay_housekeeper_extra_args,
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(
)
},
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(
)
},
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"
MOCK_MEV_BUILDER_PORT = 18550
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):
mock_builder = plan.add_service(
......@@ -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
"--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(
......
......@@ -34,7 +34,7 @@ HIGH_DENEB_VALUE_FORK_VERKLE = 20000
# MEV Params
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
MIN_VALIDATORS = 64
......
......@@ -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(
plan,
......@@ -84,6 +90,10 @@ def get_config(config_files_artifact_name):
"--web.console.templates=/etc/prometheus/consoles",
"--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 = {
),
}
# 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):
snooper_service_name = "{0}".format(service_name)
......@@ -48,4 +54,8 @@ def get_config(service_name, el_client_context):
ports=SNOOPER_USED_PORTS,
cmd=cmd,
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")
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(
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_
return ServiceConfig(
image=tx_spammer_image,
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