Skip to content

Commit

Permalink
addnode: use backend service
Browse files Browse the repository at this point in the history
  • Loading branch information
DeviaVir committed Feb 20, 2023
1 parent 90fae9c commit 91785e1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions terraform/modules/daemon/cloud-config/daemon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,16 @@ write_files:
sleep 5
done
# List all guri's of the non-preemptible instances in the instance group.
INSTANCES=$(docker run --rm --name instance-group-list --tmpfs /tmp ${docker_tag_gcloud} gcloud compute instance-groups list-instances ${name}-explorer-ig-${region} --region ${region} --uri)
HEALTHY_INSTANCES=$(docker run --rm --name backend-service-list --tmpfs /tmp ${docker_tag_gcloud} gcloud compute backend-services get-health --global ${name}-explorer-backend-service --filter="backend~.*\/${name}-explorer-ig-.* AND status.healthStatus[].healthState=HEALTHY" --format="value(status.healthStatus[].ipAddress)" | tr ';' "\n")
# Addnode each instance's internal IP.
for instance in $INSTANCES
for ip in $HEALTHY_INSTANCES
do
IFS='/' read -r -a parts <<< $instance
# ZONE=$${parts[8]}
ID=$${parts[10]}
INTERNAL_IP=$(docker run --rm --name instance-group-list --tmpfs /tmp ${docker_tag_gcloud} gcloud compute instances list --filter="name=( 'NAME' '$ID')" --format=json | jq -r '.[0].networkInterfaces[0].networkIP')
docker exec ${container_name} cli addnode $INTERNAL_IP:8333 add
echo "[insert-instance-list] added $INTERNAL_IP:8333 to ${container_name}"
docker exec ${container_name} cli addnode $ip:8333 add
echo "[insert-instance-list] added $ip:8333 to ${container_name}"
done
- path: /etc/systemd/system/explorer.service
Expand Down

0 comments on commit 91785e1

Please sign in to comment.