Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ethereum-package
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
ethereum-package
Commits
b789e170
Unverified
Commit
b789e170
authored
May 06, 2024
by
Barnabas Busa
Committed by
GitHub
May 06, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add enr/enode to apache (#589)
parent
525a8fb3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
96 additions
and
0 deletions
+96
-0
main.star
main.star
+2
-0
apache_launcher.star
src/apache/apache_launcher.star
+82
-0
static_files.star
src/static_files/static_files.star
+3
-0
enode.txt.tmpl
static_files/apache-config/enode.txt.tmpl
+3
-0
enr.txt.tmpl
static_files/apache-config/enr.txt.tmpl
+3
-0
enr_list.txt.tmpl
static_files/apache-config/enr_list.txt.tmpl
+3
-0
No files found.
main.star
View file @
b789e170
...
@@ -492,6 +492,8 @@ def run(plan, args={}):
...
@@ -492,6 +492,8 @@ def run(plan, args={}):
apache.launch_apache(
apache.launch_apache(
plan,
plan,
el_cl_data_files_artifact_uuid,
el_cl_data_files_artifact_uuid,
all_participants,
args_with_right_defaults.participants,
global_node_selectors,
global_node_selectors,
)
)
plan.print("Successfully launched apache")
plan.print("Successfully launched apache")
...
...
src/apache/apache_launcher.star
View file @
b789e170
...
@@ -6,6 +6,9 @@ HTTP_PORT_ID = "http"
...
@@ -6,6 +6,9 @@ HTTP_PORT_ID = "http"
HTTP_PORT_NUMBER = 80
HTTP_PORT_NUMBER = 80
APACHE_CONFIG_FILENAME = "index.html"
APACHE_CONFIG_FILENAME = "index.html"
APACHE_ENR_FILENAME = "boot_enr.yaml"
APACHE_ENODE_FILENAME = "bootnode.txt"
APACHE_ENR_LIST_FILENAME = "bootstrap_nodes.txt"
APACHE_CONFIG_MOUNT_DIRPATH_ON_SERVICE = "/usr/local/apache2/htdocs/"
APACHE_CONFIG_MOUNT_DIRPATH_ON_SERVICE = "/usr/local/apache2/htdocs/"
...
@@ -27,15 +30,60 @@ USED_PORTS = {
...
@@ -27,15 +30,60 @@ USED_PORTS = {
def launch_apache(
def launch_apache(
plan,
plan,
el_cl_genesis_data,
el_cl_genesis_data,
participant_contexts,
participant_configs,
global_node_selectors,
global_node_selectors,
):
):
config_files_artifact_name = plan.upload_files(
config_files_artifact_name = plan.upload_files(
src=static_files.APACHE_CONFIG_FILEPATH, name="apache-config"
src=static_files.APACHE_CONFIG_FILEPATH, name="apache-config"
)
)
all_cl_client_info = []
all_el_client_info = []
for index, participant in enumerate(participant_contexts):
_, cl_client, el_client, _ = shared_utils.get_client_names(
participant, index, participant_contexts, participant_configs
)
all_cl_client_info.append(new_cl_client_info(cl_client.enr))
all_el_client_info.append(new_el_client_info(el_client.enode))
template_data = new_config_template_data(
all_cl_client_info,
all_el_client_info,
)
enr_template_and_data = shared_utils.new_template_and_data(
read_file(static_files.APACHE_ENR_FILEPATH),
template_data,
)
enr_list_template_and_data = shared_utils.new_template_and_data(
read_file(static_files.APACHE_ENR_LIST_FILEPATH),
template_data,
)
enode_template_and_data = shared_utils.new_template_and_data(
read_file(static_files.APACHE_ENODE_FILEPATH),
template_data,
)
template_and_data_by_rel_dest_filepath = {}
template_and_data_by_rel_dest_filepath[APACHE_ENR_FILENAME] = enr_template_and_data
template_and_data_by_rel_dest_filepath[
APACHE_ENR_LIST_FILENAME
] = enr_list_template_and_data
template_and_data_by_rel_dest_filepath[
APACHE_ENODE_FILENAME
] = enode_template_and_data
bootstrap_info_files_artifact_name = plan.render_templates(
template_and_data_by_rel_dest_filepath, "bootstrap-info"
)
config = get_config(
config = get_config(
config_files_artifact_name,
config_files_artifact_name,
el_cl_genesis_data,
el_cl_genesis_data,
bootstrap_info_files_artifact_name,
global_node_selectors,
global_node_selectors,
)
)
...
@@ -45,10 +93,13 @@ def launch_apache(
...
@@ -45,10 +93,13 @@ def launch_apache(
def get_config(
def get_config(
config_files_artifact_name,
config_files_artifact_name,
el_cl_genesis_data,
el_cl_genesis_data,
bootstrap_info_files_artifact_name,
node_selectors,
node_selectors,
):
):
files = {
files = {
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data,
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_genesis_data,
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS
+ "/boot": bootstrap_info_files_artifact_name,
APACHE_CONFIG_MOUNT_DIRPATH_ON_SERVICE: config_files_artifact_name,
APACHE_CONFIG_MOUNT_DIRPATH_ON_SERVICE: config_files_artifact_name,
}
}
...
@@ -58,6 +109,18 @@ def get_config(
...
@@ -58,6 +109,18 @@ def get_config(
">>",
">>",
"/usr/local/apache2/conf/httpd.conf",
"/usr/local/apache2/conf/httpd.conf",
"&&",
"&&",
"mv",
"/network-configs/boot/" + APACHE_ENR_FILENAME,
"/network-configs/" + APACHE_ENR_FILENAME,
"&&",
"mv",
"/network-configs/boot/" + APACHE_ENODE_FILENAME,
"/network-configs/" + APACHE_ENODE_FILENAME,
"&&",
"mv",
"/network-configs/boot/" + APACHE_ENR_LIST_FILENAME,
"/network-configs/" + APACHE_ENR_LIST_FILENAME,
"&&",
"tar",
"tar",
"-czvf",
"-czvf",
"/usr/local/apache2/htdocs/network-config.tar",
"/usr/local/apache2/htdocs/network-config.tar",
...
@@ -82,3 +145,22 @@ def get_config(
...
@@ -82,3 +145,22 @@ def get_config(
max_memory=MAX_MEMORY,
max_memory=MAX_MEMORY,
node_selectors=node_selectors,
node_selectors=node_selectors,
)
)
def new_config_template_data(cl_client, el_client):
return {
"CLClient": cl_client,
"ELClient": el_client,
}
def new_cl_client_info(enr):
return {
"Enr": enr,
}
def new_el_client_info(enode):
return {
"Enode": enode,
}
src/static_files/static_files.star
View file @
b789e170
...
@@ -17,6 +17,9 @@ VALIDATOR_RANGES_CONFIG_TEMPLATE_FILEPATH = (
...
@@ -17,6 +17,9 @@ VALIDATOR_RANGES_CONFIG_TEMPLATE_FILEPATH = (
)
)
APACHE_CONFIG_FILEPATH = STATIC_FILES_DIRPATH + "/apache-config/index.html"
APACHE_CONFIG_FILEPATH = STATIC_FILES_DIRPATH + "/apache-config/index.html"
APACHE_ENR_FILEPATH = STATIC_FILES_DIRPATH + "/apache-config/enr.txt.tmpl"
APACHE_ENR_LIST_FILEPATH = STATIC_FILES_DIRPATH + "/apache-config/enr_list.txt.tmpl"
APACHE_ENODE_FILEPATH = STATIC_FILES_DIRPATH + "/apache-config/enode.txt.tmpl"
DORA_CONFIG_TEMPLATE_FILEPATH = STATIC_FILES_DIRPATH + "/dora-config/config.yaml.tmpl"
DORA_CONFIG_TEMPLATE_FILEPATH = STATIC_FILES_DIRPATH + "/dora-config/config.yaml.tmpl"
DUGTRIO_CONFIG_TEMPLATE_FILEPATH = (
DUGTRIO_CONFIG_TEMPLATE_FILEPATH = (
...
...
static_files/apache-config/enode.txt.tmpl
0 → 100644
View file @
b789e170
{{ range $elClient := .ELClient }}
{{ $elClient.Enode }}
{{- end }}
static_files/apache-config/enr.txt.tmpl
0 → 100644
View file @
b789e170
{{ range $clClient := .CLClient }}
- {{ $clClient.Enr }}
{{- end }}
static_files/apache-config/enr_list.txt.tmpl
0 → 100644
View file @
b789e170
{{ range $clClient := .CLClient }}
{{ $clClient.Enr }}
{{- end }}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment