Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 ansible-devnet/genesis/validator-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,15 @@ validators:
ip: "46.224.135.177"
quic: 9001
metricsPort: 8081
count: 1
count: 1

- name: "lighthouse_0"
# node id a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2
# peer id 16Uiu2HAm7TYVs6qvDKnrovd9m4vvRikc4HPXm1WyLumKSe5fHxBv
privkey: "4fd22cf461fbeae4947a3fdaef8d533fc7fd1ef1ce4cd98e993210c18234df3f"
# verify /ip4/127.0.0.1/udp/9004/quic-v1/p2p/16Uiu2HAm7TYVs6qvDKnrovd9m4vvRikc4HPXm1WyLumKSe5fHxBv
enrFields:
ip: "46.224.135.169"
Copy link
Contributor

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.

Copy link
Contributor

@ch4r10t33r ch4r10t33r Dec 18, 2025

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.

  • ansible/roles/lighthouse/tasks/main.yml
  • ansible/roles/lighthouse/defaults/main.yml
  • Modifications to generate-ansible-inventory.sh to include lighthouse nodes
  • run-ansible.sh to include lighthouse nodes
    @hopinheimer

Copy link
Member

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

Copy link
Contributor

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.

Copy link
Member

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

Copy link
Contributor Author

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:local and make subsequent changes in lighthouse-cmd.sh to pick the local image and run the local-devnet. but nonetheless I'll have the image updated tomorrow.

Copy link
Contributor

@ch4r10t33r ch4r10t33r Dec 18, 2025

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-cli generates both ssz and json files, the ssz ones are preferred. Thanks.

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

quic: 9001
metricsPort: 8081
count: 1
7 changes: 7 additions & 0 deletions ansible/roles/lighthouse/defaults/main.yml
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
106 changes: 106 additions & 0 deletions ansible/roles/lighthouse/tasks/main.yml
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'
22 changes: 22 additions & 0 deletions client-cmds/lighthouse-cmd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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"
4 changes: 3 additions & 1 deletion generate-ansible-inventory.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,16 @@ all:
hosts: {}
lantern_nodes:
hosts: {}
lighthouse_nodes:
hosts: {}
EOF

# Extract node information from validator-config.yaml
nodes=($(yq eval '.validators[].name' "$VALIDATOR_CONFIG"))

# Process each node and generate inventory entries
for node_name in "${nodes[@]}"; do
# Extract client type (zeam, ream, qlean, lantern)
# Extract client type (zeam, ream, qlean, lantern, lighthouse)
IFS='_' read -r -a elements <<< "$node_name"
client_type="${elements[0]}"
group_name="${client_type}_nodes"
Expand Down
13 changes: 12 additions & 1 deletion local-devnet/genesis/validator-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,15 @@ validators:
ip: "127.0.0.1"
quic: 9004
metricsPort: 8084
count: 1
count: 1

- name: "lighthouse_0"
# node id a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2
# peer id 16Uiu2HAm7TYVs6qvDKnrovd9m4vvRikc4HPXm1WyLumKSe5fHxBv
privkey: "4fd22cf461fbeae4947a3fdaef8d533fc7fd1ef1ce4cd98e993210c18234df3f"
# verify /ip4/127.0.0.1/udp/9004/quic-v1/p2p/16Uiu2HAm7TYVs6qvDKnrovd9m4vvRikc4HPXm1WyLumKSe5fHxBv
enrFields:
ip: "127.0.0.1"
quic: 9005
metricsPort: 8085
count: 1
4 changes: 2 additions & 2 deletions run-ansible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ fi

# Update inventory with SSH key file and user if provided
if command -v yq &> /dev/null; then
# Get all remote host groups (zeam_nodes, ream_nodes, qlean_nodes, lantern_nodes)
for group in zeam_nodes ream_nodes qlean_nodes lantern_nodes; do
# Get all remote host groups (zeam_nodes, ream_nodes, qlean_nodes, lantern_nodes, lighthouse_nodes)
for group in zeam_nodes ream_nodes qlean_nodes lantern_nodes lighthouse_nodes; do
# Get all hosts in this group
hosts=$(yq eval ".all.children.$group.hosts | keys | .[]" "$INVENTORY_FILE" 2>/dev/null || echo "")
for host in $hosts; do
Expand Down