status-go/_assets/scripts/update-fleet-config.sh
RichΛrd 40359f9c1b
go-waku integration (#2247)
* Adding wakunode module
* Adding wakuv2 fleet files
* Add waku fleets to update-fleet-config script
* Adding config items for waku v2
* Conditionally start waku v2 node depending on config
* Adapting common code to use go-waku
* Setting log level to info
* update dependencies
* update fleet config to use WakuNodes instead of BootNodes
* send and receive messages
* use hash returned when publishing a message
* add waku store protocol
* trigger signal after receiving store messages
* exclude linting rule SA1019 to check deprecated packages
2021-06-16 16:19:45 -04:00

54 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
DIR="$(cd $(dirname "$0")/../../config/cli; pwd)"
echo "Downloading https://fleets.status.im/"
json=$(curl --silent https://fleets.status.im/)
fleets=(
'eth.prod'
'eth.staging'
'eth.test'
)
wakufleets=(
'wakuv2.test'
'wakuv2.prod'
)
for fleet in ${fleets[@]}; do
echo "Processing $fleet fleet..."
fleetJSON=$(echo $json | jq ".fleets.\"$fleet\"")
boot=$(echo $fleetJSON | jq ".boot | map(.)" -r)
mail=$(echo $fleetJSON | jq ".mail | map(.)" -r)
rendezvous=$(echo $fleetJSON | jq ".rendezvous | map(.)" -r)
# Get random nodes from whisper node list
maxStaticNodeCount=2
staticNodeCount=$(echo $fleetJSON | jq ".whisper | length")
index=$(($RANDOM % ($staticNodeCount - ($maxStaticNodeCount - 1))))
whisper=$(echo $fleetJSON | jq ".whisper | map(.) | .[$index:($index + $maxStaticNodeCount)]" -r)
git checkout $DIR/fleet-$fleet.json \
&& jq \
".ClusterConfig.BootNodes = $boot \
| .ClusterConfig.TrustedMailServers = $mail \
| .ClusterConfig.StaticNodes = $whisper \
| .ClusterConfig.RendezvousNodes = $rendezvous" \
$DIR/fleet-$fleet.json \
| tee "$DIR/tmp.json" >/dev/null \
&& mv $DIR/tmp.json $DIR/fleet-$fleet.json
done
for fleet in ${wakufleets[@]}; do
echo "Processing $fleet fleet..."
fleetJSON=$(echo $json | jq ".fleets.\"$fleet\"")
waku=$(echo $fleetJSON | jq ".waku | map(.)" -r)
git checkout $DIR/fleet-$fleet.json \
&& jq \
".ClusterConfig.WakuNodes = $waku" \
$DIR/fleet-$fleet.json \
| tee "$DIR/tmp.json" >/dev/null \
&& mv $DIR/tmp.json $DIR/fleet-$fleet.json
done