mirror of
https://github.com/status-im/infra-nimbus.git
synced 2025-01-29 06:55:16 +00:00
implement Eth1 Web3 URL fallbacks
Related: https://github.com/status-im/infra-role-beacon-node/commit/92f740e0 Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
762f4e3457
commit
65d8302527
@ -1,7 +1,6 @@
|
||||
---
|
||||
beacon_node_network: 'mainnet'
|
||||
beacon_node_cont_tag: 'stable-small'
|
||||
beacon_node_web3_url: 'wss://mainnet.infura.io/ws/v3/9e2f2cc13f70432f8b87dbe7d51b81db'
|
||||
|
||||
# WARNING: Since these are Eth 2 bootnodes we need to keep the keys and IPs unchanged.
|
||||
beacon_node_netkey: '{{lookup("passwordstore","service/Nimbus/netkey/"+hostname)}}'
|
||||
|
@ -8,4 +8,3 @@ dist_validators_layout:
|
||||
"unstable-small-02.aws-eu-central-1a.nimbus.pyrmont": { start: 18250, end: 18850 } # 600
|
||||
"unstable-small-03.aws-eu-central-1a.nimbus.pyrmont": { start: 18850, end: 18999 } # 149
|
||||
"unstable-small-04.aws-eu-central-1a.nimbus.pyrmont": { start: 18999, end: 19000 } # single validator
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
- name: Configure network mainnet bootnodes
|
||||
become: true
|
||||
hosts:
|
||||
- nimbus-mainnet-small
|
||||
hosts: 'nimbus.mainnet'
|
||||
roles:
|
||||
- { role: get-geth-web3-urls, tags: [ get-geth-web3-urls ] }
|
||||
- { role: infra-role-beacon-node, tags: [ infra-role-beacon-node, beacon-node ] }
|
||||
|
@ -20,23 +20,8 @@
|
||||
become: true
|
||||
# To avoid clashing/duplicate validators.
|
||||
any_errors_fatal: true
|
||||
hosts:
|
||||
- nimbus-prater-stable
|
||||
- nimbus-prater-testing
|
||||
- nimbus-prater-unstable
|
||||
- nimbus-prater-unstable-libp2p-stable
|
||||
- nimbus-prater-unstable-libp2p-unstable
|
||||
pre_tasks:
|
||||
- name: Discover Goerli Geth WebSocket endpoint
|
||||
tags: [ infra-role-beacon-node, beacon-node ]
|
||||
uri:
|
||||
url: '{{ consul_catalog_url }}/service/nimbus-goerli-node-ws'
|
||||
register: geth_service
|
||||
|
||||
- name: Extract Goerli Geth WebSocket URL
|
||||
tags: [ infra-role-beacon-node, beacon-node ]
|
||||
set_fact:
|
||||
beacon_node_web3_url: 'ws://{{ geth_service.json[0].ServiceAddress }}:{{ geth_service.json[0].ServicePort }}'
|
||||
hosts: 'nimbus.prater'
|
||||
roles:
|
||||
- { role: distribute-validators, tags: [ distribute-validators ] }
|
||||
- { role: get-geth-web3-urls, tags: [ get-geth-web3-urls ] }
|
||||
- { role: infra-role-beacon-node, tags: [ infra-role-beacon-node, beacon-node ] }
|
||||
|
@ -21,22 +21,8 @@
|
||||
become: true
|
||||
# To avoid clashing/duplicate validators.
|
||||
any_errors_fatal: true
|
||||
hosts:
|
||||
- nimbus-pyrmont-stable
|
||||
- nimbus-pyrmont-testing
|
||||
- nimbus-pyrmont-unstable
|
||||
- nimbus-pyrmont-unstable-libp2p
|
||||
pre_tasks:
|
||||
- name: Discover Goerli Geth WebSocket endpoint
|
||||
tags: [ infra-role-beacon-node, beacon-node ]
|
||||
uri:
|
||||
url: '{{ consul_catalog_url }}/service/nimbus-goerli-node-ws'
|
||||
register: geth_service
|
||||
|
||||
- name: Extract Goerli Geth WebSocket URL
|
||||
tags: [ infra-role-beacon-node, beacon-node ]
|
||||
set_fact:
|
||||
beacon_node_web3_url: 'ws://{{ geth_service.json[0].ServiceAddress }}:{{ geth_service.json[0].ServicePort }}'
|
||||
hosts: 'nimbus.pyrmont'
|
||||
roles:
|
||||
- { role: distribute-validators, tags: [ distribute-validators ] }
|
||||
- { role: get-geth-web3-urls, tags: [ get-geth-web3-urls ] }
|
||||
- { role: infra-role-beacon-node, tags: [ infra-role-beacon-node, beacon-node ] }
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
- name: infra-role-bootstrap
|
||||
src: git@github.com:status-im/infra-role-bootstrap.git
|
||||
version: 3ccd7f5512491a06f79f81ac18791b869db1134c
|
||||
version: 865f5bb4a4478a665b8105c39ee54bd42f9a835d
|
||||
scm: git
|
||||
|
||||
- name: oauth-proxy
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
- name: infra-role-beacon-node
|
||||
src: git@github.com:status-im/infra-role-beacon-node.git
|
||||
version: 0a57ff8b2920bb63d0b54866e3c8ed1822683417
|
||||
version: 92f740e089094a372c179d8ae2c793c8f1415464
|
||||
scm: git
|
||||
|
||||
- name: kibana
|
||||
|
14
ansible/roles/get-geth-web3-urls/README.md
Normal file
14
ansible/roles/get-geth-web3-urls/README.md
Normal file
@ -0,0 +1,14 @@
|
||||
# Description
|
||||
|
||||
This role assembles the list of Web3 Eth1 URLs used by Nimbus Beacon nodes to sync with Eth1 chain.
|
||||
|
||||
# Configuration
|
||||
|
||||
There is only one important configuration key:
|
||||
```yaml
|
||||
infura_api_tokens:
|
||||
- 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
|
||||
- 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
|
||||
- 'cccccccccccccccccccccccccccccccc'
|
||||
```
|
||||
And the more we have the less likely that we hit the Infura treshhold.
|
18
ansible/roles/get-geth-web3-urls/defaults/main.yml
Normal file
18
ansible/roles/get-geth-web3-urls/defaults/main.yml
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
eth2_to_eth1_map:
|
||||
pyrmont: 'goerli'
|
||||
prater: 'goerli'
|
||||
mainnet: 'mainnet'
|
||||
|
||||
eth2_network_name: '{{ beacon_node_network | mandatory }}'
|
||||
eth1_network_name: '{{ eth2_to_eth1_map[eth2_network_name] | mandatory }}'
|
||||
web3_geth_node_consul_name: 'nimbus-{{ eth1_network_name | mandatory }}-node-ws'
|
||||
# The more the merrier, since we don't want to hit Infura throttling.
|
||||
infura_api_tokens:
|
||||
- '9e2f2cc13f70432f8b87dbe7d51b81db'
|
||||
- '922cc3c4badf4789b68d895267530a4a'
|
||||
- '01cde3e0c47a47ff8dcdc52259b3a71c'
|
||||
- '675db4626923473591cf6418e4dae175'
|
||||
|
||||
selected_infura_token: '{{ infura_api_tokens[play_hosts.index(inventory_hostname) % (infura_api_tokens|length)] }}'
|
||||
selected_infura_url: 'wss://{{ eth1_network_name }}.infura.io/ws/v3/{{ selected_infura_token }}'
|
13
ansible/roles/get-geth-web3-urls/tasks/main.yml
Normal file
13
ansible/roles/get-geth-web3-urls/tasks/main.yml
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: Discover Goerli Geth WebSocket endpoint
|
||||
uri:
|
||||
url: '{{ consul_catalog_url }}/service/{{ web3_geth_node_consul_name }}'
|
||||
register: geth_service
|
||||
|
||||
- name: Extract Goerli Geth WebSocket URL
|
||||
set_fact:
|
||||
beacon_node_web3_urls:
|
||||
# Our Goerli node goes first, and will be used by default.
|
||||
- 'ws://{{ geth_service.json[0].ServiceAddress }}:{{ geth_service.json[0].ServicePort }}'
|
||||
# We want to spread the load, but we want the choice to be deterministic.
|
||||
- '{{ selected_infura_url }}'
|
Loading…
x
Reference in New Issue
Block a user