consul/gen_hosts: script for generating hosts entries
This is useful when DNS issues make the statusim.net domain unusable. You can connect to a Consul host using an IP and tunnel `8500` port: ``` ssh -L 8500:localhost:8500 admin@178.128.136.23 ``` Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
7a6960d559
commit
4e45ee72c6
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CONSUL_URL="${CONSUL_URL:-http://localhost:8500/v1/catalog}"
|
||||
|
||||
readarray -t DCS < <(curl -s "${CONSUL_URL}/datacenters" | jq -r '.[]')
|
||||
|
||||
for DC in "${DCS[@]}"; do
|
||||
echo "# DC: ${DC}"
|
||||
curl -s "${CONSUL_URL}/nodes?dc=${DC}" | jq -r '.[] | [.Address, .Node] | @tsv'
|
||||
done
|
Loading…
Reference in New Issue