-
Notifications
You must be signed in to change notification settings - Fork 16
Add lighthouse to PQ interop #74
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| # Default variables for lighthouse role | ||
| # Note: These are fallback defaults. Actual values are extracted from client-cmds/ream-cmd.sh | ||
| # in the tasks/main.yml file. These defaults are used if extraction fails. | ||
|
|
||
| lighthouse_docker_image: "hopinheimer/lighthouse:latest" | ||
| deployment_mode: docker |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| --- | ||
| # Lighthouse role: Deploy and manage Lighthouse nodes | ||
| # Converts client-cmds/lighthouse-cmd.sh logic to Ansible tasks | ||
|
|
||
| - name: Extract docker image from client-cmd.sh | ||
| shell: | | ||
| # Extract the first word (docker image) from node_docker line | ||
| # playbook_dir points to ansible/playbooks, go up two levels to reach project root | ||
| project_root="$(cd '{{ playbook_dir }}/../..' && pwd)" | ||
| grep -E '^node_docker=' "$project_root/client-cmds/lighthouse-cmd.sh" | head -1 | sed -E 's/.*node_docker="([^ "]+).*/\1/' | ||
| register: lighthouse_docker_image_raw | ||
| changed_when: false | ||
| delegate_to: localhost | ||
| run_once: true | ||
|
|
||
| - name: Extract deployment mode from client-cmd.sh | ||
| shell: | | ||
| # Extract the value from node_setup line | ||
| project_root="$(cd '{{ playbook_dir }}/../..' && pwd)" | ||
| grep -E '^node_setup=' "$project_root/client-cmds/lighthouse-cmd.sh" | head -1 | sed -E 's/.*node_setup="([^"]+)".*/\1/' | ||
| register: lighthouse_deployment_mode_raw | ||
| changed_when: false | ||
| delegate_to: localhost | ||
| run_once: true | ||
|
|
||
| - name: Set docker image and deployment mode from client-cmd.sh | ||
| set_fact: | ||
| lighthouse_docker_image: "{{ lighthouse_docker_image_raw.stdout | trim | default('hopinheimer/lighthouse:latest') }}" | ||
| deployment_mode: "{{ lighthouse_deployment_mode_raw.stdout | trim | default('docker') }}" | ||
|
|
||
| - name: Extract node configuration from validator-config.yaml | ||
| shell: | | ||
| yq eval ".validators[] | select(.name == \"{{ node_name }}\") | .{{ item }}" "{{ genesis_dir }}/validator-config.yaml" | ||
| register: lighthouse_node_config | ||
| changed_when: false | ||
| loop: | ||
| - enrFields.quic | ||
| - privkey | ||
| when: node_name is defined | ||
|
|
||
| - name: Set node ports | ||
| set_fact: | ||
| lighthouse_quic_port: "{{ lighthouse_node_config.results[0].stdout }}" | ||
| lighthouse_privkey: "{{ lighthouse_node_config.results[1].stdout }}" | ||
| when: lighthouse_node_config is defined | ||
|
|
||
| - name: Ensure node key file exists | ||
| stat: | ||
| path: "{{ genesis_dir }}/{{ node_name }}.key" | ||
| register: node_key_stat | ||
|
|
||
| - name: Debug node key file check | ||
| debug: | ||
| msg: "Checking for key file at {{ genesis_dir }}/{{ node_name }}.key - exists: {{ node_key_stat.stat.exists | default('undefined') }}" | ||
|
|
||
| - name: Fail if node key file is missing | ||
| fail: | ||
| msg: "Node key file {{ node_name }}.key not found in {{ genesis_dir }}" | ||
| when: not (node_key_stat.stat.exists | default(false)) | ||
|
|
||
| - name: Clean node data directory | ||
| file: | ||
| path: "{{ data_dir }}/{{ node_name }}" | ||
| state: absent | ||
| when: clean_data | default(false) | bool | ||
|
|
||
| - name: Create node data directory | ||
| file: | ||
| path: "{{ data_dir }}/{{ node_name }}" | ||
| state: directory | ||
| mode: '0755' | ||
|
|
||
| - name: Deploy Lighthouse node using Docker | ||
| block: | ||
| - name: Pull Lighthouse docker image | ||
| command: docker pull {{ lighthouse_docker_image }} | ||
| register: lighthouse_docker_pull | ||
| changed_when: '"Downloaded newer image" in lighthouse_docker_pull.stdout' | ||
|
|
||
| - name: Stop existing Lighthouse container (if any) | ||
| command: docker rm -f {{ node_name }} | ||
| register: lighthouse_stop | ||
| failed_when: false | ||
| changed_when: lighthouse_stop.rc == 0 | ||
|
|
||
| - name: Start Lighthouse container | ||
| command: >- | ||
| docker run -d | ||
| --name {{ node_name }} | ||
| --restart unless-stopped | ||
| --network host | ||
| -v {{ genesis_dir }}:/config:ro | ||
| -v {{ data_dir }}/{{ node_name }}:/data | ||
| {{ lighthouse_docker_image }} | ||
| lighthouse lean_node | ||
| --datadir /data | ||
| --config /config/config.yaml | ||
| --validators /config/validator-config.yaml | ||
| --nodes /config/nodes.yaml | ||
| --node-id {{ node_name }} | ||
| --private-key /config/{{ node_name }}.key | ||
| --genesis-json /config/genesis.json | ||
| --socket-port {{ lighthouse_quic_port }} | ||
| register: lighthouse_container | ||
| changed_when: lighthouse_container.rc == 0 | ||
| when: deployment_mode == 'docker' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/bin/bash | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please also add a metrics flag to this node configuration? so it would make it much easier to collect metrics from the clients.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi! we currently don't have metrics implemented yet as mentioned in the PR desc but it's a work in progress and will update here once it's ready. |
||
| node_binary="$lighthouse_bin lean_node \ | ||
| --datadir \"$dataDir/$item\" \ | ||
| --config \"$configDir/config.yaml\" \ | ||
| --validators \"$configDir/validator-config.yaml\" \ | ||
| --nodes \"$configDir/nodes.yaml\" \ | ||
| --node-id \"$item\" \ | ||
| --private-key \"$configDir/$privKeyPath\" \ | ||
| --genesis-json \"$configDir/genesis.json\" \ | ||
| --socket-port $quicPort" | ||
|
|
||
| node_docker="hopinheimer/lighthouse:latest lighthouse lean_node \ | ||
| --datadir /data \ | ||
| --config /config/config.yaml \ | ||
| --validators /config/validator-config.yaml \ | ||
| --nodes /config/nodes.yaml \ | ||
| --node-id $item \ | ||
| --private-key /config/$privKeyPath \ | ||
| --genesis-json /config/genesis.json \ | ||
| --socket-port $quicPort" | ||
|
|
||
| node_setup="docker" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This IP is being used by zeam right now. Please backout the changes in this file. I'll handle it based on server availability.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deployment via ansible will require changes in other files as well.
@hopinheimer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should merge in the changes and get the IP from ethpandaops
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already have one server that we can use @g11tech . But having another one does help. For ansible we need changes to other files as wel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so can you tell @hopinheimer what other changes we need for the ansible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ch4r10t33r answering your earlier question. yup the implementation consumes the key files but generates genesis in runtime for now over genesis.ssz/.json which I think should be fine for now. I think the node wouldn't have spun because of the above platform mismatch if you're running anything non-x86. alternatively if you want to just want to see if things are working now. you could pull my PR to lighthouse and run
docker build . -t lighthouse:localand make subsequent changes inlighthouse-cmd.shto pick the local image and run the local-devnet. but nonetheless I'll have the image updated tomorrow.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I figured. On the key files, I wanted to highlight that although the
hash-sig-cligenerates both ssz and json files, the ssz ones are preferred. Thanks.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, I noticed the legacy tag during generation of key. I have added it my tracker to switch over I think it should be okay for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, feel free to retain 46.224.135.169 for lighthouse. I have moved zeam to another server. @hopinheimer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!