get-geth-api-urls: query for HTTP RPC API endpoints

We want to test the support for normal HTTP API endpoints.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2021-12-02 13:10:06 +01:00
parent 62835a2079
commit 0c1169cee3
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
10 changed files with 19 additions and 67 deletions

View File

@ -18,7 +18,7 @@
roles:
- { role: swap-file, tags: [ swap-file ] }
- { role: redirect-ports, tags: [ redirect-ports ] }
- { role: get-geth-web3-urls, tags: [ get-geth-web3-urls ] }
- { role: get-geth-api-urls, tags: [ get-geth-api-urls ] }
tasks:
- include_role: name=infra-role-beacon-node-linux
tags: [ beacon-node, infra-role-beacon-node-linux ]
@ -32,7 +32,7 @@
hosts: nimbus-mainnet-metal
roles:
- { role: redirect-ports, tags: [ redirect-ports ] }
- { role: get-geth-web3-urls, tags: [ get-geth-web3-urls ] }
- { role: get-geth-api-urls, tags: [ get-geth-api-urls ] }
tasks:
- include_role: name=infra-role-beacon-node-linux
tags: [ beacon-node, infra-role-beacon-node-linux ]

View File

@ -18,7 +18,7 @@
- nimbus-prater-testing
- nimbus-prater-unstable
roles:
- { role: get-geth-web3-urls, tags: get-geth-web3-urls }
- { role: get-geth-api-urls, tags: get-geth-api-urls }
tasks:
- include_role: name=infra-role-beacon-node-linux
tags: [ beacon-node, infra-role-beacon-node-linux ]
@ -31,8 +31,8 @@
become: true
hosts: nimbus-prater-metal
roles:
- { role: redirect-ports, tags: [ redirect-ports ] }
- { role: get-geth-web3-urls, tags: [ get-geth-web3-urls ] }
- { role: redirect-ports, tags: [ redirect-ports ] }
- { role: get-geth-api-urls, tags: [ get-geth-api-urls ] }
tasks:
- include_role: name=infra-role-beacon-node-linux
tags: [ beacon-node, infra-role-beacon-node-linux ]
@ -46,7 +46,7 @@
hosts: nimbus-prater-windows
fact_path: 'C:/ansible/facts.d'
roles:
- { role: get-geth-web3-urls, tags: [ get-geth-web3-urls ] }
- { role: get-geth-api-urls, tags: [ get-geth-api-urls ] }
tasks:
- include_role: name=infra-role-beacon-node-windows
tags: [ beacon-node, infra-role-beacon-node-windows ]

View File

@ -15,8 +15,8 @@
hosts:
- nimbus-pyrmont-metal
roles:
- { role: redirect-ports, tags: redirect-ports }
- { role: get-geth-web3-urls, tags: get-geth-web3-urls }
- { role: redirect-ports, tags: redirect-ports }
- { role: get-geth-api-urls, tags: get-geth-api-urls }
tasks:
- include_role: name=infra-role-beacon-node-linux
tags: [ beacon-node, infra-role-beacon-node-linux ]

View File

@ -4,11 +4,14 @@ This role assembles the list of Web3 Eth1 URLs used by Nimbus Beacon nodes to sy
# Configuration
There is only one important configuration key:
There are only two important configuration keys:
```yaml
geth_node_api_consul_name: 'my-geth-node-rpc'
infura_api_tokens:
- 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
- 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
- 'cccccccccccccccccccccccccccccccc'
```
And the more we have the less likely that we hit the Infura treshhold.
The Geth node Consul service is expected to have an `url` in metadata.

View File

@ -6,7 +6,7 @@ eth2_to_eth1_map:
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'
geth_node_api_consul_name: 'nimbus-{{ eth1_network_name | mandatory }}-node-rpc'
# The more the merrier, since we don't want to hit Infura throttling.
infura_api_tokens:
- '9e2f2cc13f70432f8b87dbe7d51b81db'

View File

@ -6,6 +6,6 @@
- name: Find available geth websocket services
uri:
url: '{{ consul_catalog_url }}/service/{{ web3_geth_node_consul_name }}?dc={{ item }}'
url: '{{ consul_catalog_url }}/service/{{ geth_node_api_consul_name }}?dc={{ item }}'
with_items: '{{ data_centers.json }}'
register: geth_ws_services

View File

@ -8,7 +8,7 @@
- name: Find available geth websocket services
win_uri:
url: '{{ consul_catalog_url }}/service/{{ web3_geth_node_consul_name }}?dc={{ item }}'
url: '{{ consul_catalog_url }}/service/{{ geth_node_api_consul_name }}?dc={{ item }}'
content_type: 'application/json'
return_content: true
with_items: '{{ data_centers.json }}'

View File

@ -8,15 +8,14 @@
# On Windows json attribute is missing when it's [].
- name: Extract Geth websocket IP and port
set_fact:
geth_ws_addresses: |
geth_api_addresses: |
{{ geth_ws_services.results
| selectattr("json", "defined")
| sum(attribute="json", start=[])
| json_query("[].[ServiceAddress, ServicePort]")
| map('join', ':')
| map(attribute='ServiceMeta.url')
| list }}
- name: Extract Goerli Geth WebSocket URL
set_fact:
# our nodes first (will be used by default) then an infura node
beacon_node_web3_urls: "{{ geth_ws_addresses + [ selected_infura_url ] }}"
beacon_node_web3_urls: "{{ geth_api_addresses + [ selected_infura_url ] }}"

View File

@ -1,25 +0,0 @@
---
- name: Find available data centers
uri:
url: '{{ consul_catalog_url }}/datacenters'
register: data_centers
- name: Find available geth websocket services
uri:
url: '{{ consul_catalog_url }}/service/{{ web3_geth_node_consul_name }}?dc={{ item }}'
with_items: '{{ data_centers.json }}'
register: geth_ws_services
- name: Extract Geth websocket IP and port
set_fact:
geth_ws_addresses: |
{{ geth_ws_services.results
| sum(attribute="json", start=[])
| json_query("[].[ServiceAddress, ServicePort]")
| map('join', ':')
| list }}
- name: Extract Goerli Geth WebSocket URL
set_fact:
# our nodes first (will be used by default) then an infura node
beacon_node_web3_urls: "{{ geth_ws_addresses + [ selected_infura_url ] }}"

View File

@ -1,25 +0,0 @@
---
- name: Find available data centers
win_uri:
url: '{{ consul_catalog_url }}/datacenters'
register: data_centers
- name: Find available geth websocket services
win_uri:
url: '{{ consul_catalog_url }}/service/{{ web3_geth_node_consul_name }}?dc={{ item }}'
with_items: '{{ data_centers.json }}'
register: geth_ws_services
- name: Extract Geth websocket IP and port
set_fact:
geth_ws_addresses: |
{{ geth_ws_services.results
| sum(attribute="json", start=[])
| json_query("[].[ServiceAddress, ServicePort]")
| map('join', ':')
| list }}
- name: Extract Goerli Geth WebSocket URL
set_fact:
# our nodes first (will be used by default) then an infura node
beacon_node_web3_urls: "{{ geth_ws_addresses + [ selected_infura_url ] }}"