Commit 205256a6 authored by Barnabas Busa's avatar Barnabas Busa Committed by GitHub

feat: add apache file server (#581)

parent 9139f4b4
additional_services:
- apache
......@@ -24,6 +24,7 @@ additional_services:
- blockscout
- dugtrio
- blutgang
- apache
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
mev_type: full
......
......@@ -34,6 +34,7 @@ additional_services:
- blockscout
- dugtrio
- blutgang
- apache
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
keymanager_enabled: true
......@@ -26,6 +26,7 @@ additional_services:
- blockscout
- dugtrio
- blutgang
- apache
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
keymanager_enabled: true
......@@ -191,6 +191,15 @@ For example, to retrieve the Execution Layer (EL) genesis data, run:
kurtosis files download my-testnet el-genesis-data ~/Downloads
```
# Basic file sharing
Apache is included in the package to allow for basic file sharing. The Apache service is started when additional services are enabled. It will expose the network-configs directory, which might needed if you want to share the network config publicly.
```yaml
additional_services:
- apache
```
## Configuration
To configure the package behaviour, you can modify your `network_params.yaml` file. The full YAML schema that can be passed in is as follows with the defaults provided:
......@@ -544,6 +553,7 @@ additional_services:
- blobscan
- dugtrio
- blutgang
- apache
# Configuration place for transaction spammer - https:#github.com/MariusVanDerWijden/tx-fuzz
tx_spammer_params:
......
......@@ -24,6 +24,7 @@ dora = import_module("./src/dora/dora_launcher.star")
dugtrio = import_module("./src/dugtrio/dugtrio_launcher.star")
blutgang = import_module("./src/blutgang/blutgang_launcher.star")
blobscan = import_module("./src/blobscan/blobscan_launcher.star")
apache = import_module("./src/apache/apache_launcher.star")
full_beaconchain_explorer = import_module(
"./src/full_beaconchain/full_beaconchain_launcher.star"
)
......@@ -419,6 +420,14 @@ def run(plan, args={}):
global_node_selectors,
)
plan.print("Successfully launched blobscan")
elif additional_service == "apache":
plan.print("Launching apache")
apache.launch_apache(
plan,
el_cl_data_files_artifact_uuid,
global_node_selectors,
)
plan.print("Successfully launched apache")
elif additional_service == "full_beaconchain_explorer":
plan.print("Launching full-beaconchain-explorer")
full_beaconchain_explorer_config_template = read_file(
......
shared_utils = import_module("../shared_utils/shared_utils.star")
static_files = import_module("../static_files/static_files.star")
constants = import_module("../package_io/constants.star")
SERVICE_NAME = "apache"
HTTP_PORT_ID = "http"
HTTP_PORT_NUMBER = 80
APACHE_CONFIG_FILENAME = "index.html"
APACHE_CONFIG_MOUNT_DIRPATH_ON_SERVICE = "/usr/local/apache2/htdocs/"
# The min/max CPU/memory that assertoor can use
MIN_CPU = 100
MAX_CPU = 300
MIN_MEMORY = 128
MAX_MEMORY = 256
USED_PORTS = {
HTTP_PORT_ID: shared_utils.new_port_spec(
HTTP_PORT_NUMBER,
shared_utils.TCP_PROTOCOL,
shared_utils.HTTP_APPLICATION_PROTOCOL,
)
}
def launch_apache(
plan,
el_cl_genesis_data,
global_node_selectors,
):
config_files_artifact_name = plan.upload_files(
src=static_files.APACHE_CONFIG_FILEPATH, name="apache-config"
)
config = get_config(
config_files_artifact_name,
el_cl_genesis_data,
global_node_selectors,
)
plan.add_service(SERVICE_NAME, config)
def get_config(
config_files_artifact_name,
el_cl_genesis_data,
node_selectors,
):
files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data,
APACHE_CONFIG_MOUNT_DIRPATH_ON_SERVICE: config_files_artifact_name,
}
cmd = [
"echo",
"AddType application/octet-stream .tar",
">>",
"/usr/local/apache2/conf/httpd.conf",
"&&",
"tar",
"-czvf",
"/usr/local/apache2/htdocs/network-config.tar",
"-C",
"/network-configs/",
".",
"&&",
"httpd-foreground",
]
cmd_str = " ".join(cmd)
return ServiceConfig(
image="httpd:latest",
ports=USED_PORTS,
cmd=[cmd_str],
entrypoint=["sh", "-c"],
files=files,
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
node_selectors=node_selectors,
)
......@@ -16,6 +16,8 @@ VALIDATOR_RANGES_CONFIG_TEMPLATE_FILEPATH = (
STATIC_FILES_DIRPATH + "/validator-ranges/config.yaml.tmpl"
)
APACHE_CONFIG_FILEPATH = STATIC_FILES_DIRPATH + "/apache-config/index.html"
DORA_CONFIG_TEMPLATE_FILEPATH = STATIC_FILES_DIRPATH + "/dora-config/config.yaml.tmpl"
DUGTRIO_CONFIG_TEMPLATE_FILEPATH = (
STATIC_FILES_DIRPATH + "/dugtrio-config/config.yaml.tmpl"
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome to My Website</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
.container {
max-width: 800px;
margin: 20px auto;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
color: #333;
text-align: center;
}
.download-btn {
display: block;
width: 200px;
margin: 20px auto;
padding: 10px;
text-align: center;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
text-decoration: none; /* Remove underline */
}
.download-btn:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="container">
<h1>Welcome to Kurtosis File sharing site</h1>
<a href="network-config.tar" class="download-btn">Download network configs</a>
</div>
</body>
</html>
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