Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add static ports #677

Merged
merged 27 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f2704d4
feat(config): WIP: Update port publisher config
TobiWo Jun 16, 2024
a9f1edc
feat(package-io): WIP: Enrich input parser for client and additional …
TobiWo Jun 16, 2024
d51e8fc
feat(package-io): Add port id constants
TobiWo Jun 22, 2024
9237452
feat(shared-utils): WIP: Add port publisher convenience functions
TobiWo Jun 16, 2024
5f36814
feat(cl): Add participant index to launch method
TobiWo Jun 16, 2024
da6220c
feat(cl): Add cl_shared module for general cl public port specs
TobiWo Jun 30, 2024
f022bc4
feat(cl): Add static port support for cl clients
TobiWo Jun 16, 2024
21e6514
feat(vc): Reference port ids from constants
TobiWo Jun 22, 2024
f9b94bd
feat(vc): WIP: Add public port logic to lighthouse
TobiWo Jun 22, 2024
3a40761
feat(vc): WIP: Add public port logic to vc configs
TobiWo Jun 26, 2024
e34cd01
feat(vc): Add port_publisher and vc_index to vc_launcher
TobiWo Jun 22, 2024
265172e
feat(participant-network): Add port_publisher and vc_index to vc laun…
TobiWo Jun 22, 2024
817671e
feat(el): Add el_shared module for general el public port specs
TobiWo Jun 30, 2024
7a44536
feat(el): WIP: Add static port support for el clients
TobiWo Jun 24, 2024
14e6a5f
feat(el): WIP: Add static port support for el launcher
TobiWo Jun 24, 2024
8f9948b
feat(additional-services): WIP: Add static port feature
TobiWo Jun 26, 2024
b36ccd1
feat(main): Add port publisher config and index to additional service…
TobiWo Jun 26, 2024
f552ed2
add readme, fix test case
barnabasbusa Jul 1, 2024
99d7987
fix workflow
barnabasbusa Jul 1, 2024
cf59094
fix workflow quotes
barnabasbusa Jul 1, 2024
c1bd11c
fix workflow only run discord if secret present
barnabasbusa Jul 1, 2024
48e9eee
fix workflow only run discord if secret present nightly
barnabasbusa Jul 1, 2024
949cdec
fix forky
barnabasbusa Jul 2, 2024
831685c
fix security issue
barnabasbusa Jul 2, 2024
b0e8caf
feat(shared-utils): Improve public port convenience functions
TobiWo Jul 3, 2024
31bf32a
feat(package-io): Add separate websocket port id
TobiWo Jul 3, 2024
b87acc6
feat(el): Add separate websocket port id to respective clients
TobiWo Jul 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/tests/mix-public.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,15 @@ participants:
cl_type: grandine
additional_services: []
port_publisher:
public_port_start: 30000
el:
enabled: true
public_port_start: 32000
cl:
enabled: true
public_port_start: 33000
vc:
enabled: true
public_port_start: 34000
additional_services:
enabled: true
public_port_start: 35000
22 changes: 16 additions & 6 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,19 @@ jobs:
echo "Skipping ./.github/tests/mix-with-tools-mev.yaml"
fi

- name: Check if Discord Webhook is Set
id: check_discord_webhook
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
run: |
if [ -z "$DISCORD_WEBHOOK" ]; then
echo "discord_webhook_set=false" >> $GITHUB_ENV
else
echo "discord_webhook_set=true" >> $GITHUB_ENV
fi

- name: Notify
if: cancelled() || failure()
if: (cancelled() || failure()) && env.discord_webhook_set == 'true'
uses: Ilshidur/action-discord@master
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
Expand All @@ -54,12 +65,11 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Kurtosis Assertoor GitHub Action
uses: ethpandaops/kurtosis-assertoor-github-action@v1
with:
ethereum_package_branch: ${{ steps.extract_branch.outputs.branch }}
kurtosis_extra_args: "--image-download always --non-blocking-tasks --verbosity DETAILED"
ethereum_package_branch: ""
ethereum_package_args: .github/tests/mix-assert.yaml
ethereum_package_url: "$GITHUB_WORKSPACE"
persistent_logs: "true"
23 changes: 19 additions & 4 deletions .github/workflows/run-k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'
- cron: '0 2 * * *'

concurrency:
group: "scheduled-test"
Expand All @@ -21,15 +21,18 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup minikube
id: minikube
uses: medyagh/setup-minikube@latest

- name: Get kubeconfig
id: kubeconfig
shell: bash
run: |
cat ~/.kube/config > kubeconfig
echo "kubeconfig=$(cat kubeconfig | base64 -w 0)" >> $GITHUB_OUTPUT

# run kurtosis test and assertoor
- name: Run kurtosis testnet
id: testnet
Expand All @@ -40,15 +43,27 @@ jobs:
kubernetes_config: "${{ steps.kubeconfig.outputs.kubeconfig }}"
kubernetes_cluster: "minikube"
kubernetes_storage_class: "standard"
ethereum_package_branch: "${{ github.head_ref || github.ref_name }}"
ethereum_package_branch: ""
ethereum_package_args: "${{ matrix.payload.file }}"
ethereum_package_url: "$GITHUB_WORKSPACE"
enclave_name: "ethereum-package-${{ matrix.payload.name }}-${{ github.run_id }}"
persistent_logs: "true"

- name: Check if Discord Webhook is Set
id: check_discord_webhook
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
run: |
if [ -z "$DISCORD_WEBHOOK" ]; then
echo "discord_webhook_set=false" >> $GITHUB_ENV
else
echo "discord_webhook_set=true" >> $GITHUB_ENV
fi

- name: Notify
if: cancelled() || failure()
if: (cancelled() || failure()) && env.discord_webhook_set == 'true'
uses: Ilshidur/action-discord@master
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: "The k8s nightly/per PR test for ${{matrix.payload.name}} on ethereum-package has failed find it here ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
args: "The k8s nightly/per PR test for ${{matrix.payload.name}} on ethereum-package has failed. Find it here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
31 changes: 28 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -797,9 +797,34 @@ port_publisher:
# Defaults to constants.PRIVATE_IP_ADDRESS_PLACEHOLDER
# The default value just means its the IP address of the container in which the service is running
nat_exit_ip: KURTOSIS_IP_ADDR_PLACEHOLDER
# The start value gets used as a seed for TCP and UDP discovery ports for el/cl client
# Defaults to None - no public ports
public_port_start: null
# Execution Layer public port exposed to your local machine
# Disabled by default
# Public port start defaults to 32000
# You can't run multiple enclaves on the same port settings
el:
enabled: false
public_port_start: 32000
# Consensus Layer public port exposed to your local machine
# Disabled by default
# Public port start defaults to 33000
# You can't run multiple enclaves on the same port settings
cl:
enabled: false
public_port_start: 33000
# Validator client public port exposed to your local machine
# Disabled by default
# Public port start defaults to 34000
# You can't run multiple enclaves on the same port settings
vc:
enabled: false
public_port_start: 34000
# Additional services public port exposed to your local machine
# Disabled by default
# Public port start defaults to 35000
# You can't run multiple enclaves on the same port settings
additional_services:
enabled: false
public_port_start: 35000
```

#### Example configurations
Expand Down
24 changes: 23 additions & 1 deletion main.star
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,9 @@ def run(plan, args={}):
return output

launch_prometheus_grafana = False
for additional_service in args_with_right_defaults.additional_services:
for index, additional_service in enumerate(
args_with_right_defaults.additional_services
):
if additional_service == "tx_spammer":
plan.print("Launching transaction spammer")
tx_spammer_params = args_with_right_defaults.tx_spammer_params
Expand Down Expand Up @@ -421,6 +423,8 @@ def run(plan, args={}):
el_forkmon_config_template,
all_el_contexts,
global_node_selectors,
args_with_right_defaults.port_publisher,
index,
)
plan.print("Successfully launched execution layer forkmon")
elif additional_service == "beacon_metrics_gazer":
Expand All @@ -431,6 +435,8 @@ def run(plan, args={}):
all_cl_contexts,
network_params,
global_node_selectors,
args_with_right_defaults.port_publisher,
index,
)
)
launch_prometheus_grafana = True
Expand All @@ -445,6 +451,8 @@ def run(plan, args={}):
all_el_contexts,
persistent,
global_node_selectors,
args_with_right_defaults.port_publisher,
index,
)
plan.print("Successfully launched blockscout")
elif additional_service == "dora":
Expand All @@ -462,6 +470,8 @@ def run(plan, args={}):
global_node_selectors,
mev_endpoints,
mev_endpoint_names,
args_with_right_defaults.port_publisher,
index,
)
plan.print("Successfully launched dora")
elif additional_service == "dugtrio":
Expand All @@ -476,6 +486,8 @@ def run(plan, args={}):
args_with_right_defaults.participants,
network_params,
global_node_selectors,
args_with_right_defaults.port_publisher,
index,
)
plan.print("Successfully launched dugtrio")
elif additional_service == "blutgang":
Expand All @@ -490,6 +502,8 @@ def run(plan, args={}):
args_with_right_defaults.participants,
network_params,
global_node_selectors,
args_with_right_defaults.port_publisher,
index,
)
plan.print("Successfully launched blutgang")
elif additional_service == "blobscan":
Expand All @@ -501,6 +515,8 @@ def run(plan, args={}):
network_params.network_id,
persistent,
global_node_selectors,
args_with_right_defaults.port_publisher,
index,
)
plan.print("Successfully launched blobscan")
elif additional_service == "forky":
Expand All @@ -517,6 +533,8 @@ def run(plan, args={}):
network_params,
global_node_selectors,
final_genesis_timestamp,
args_with_right_defaults.port_publisher,
index,
)
plan.print("Successfully launched forky")
elif additional_service == "tracoor":
Expand All @@ -533,6 +551,8 @@ def run(plan, args={}):
network_params,
global_node_selectors,
final_genesis_timestamp,
args_with_right_defaults.port_publisher,
index,
)
plan.print("Successfully launched tracoor")
elif additional_service == "apache":
Expand All @@ -559,6 +579,8 @@ def run(plan, args={}):
all_el_contexts,
persistent,
global_node_selectors,
args_with_right_defaults.port_publisher,
index,
)
plan.print("Successfully launched full-beaconchain-explorer")
elif additional_service == "prometheus_grafana":
Expand Down
13 changes: 12 additions & 1 deletion network_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,16 @@ global_tolerations: []
global_node_selectors: {}
keymanager_enabled: false
port_publisher:
public_port_start: null
nat_exit_ip: KURTOSIS_IP_ADDR_PLACEHOLDER
el:
enabled: false
public_port_start: 32000
cl:
enabled: false
public_port_start: 33000
vc:
enabled: false
public_port_start: 34000
additional_services:
enabled: false
public_port_start: 35000
25 changes: 21 additions & 4 deletions src/beacon_metrics_gazer/beacon_metrics_gazer_launcher.star
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
shared_utils = import_module("../shared_utils/shared_utils.star")
prometheus = import_module("../prometheus/prometheus_launcher.star")

constants = import_module("../package_io/constants.star")

SERVICE_NAME = "beacon-metrics-gazer"
IMAGE_NAME = "ethpandaops/beacon-metrics-gazer:master"

HTTP_PORT_ID = "http"
HTTP_PORT_NUMBER = 8080

METRICS_PATH = "/metrics"
Expand All @@ -17,7 +16,7 @@ BEACON_METRICS_GAZER_CONFIG_MOUNT_DIRPATH_ON_SERVICE = "/config"
VALIDATOR_RANGES_ARTIFACT_NAME = "validator-ranges"

USED_PORTS = {
HTTP_PORT_ID: shared_utils.new_port_spec(
constants.HTTP_PORT_ID: shared_utils.new_port_spec(
HTTP_PORT_NUMBER,
shared_utils.TCP_PROTOCOL,
shared_utils.HTTP_APPLICATION_PROTOCOL,
Expand All @@ -36,10 +35,14 @@ def launch_beacon_metrics_gazer(
cl_contexts,
network_params,
global_node_selectors,
port_publisher,
additional_service_index,
):
config = get_config(
cl_contexts[0].beacon_http_url,
global_node_selectors,
port_publisher,
additional_service_index,
)

beacon_metrics_gazer_service = plan.add_service(SERVICE_NAME, config)
Expand All @@ -56,14 +59,28 @@ def launch_beacon_metrics_gazer(
)


def get_config(beacon_http_url, node_selectors):
def get_config(
beacon_http_url,
node_selectors,
port_publisher,
additional_service_index,
):
config_file_path = shared_utils.path_join(
BEACON_METRICS_GAZER_CONFIG_MOUNT_DIRPATH_ON_SERVICE,
BEACON_METRICS_GAZER_CONFIG_FILENAME,
)

public_ports = shared_utils.get_additional_service_standard_public_port(
port_publisher,
constants.HTTP_PORT_ID,
additional_service_index,
0,
)

return ServiceConfig(
image=IMAGE_NAME,
ports=USED_PORTS,
public_ports=public_ports,
files={
BEACON_METRICS_GAZER_CONFIG_MOUNT_DIRPATH_ON_SERVICE: VALIDATOR_RANGES_ARTIFACT_NAME,
},
Expand Down
Loading