Skip to content

Commit 960c848

Browse files
feat: support multiple-network deployments (#152)
* feat: support multiple-network deployments * fix: bring back zeam image * fix: zeam validator-config.yaml path
1 parent 6baba7c commit 960c848

25 files changed

Lines changed: 159 additions & 69 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,11 @@ Every Ansible deployment automatically deploys an observability stack alongside
249249
- `tmp/local-run-DD-MM-YYYY-HH-MM.log` for local deployments
250250
- `tmp/ansible-run-DD-MM-YYYY-HH-MM.log` for Ansible deployments
251251
- Example: `NETWORK_DIR=local-devnet ./spin-node.sh --node all --logs`
252+
19. `--network` sets the network name label attached to every metric and log stream scraped by the observability stack (Ansible mode only).
253+
- Default: `devnet-3`, set in `parse-env.sh` after argument parsing
254+
- Propagated to Ansible as the `network_name` variable, which is used in `prometheus.yml.j2` and `promtail.yml.j2` templates
255+
- Appears as the `network` label on all Prometheus scrape targets (app, node_exporter, cadvisor) and all Promtail log streams, so you can filter by network in Grafana across multiple environments
256+
- Example: `--network devnet-x`
252257

253258
### Preparing remote servers
254259

ansible/playbooks/clean-node-data.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
connection: local
77
gather_facts: no
88
vars:
9-
validator_config_file: "{{ genesis_dir }}/validator-config.yaml"
9+
validator_config_file: "{{ local_validator_config_path | default(genesis_dir + '/validator-config.yaml') }}"
1010
tags:
1111
- zeam
1212
- ream

ansible/playbooks/deploy-nodes.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
- deploy
1919
- observability
2020
vars:
21-
validator_config_file: "{{ genesis_dir }}/validator-config.yaml"
21+
validator_config_file: "{{ local_validator_config_path | default(genesis_dir + '/validator-config.yaml') }}"
2222

2323
tasks:
2424
- name: Validate validator-config.yaml exists
@@ -122,10 +122,7 @@
122122

123123
- name: Sync validator-config.yaml to remote host
124124
copy:
125-
# Use the expanded subnet config when --subnets was specified; fall back
126-
# to the standard validator-config.yaml otherwise. The destination is
127-
# always validator-config.yaml so client roles don't need to change.
128-
src: "{{ local_genesis_dir }}/{{ validator_config_basename | default('validator-config.yaml') }}"
125+
src: "{{ local_validator_config_path | default(local_genesis_dir + '/validator-config.yaml') }}"
129126
dest: "{{ genesis_dir }}/validator-config.yaml"
130127
mode: '0644'
131128
force: yes

ansible/playbooks/generate-genesis.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,19 @@
3434
set_fact:
3535
project_root: "{{ project_root_result.stdout }}"
3636

37+
- name: Copy custom validator config to genesis dir if different
38+
copy:
39+
src: "{{ local_validator_config_path }}"
40+
dest: "{{ genesis_dir }}/validator-config.yaml"
41+
mode: '0644'
42+
when:
43+
- local_validator_config_path is defined
44+
- local_validator_config_path != genesis_dir + '/validator-config.yaml'
45+
3746
- name: Run generate-genesis.sh script
3847
shell: |
39-
cd "{{ project_root }}" && ./generate-genesis.sh "{{ genesis_dir }}" --mode ansible --offset {{ genesis_time_offset }}
48+
cd "{{ project_root }}" && ./generate-genesis.sh "{{ genesis_dir }}" --mode ansible --offset {{ genesis_time_offset }}{% if local_validator_config_path is defined and local_validator_config_path != '' %} --validator-config "{{ local_validator_config_path }}"{% endif %}
49+
4050
register: genesis_result
4151
args:
4252
executable: /bin/bash
@@ -55,7 +65,7 @@
5565

5666
- name: Extract node names from validator-config.yaml
5767
shell: |
58-
yq eval '.validators[].name' "{{ genesis_dir }}/validator-config.yaml"
68+
yq eval '.validators[].name' "{{ local_validator_config_path | default(genesis_dir + '/validator-config.yaml') }}"
5969
register: node_names_raw
6070
changed_when: false
6171

ansible/playbooks/helpers/deploy-single-node.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- name: Set validator config file paths
1010
set_fact:
1111
actual_validator_config_file: "{{ genesis_dir }}/validator-config.yaml"
12-
local_validator_config_file: "{{ hostvars['localhost']['local_genesis_dir_path'] }}/validator-config.yaml"
12+
local_validator_config_file: "{{ local_validator_config_path }}"
1313

1414
- name: Extract node configuration (from local config)
1515
shell: |

ansible/playbooks/prepare.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224

225225
- name: Read all node entries for this host from the active validator config
226226
vars:
227-
_vc_file: "{{ _genesis_dir + '/' + (validator_config_basename | default('validator-config.yaml')) }}"
227+
_vc_file: "{{ local_validator_config_path | default(_genesis_dir + '/validator-config.yaml') }}"
228228
_vc: "{{ lookup('file', _vc_file) | from_yaml }}"
229229
_entries: "{{ _vc.validators | selectattr('enrFields.ip', 'equalto', ansible_host) | list }}"
230230
set_fact:

ansible/playbooks/stop-nodes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
connection: local
88
gather_facts: yes
99
vars:
10-
validator_config_file: "{{ genesis_dir }}/validator-config.yaml"
10+
validator_config_file: "{{ local_validator_config_path | default(genesis_dir + '/validator-config.yaml') }}"
1111

1212
tasks:
1313
- name: Validate validator-config.yaml exists

ansible/roles/ethlambda/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
- name: Extract node configuration from validator-config.yaml
3333
shell: |
34-
yq eval ".validators[] | select(.name == \"{{ node_name }}\") | .{{ item }}" "{{ hostvars['localhost']['local_genesis_dir_path'] }}/validator-config.yaml"
34+
yq eval ".validators[] | select(.name == \"{{ node_name }}\") | .{{ item }}" "{{ local_validator_config_path }}"
3535
register: ethlambda_node_config
3636
changed_when: false
3737
delegate_to: localhost

ansible/roles/gean/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
- name: Extract node configuration from validator-config.yaml
2929
shell: |
30-
yq eval ".validators[] | select(.name == \"{{ node_name }}\") | .{{ item }}" "{{ hostvars['localhost']['local_genesis_dir_path'] }}/validator-config.yaml"
30+
yq eval ".validators[] | select(.name == \"{{ node_name }}\") | .{{ item }}" "{{ local_validator_config_path }}"
3131
register: gean_node_config
3232
changed_when: false
3333
delegate_to: localhost

ansible/roles/grandine/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
- name: Extract node configuration from validator-config.yaml
3333
shell: |
34-
yq eval ".validators[] | select(.name == \"{{ node_name }}\") | .{{ item }}" "{{ hostvars['localhost']['local_genesis_dir_path'] }}/validator-config.yaml"
34+
yq eval ".validators[] | select(.name == \"{{ node_name }}\") | .{{ item }}" "{{ local_validator_config_path }}"
3535
register: grandine_node_config
3636
changed_when: false
3737
delegate_to: localhost

0 commit comments

Comments
 (0)