get-geth-web3-urls: support windows and deploy

Fixes sync issues described in:
https://github.com/status-im/infra-nimbus/issues/75

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2021-10-12 13:52:13 +02:00
parent bd6ed56d74
commit 6c67bcabdc
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
7 changed files with 92 additions and 17 deletions

View File

@ -47,6 +47,8 @@
become: true
hosts: nimbus-prater-windows
fact_path: 'C:/ansible/facts.d'
roles:
- { role: get-geth-web3-urls, tags: [ get-geth-web3-urls ] }
tasks:
- include_role: name=infra-role-beacon-node-windows
tags: [ beacon-node, infra-role-beacon-node-windows ]

View File

@ -26,12 +26,12 @@
- name: infra-role-bootstrap-macos
src: git@github.com:status-im/infra-role-bootstrap-macos.git
version: f40b13e3ed9b6913e4234fa2c1cdf9ccc69fb807
version: bc6c41f415b9ea759c44473385bb248f23d83ba7
scm: git
- name: infra-role-wireguard
src: git@github.com:status-im/infra-role-wireguard.git
version: 13f56f76919f4578bfc9c182c0f8054ccf080ca8
version: c0c96298270c1763e819967ff1cad4ad876506b0
scm: git
- name: oauth-proxy
@ -41,22 +41,22 @@
- name: consul-service
src: git@github.com:status-im/infra-role-consul-service.git
version: 87f4498f90f0cbb66a1ddb425e8953b04ced1891
version: 241dffb0f865f8558b5e373d20fefed0a08a21ef
scm: git
- name: infra-role-beacon-node-linux
src: git@github.com:status-im/infra-role-beacon-node-linux.git
version: 3af4e926c1a017335747154a5e9a654ac04ecf0e
version: 1755d49c9b153e06995afdb3d0351bf39d838817
scm: git
- name: infra-role-beacon-node-windows
src: git@github.com:status-im/infra-role-beacon-node-windows.git
version: 2bbbc277dfb9b4c12d984acb5698ad76190bf1f1
version: 39a3f345dde9256c4aa20e47e91eabc33c2181dc
scm: git
- name: infra-role-beacon-node-macos
src: git@github.com:status-im/infra-role-beacon-node-macos.git
version: df3d2ceaf836376d21f910ca25c5978b5a3a80ee
version: 43e92ee7b5635a0fe0b6fe494a040faa423586b9
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: 1b633346c0b2c05095c29f1f0a4e4a76d60d1e99
version: 364cc4a46b233eb0905efdd71de14ad9de843f61
scm: git
- name: kibana

View File

@ -0,0 +1,11 @@
---
- 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

View File

@ -0,0 +1,15 @@
---
- name: Find available data centers
win_uri:
url: '{{ consul_catalog_url }}/datacenters'
content_type: 'application/json'
return_content: true
register: data_centers
- name: Find available geth websocket services
win_uri:
url: '{{ consul_catalog_url }}/service/{{ web3_geth_node_consul_name }}?dc={{ item }}'
content_type: 'application/json'
return_content: true
with_items: '{{ data_centers.json }}'
register: geth_ws_services

View File

@ -1,24 +1,21 @@
---
- name: Find available data centers
uri:
url: '{{ consul_catalog_url }}/datacenters'
register: data_centers
- include_tasks: consul/posix.yml
when: ansible_system in ['Linux', 'Darwin']
- 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
- include_tasks: consul/windows.yml
when: ansible_system == 'Win32NT'
# On Windows json attribute is missing when it's [].
- name: Extract Geth websocket IP and port
set_fact:
geth_ws_addresses: |
{{ geth_ws_services.results
| selectattr("json", "defined")
| 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

View File

@ -0,0 +1,25 @@
---
- 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

@ -0,0 +1,25 @@
---
- 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 ] }}"