consul: add ENR address to service metadata

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-03-16 00:57:42 +01:00
parent a97db210ce
commit e448cb369a
No known key found for this signature in database
GPG Key ID: 09AA5403E54D9931
2 changed files with 19 additions and 0 deletions

View File

@ -61,3 +61,4 @@ nimbus_fluffy_rpc_port: 9900
nimbus_fluffy_consul_service_name: 'nimbus-fluffy'
nimbus_fluffy_consul_service_file_name: '{{ nimbus_fluffy_service_name | replace("-", "_") }}'
nimbus_fluffy_consul_metrics_service_name: '{{ nimbus_fluffy_consul_service_name }}-metrics'
nimbus_fluffy_consul_url: 'http://localhost:8500/v1/catalog'

View File

@ -1,4 +1,20 @@
---
- name: Query node ENR address
uri:
url: 'http://localhost:{{ nimbus_fluffy_rpc_port }}/'
method: 'POST'
body_format: 'json'
body:
id: 1
jsonrpc: '2.0'
method: 'discv5_nodeInfo'
params: []
register: node_info_raw
- name: Extract node ENR address
set_fact:
nimbus_fluffy_node_enr: '{{ node_info_raw.json.result.nodeENR }}'
- name: 'Create Consul service definition'
include_role: name=consul-service
vars:
@ -9,6 +25,8 @@
port: '{{ nimbus_fluffy_listening_port }}'
address: '{{ nimbus_fluffy_public_address }}'
tags: ['{{ env }}.{{ stage }}', 'eth1', 'nimbus']
meta:
node_enr: '{{ nimbus_fluffy_node_enr }}'
checks:
- name: '{{ nimbus_fluffy_consul_service_name }}-health'
type: 'script'