nimbus.prater: refactor node layout configuration

This is necessary to support multiple hosts with multiple nodes.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2021-10-04 21:55:47 +02:00
parent 018e1f3b78
commit 7eb4c4749c
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
3 changed files with 82 additions and 103 deletions

View File

@ -1,52 +1,77 @@
---
# Not pretty but avoids useless files
node_branch: |-
{{ (hostname is search("unstable")) | ternary("unstable", (
(hostname is search("testing")) | ternary("testing", (
(hostname is search("stable")) | ternary("stable", (
(hostname is search("u-libp2p-u")) | ternary("unstable-libp2p-unstable", (
(hostname is search("u-libp2p-s")) | ternary("unstable-libp2p-stable", "UNKNOWN")
)))))))) }}
# TEMPORARY switch for Prater Altair transition
beacon_node_repo_branch: 'unstable' # '{{ node_branch }}'
beacon_node_repo_branch: 'unstable' # '{{ node.branch }}'
beacon_node_network: 'prater'
beacon_node_service_name: 'beacon-node-{{ beacon_node_network }}-{{ node_branch }}'
# TODO Drop this once all nodes have an number.
service_number: '{{ node.get("num", False) | ternary(("-%02d"|format(node.get("num", 0))), "") }}'
beacon_node_service_name: 'beacon-node-{{ beacon_node_network }}-{{ node.branch }}{{ service_number }}'
# Ports
beacon_node_discovery_port: 9000
beacon_node_listening_port: 9000
beacon_node_metrics_port: 9200
beacon_node_rest_port: 9300
beacon_node_rpc_port: 9900
beacon_node_discovery_port: '{{ 9000 + port_offset }}'
beacon_node_listening_port: '{{ 9000 + port_offset }}'
beacon_node_metrics_port: '{{ 9200 + port_offset }}'
beacon_node_rest_port: '{{ 9300 + port_offset }}'
beacon_node_rpc_port: '{{ 9900 + port_offset }}'
# Tuning
beacon_node_max_peers: 300
beacon_node_threads: '{{ (beacon_node_repo_branch == "testing") | ternary(4, 1) }}'
beacon_node_threads: '{{ (node.branch == "testing") | ternary(4, 1) }}'
# Builds
beacon_node_build_frequency: '{{ node.get("build_freq", "daily") }}'
beacon_node_build_start_time: '{{ node.get("build_start", omit) }}'
# Validators from nimbus-private repo
beacon_node_dist_validators_enabled: '{{ node.start is defined and node.end is defined }}'
beacon_node_dist_validators_start: '{{ node.start | mandatory }}'
beacon_node_dist_validators_end: '{{ node.end | mandatory }}'
# Windows service user
beacon_node_service_user_pass: '{{lookup("bitwarden", "nimbus/windows", field="password")}}'
# Split by hostname for more central location
validators_layout:
nodes_layout:
# 2500 validators per node
'stable-large-01.aws-eu-central-1a.nimbus.prater': { start: 0, end: 2500 }
'stable-large-02.aws-eu-central-1a.nimbus.prater': { start: 2500, end: 5000 }
'stable-large-03.aws-eu-central-1a.nimbus.prater': { start: 5000, end: 7500 }
# 2500 validators per node
'testing-large-01.aws-eu-central-1a.nimbus.prater': { start: 12500, end: 15000 }
'testing-large-02.aws-eu-central-1a.nimbus.prater': { start: 15000, end: 17500 }
'testing-large-03.aws-eu-central-1a.nimbus.prater': { start: 17500, end: 20000 }
# 2500 validators per node
"unstable-large-01.aws-eu-central-1a.nimbus.prater": { start: 25000, end: 27500 }
"unstable-large-02.aws-eu-central-1a.nimbus.prater": { start: 27500, end: 30000 }
"unstable-large-03.aws-eu-central-1a.nimbus.prater": { start: 30000, end: 32500 }
# 1250 validators per node
'u-libp2p-s-large-01.aws-eu-central-1a.nimbus.prater': { start: 37500, end: 38750 }
# 1250 validators per node
'u-libp2p-u-large-01.aws-eu-central-1a.nimbus.prater': { start: 38750, end: 40000 }
'stable-large-01.aws-eu-central-1a.nimbus.prater':
- { branch: 'stable', start: 0, end: 2500 }
'stable-large-02.aws-eu-central-1a.nimbus.prater':
- { branch: 'stable', start: 2500, end: 5000 }
'stable-large-03.aws-eu-central-1a.nimbus.prater':
- { branch: 'stable', start: 5000, end: 7500 }
# Copy correct validators from nimbus-private repo
beacon_node_dist_validators_enabled: true
beacon_node_dist_validators_start: '{{ validators_layout[hostname]["start"] | mandatory }}'
beacon_node_dist_validators_end: '{{ validators_layout[hostname]["end"] | mandatory }}'
# 2500 validators per node
'testing-large-01.aws-eu-central-1a.nimbus.prater':
- { branch: 'testing', start: 12500, end: 15000 }
'testing-large-02.aws-eu-central-1a.nimbus.prater':
- { branch: 'testing', start: 15000, end: 17500 }
'testing-large-03.aws-eu-central-1a.nimbus.prater':
- { branch: 'testing', start: 17500, end: 20000 }
# 2500 validators per node
"unstable-large-01.aws-eu-central-1a.nimbus.prater":
- { branch: 'unstable', start: 25000, end: 27500 }
"unstable-large-02.aws-eu-central-1a.nimbus.prater":
- { branch: 'unstable', start: 27500, end: 30000 }
"unstable-large-03.aws-eu-central-1a.nimbus.prater":
- { branch: 'unstable', start: 30000, end: 32500 }
# 1250 validators per node
'u-libp2p-s-large-01.aws-eu-central-1a.nimbus.prater':
- { branch: 'unstable-libp2p-stable', start: 37500, end: 38750 }
'u-libp2p-u-large-01.aws-eu-central-1a.nimbus.prater':
- { branch: 'unstable-libp2p-unstable', start: 38750, end: 40000 }
# 2500 validators per node
'metal-01.he-eu-hel1.nimbus.prater':
- { branch: 'stable', num: 1, start: 10000, end: 12500, build_freq: '*-*-* 12:00:00' }
- { branch: 'stable', num: 2, build_freq: '*-*-* 13:00:00' }
- { branch: 'testing', num: 1, start: 22500, end: 25000, build_freq: '*-*-* 14:00:00' }
- { branch: 'testing', num: 2, build_freq: '*-*-* 15:00:00' }
- { branch: 'unstable', num: 1, start: 35000, end: 37500, build_freq: '*-*-* 16:00:00' }
- { branch: 'unstable', num: 2, build_freq: '*-*-* 17:00:00' }
# 2500 validators per node
'windows-01.gc-us-central1-a.nimbus.prater':
- { branch: 'stable', start: 7500, end: 10000, build_start: '13:00:00' }
- { branch: 'testing', start: 32500, end: 35000, build_start: '15:00:00' }
- { branch: 'unstable', start: 20000, end: 22500, build_start: '16:00:00' }
'macos-01.ms-eu-dublin.nimbus.prater':
- { branch: 'stable', build_start: '13:00:00' }
- { branch: 'testing', build_start: '15:00:00' }
- { branch: 'unstable', build_start: '16:00:00' }

View File

@ -20,10 +20,14 @@
- nimbus-prater-unstable-libp2p-stable
- nimbus-prater-unstable-libp2p-unstable
roles:
- role: get-geth-web3-urls
tags: get-geth-web3-urls
- role: infra-role-beacon-node-linux
tags: beacon-node
- { role: get-geth-web3-urls, tags: get-geth-web3-urls }
tasks:
- include_role: name=infra-role-beacon-node-linux
tags: [ beacon-node, infra-role-beacon-node-linux ]
with_items: '{{ nodes_layout[hostname] }}'
loop_control:
loop_var: node
index_var: port_offset
- name: Deploy mainnet linux beacon nodes
become: true
@ -33,28 +37,8 @@
- { role: get-geth-web3-urls, tags: [ get-geth-web3-urls ] }
tasks:
- include_role: name=infra-role-beacon-node-linux
tags: beacon-node
vars:
# TEMPORARY switch for Prater Altair transition
beacon_node_service_name: 'beacon-node-{{ beacon_node_network }}-{{ node.branch }}-{{ "%02d"|format(node.idx) }}'
beacon_node_repo_branch: "unstable"
beacon_node_threads: '{{ (node.branch == "testing") | ternary(4, 1) }}'
beacon_node_build_frequency: '{{ node.build_freq }}'
beacon_node_discovery_port: '{{ 9000 + port_offset }}'
beacon_node_listening_port: '{{ 9000 + port_offset }}'
beacon_node_metrics_port: '{{ 9200 + port_offset }}'
beacon_node_rest_port: '{{ 9300 + port_offset }}'
beacon_node_rpc_port: '{{ 9900 + port_offset }}'
beacon_node_dist_validators_enabled: '{{ node.start is defined and node.end is defined }}'
beacon_node_dist_validators_start: '{{ node.start }}'
beacon_node_dist_validators_end: '{{ node.end }}'
with_items:
- { branch: 'stable', idx: 1, start: 10000, end: 12500, build_freq: '*-*-* 12:00:00' }
- { branch: 'stable', idx: 2, build_freq: '*-*-* 13:00:00' }
- { branch: 'testing', idx: 1, start: 22500, end: 25000, build_freq: '*-*-* 14:00:00' }
- { branch: 'testing', idx: 2, build_freq: '*-*-* 15:00:00' }
- { branch: 'unstable', idx: 1, start: 35000, end: 37500, build_freq: '*-*-* 16:00:00' }
- { branch: 'unstable', idx: 2, build_freq: '*-*-* 17:00:00' }
tags: [ beacon-node, infra-role-beacon-node-linux ]
with_items: '{{ nodes_layout[hostname] }}'
loop_control:
loop_var: node
index_var: port_offset
@ -65,24 +49,8 @@
fact_path: 'C:/ansible/facts.d'
tasks:
- include_role: name=infra-role-beacon-node-windows
tags: beacon-node
vars:
# TEMPORARY switch for Prater Altair transition
beacon_node_service_name: 'beacon-node-{{ beacon_node_network }}-{{ node.branch }}'
beacon_node_repo_branch: 'unstable'
beacon_node_build_start_time: '{{ node.build_start }}'
beacon_node_discovery_port: '{{ 9000 + port_offset }}'
beacon_node_listening_port: '{{ 9000 + port_offset }}'
beacon_node_metrics_port: '{{ 9200 + port_offset }}'
beacon_node_rest_port: '{{ 9300 + port_offset }}'
beacon_node_rpc_port: '{{ 9900 + port_offset }}'
beacon_node_dist_validators_start: '{{ node.start }}'
beacon_node_dist_validators_end: '{{ node.end }}'
beacon_node_log_level: 'INFO'
with_items:
- { branch: 'stable', start: 7500, end: 10000, build_start: '13:00:00' }
- { branch: 'unstable', start: 20000, end: 22500, build_start: '15:00:00' }
- { branch: 'testing', start: 32500, end: 35000, build_start: '17:00:00' }
tags: [ beacon-node, infra-role-beacon-node-windows ]
with_items: '{{ nodes_layout[hostname] }}'
loop_control:
loop_var: node
index_var: port_offset
@ -93,21 +61,7 @@
tasks:
- include_role: name=infra-role-beacon-node-macos
tags: [ beacon-node, infra-role-beacon-node-macos ]
vars:
beacon_node_repo_branch: '{{ node.branch }}'
beacon_node_build_frequency: '{{ node.build_frequency }}'
beacon_node_build_start_time: '{{ node.build_start }}'
beacon_node_discovery_port: '{{ 9000 + port_offset }}'
beacon_node_listening_port: '{{ 9000 + port_offset }}'
beacon_node_metrics_port: '{{ 9200 + port_offset }}'
beacon_node_rpc_port: '{{ 9900 + port_offset }}'
beacon_node_dist_validators_enabled: false
beacon_node_dist_validators_start: '{{ node.start }}'
beacon_node_dist_validators_end: '{{ node.end }}'
with_items:
- { branch: 'stable', start: 0, end: 0, build_start: {'hour': '12', 'minute': '00'} }
- { branch: 'testing', start: 0, end: 0, build_start: {'hour': '14', 'minute': '00'} }
- { branch: 'unstable', start: 0, end: 0, build_start: {'hour': '16', 'minute': '00'} }
with_items: '{{ nodes_layout[hostname] }}'
loop_control:
loop_var: node
index_var: port_offset

View File

@ -46,17 +46,17 @@
- name: infra-role-beacon-node-linux
src: git@github.com:status-im/infra-role-beacon-node-linux.git
version: 8e08632b1d854e0318fffcc4a47e95ef3cd656b6
version: 822808ca069cc49ab02f6e0ddb57af05efb6bc99
scm: git
- name: infra-role-beacon-node-windows
src: git@github.com:status-im/infra-role-beacon-node-windows.git
version: 4e0ef739b0cdcca6ab902701b999149fe787ac5b
version: 235f5fcc1b0a073bc19d44030f88bf221aac39f6
scm: git
- name: infra-role-beacon-node-macos
src: git@github.com:status-im/infra-role-beacon-node-macos.git
version: 32bb0097ed4db170aee39e139fd7d2c3ee440b0f
version: 0aa4959dcc5ede1ab4c7fc62a2ea2d03e731b2e8
scm: git
- name: infra-role-nimbus-eth1
@ -76,7 +76,7 @@
- name: infra-role-winsw
src: git@github.com:status-im/infra-role-winsw.git
version: 44f335715fda2e0ba1b2cb2b815389e05c5ae0b1
version: 1b633346c0b2c05095c29f1f0a4e4a76d60d1e99
scm: git
- name: kibana