2018-09-14 08:46:34 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
DIR="$(cd $(dirname "$0")/../../config/cli; pwd)"
|
|
|
|
|
|
|
|
echo "Downloading https://fleets.status.im/"
|
|
|
|
json=$(curl --silent https://fleets.status.im/)
|
2020-01-08 12:19:09 +00:00
|
|
|
fleets=(
|
|
|
|
'eth.prod'
|
|
|
|
'eth.staging'
|
|
|
|
)
|
|
|
|
|
2021-06-16 20:19:45 +00:00
|
|
|
wakufleets=(
|
2023-05-15 10:09:14 +00:00
|
|
|
'status.prod'
|
|
|
|
'status.test'
|
2021-06-16 20:19:45 +00:00
|
|
|
'wakuv2.prod'
|
2023-05-15 10:09:14 +00:00
|
|
|
'wakuv2.test'
|
|
|
|
)
|
|
|
|
|
|
|
|
# Notify fleet is configured for all fleets.
|
|
|
|
push=$(echo $json | jq '
|
|
|
|
.fleets."notify.prod"."tcp/p2p/waku"
|
|
|
|
| to_entries
|
|
|
|
| map(.value
|
|
|
|
| match("enode://([a-z0-9]+)@.*$")
|
|
|
|
| .captures[0].string
|
|
|
|
)'
|
2021-06-16 20:19:45 +00:00
|
|
|
)
|
|
|
|
|
2023-05-15 10:09:14 +00:00
|
|
|
for fleet in "${fleets[@]}"; do
|
2018-09-14 08:46:34 +00:00
|
|
|
echo "Processing $fleet fleet..."
|
|
|
|
fleetJSON=$(echo $json | jq ".fleets.\"$fleet\"")
|
|
|
|
boot=$(echo $fleetJSON | jq ".boot | map(.)" -r)
|
|
|
|
mail=$(echo $fleetJSON | jq ".mail | map(.)" -r)
|
2018-09-19 15:08:54 +00:00
|
|
|
|
2021-06-16 20:19:45 +00:00
|
|
|
|
2018-09-19 15:08:54 +00:00
|
|
|
# Get random nodes from whisper node list
|
2021-08-24 07:48:31 +00:00
|
|
|
maxStaticNodeCount=3
|
2018-09-19 15:08:54 +00:00
|
|
|
staticNodeCount=$(echo $fleetJSON | jq ".whisper | length")
|
|
|
|
index=$(($RANDOM % ($staticNodeCount - ($maxStaticNodeCount - 1))))
|
|
|
|
whisper=$(echo $fleetJSON | jq ".whisper | map(.) | .[$index:($index + $maxStaticNodeCount)]" -r)
|
|
|
|
|
2018-09-14 08:46:34 +00:00
|
|
|
git checkout $DIR/fleet-$fleet.json \
|
2020-03-16 21:38:42 +00:00
|
|
|
&& jq \
|
|
|
|
".ClusterConfig.BootNodes = $boot \
|
|
|
|
| .ClusterConfig.TrustedMailServers = $mail \
|
2023-05-15 10:09:14 +00:00
|
|
|
| .ClusterConfig.PushNotificationsServers = $push \
|
2021-08-13 13:58:50 +00:00
|
|
|
| .ClusterConfig.StaticNodes = $whisper" \
|
2020-03-16 21:38:42 +00:00
|
|
|
$DIR/fleet-$fleet.json \
|
2018-09-14 08:46:34 +00:00
|
|
|
| tee "$DIR/tmp.json" >/dev/null \
|
|
|
|
&& mv $DIR/tmp.json $DIR/fleet-$fleet.json
|
|
|
|
done
|
2021-06-16 20:19:45 +00:00
|
|
|
|
2023-05-15 10:09:14 +00:00
|
|
|
for fleet in "${wakufleets[@]}"; do
|
2021-06-16 20:19:45 +00:00
|
|
|
echo "Processing $fleet fleet..."
|
|
|
|
fleetJSON=$(echo $json | jq ".fleets.\"$fleet\"")
|
2023-05-15 10:09:14 +00:00
|
|
|
waku=$(echo $fleetJSON | jq '."tcp/p2p/waku" | map(.)' -r)
|
2021-06-16 20:19:45 +00:00
|
|
|
|
|
|
|
git checkout $DIR/fleet-$fleet.json \
|
|
|
|
&& jq \
|
2023-05-15 10:09:14 +00:00
|
|
|
".ClusterConfig.WakuNodes = $waku \
|
|
|
|
| .ClusterConfig.PushNotificationsServers = $push" \
|
2021-06-16 20:19:45 +00:00
|
|
|
$DIR/fleet-$fleet.json \
|
|
|
|
| tee "$DIR/tmp.json" >/dev/null \
|
|
|
|
&& mv $DIR/tmp.json $DIR/fleet-$fleet.json
|
2021-08-13 13:58:50 +00:00
|
|
|
done
|