diff --git a/ansible/group_vars/nimbus-mainnet-small.yml b/ansible/group_vars/nimbus-mainnet-small.yml index ee93ef9..53110fd 100644 --- a/ansible/group_vars/nimbus-mainnet-small.yml +++ b/ansible/group_vars/nimbus-mainnet-small.yml @@ -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)}}' diff --git a/ansible/group_vars/nimbus-pyrmont-unstable.yml b/ansible/group_vars/nimbus-pyrmont-unstable.yml index d9b9835..c671215 100644 --- a/ansible/group_vars/nimbus-pyrmont-unstable.yml +++ b/ansible/group_vars/nimbus-pyrmont-unstable.yml @@ -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 - diff --git a/ansible/mainnet.yml b/ansible/mainnet.yml index 058e3a2..ec55c5e 100644 --- a/ansible/mainnet.yml +++ b/ansible/mainnet.yml @@ -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 ] } diff --git a/ansible/prater.yml b/ansible/prater.yml index 1acf7cd..3b7ed39 100644 --- a/ansible/prater.yml +++ b/ansible/prater.yml @@ -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 ] } diff --git a/ansible/pyrmont.yml b/ansible/pyrmont.yml index da057fc..26dc207 100644 --- a/ansible/pyrmont.yml +++ b/ansible/pyrmont.yml @@ -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 ] } diff --git a/ansible/requirements.yml b/ansible/requirements.yml index 7f16df7..00a7a56 100644 --- a/ansible/requirements.yml +++ b/ansible/requirements.yml @@ -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 diff --git a/ansible/roles/get-geth-web3-urls/README.md b/ansible/roles/get-geth-web3-urls/README.md new file mode 100644 index 0000000..c48513d --- /dev/null +++ b/ansible/roles/get-geth-web3-urls/README.md @@ -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. diff --git a/ansible/roles/get-geth-web3-urls/defaults/main.yml b/ansible/roles/get-geth-web3-urls/defaults/main.yml new file mode 100644 index 0000000..8948f2c --- /dev/null +++ b/ansible/roles/get-geth-web3-urls/defaults/main.yml @@ -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 }}' diff --git a/ansible/roles/get-geth-web3-urls/tasks/main.yml b/ansible/roles/get-geth-web3-urls/tasks/main.yml new file mode 100644 index 0000000..8f4cd59 --- /dev/null +++ b/ansible/roles/get-geth-web3-urls/tasks/main.yml @@ -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 }}'