Support for configuring testnet nodes across multiple cloud services
This commit is contained in:
parent
25a2f08f8d
commit
97bd7a00f1
|
@ -24,6 +24,7 @@ entrypointIp=
|
|||
publicNetwork=
|
||||
netBasename=
|
||||
sshPrivateKey=
|
||||
externalNodeSshKey=
|
||||
sshOptions=()
|
||||
fullnodeIpList=()
|
||||
fullnodeIpListPrivate=()
|
||||
|
@ -41,8 +42,9 @@ buildSshOptions() {
|
|||
-o "User=solana"
|
||||
-o "IdentityFile=$sshPrivateKey"
|
||||
-o "LogLevel=ERROR"
|
||||
-F /dev/null
|
||||
)
|
||||
|
||||
[[ -z $externalNodeSshKey ]] || sshOptions+=(-o "IdentityFile=$externalNodeSshKey")
|
||||
}
|
||||
|
||||
loadConfigFile() {
|
||||
|
|
31
net/gce.sh
31
net/gce.sh
|
@ -42,6 +42,7 @@ clientNodeCount=1
|
|||
blockstreamer=false
|
||||
fullNodeBootDiskSizeInGb=1000
|
||||
clientBootDiskSizeInGb=75
|
||||
externalNodes=false
|
||||
|
||||
publicNetwork=false
|
||||
enableGpu=false
|
||||
|
@ -114,7 +115,7 @@ shift
|
|||
[[ $command = create || $command = config || $command = info || $command = delete ]] ||
|
||||
usage "Invalid command: $command"
|
||||
|
||||
while getopts "h?p:Pn:c:z:gG:a:d:bu" opt; do
|
||||
while getopts "h?p:Pn:c:z:gG:a:d:bux" opt; do
|
||||
case $opt in
|
||||
h | \?)
|
||||
usage
|
||||
|
@ -157,6 +158,9 @@ while getopts "h?p:Pn:c:z:gG:a:d:bu" opt; do
|
|||
u)
|
||||
blockstreamer=true
|
||||
;;
|
||||
x)
|
||||
externalNodes=true
|
||||
;;
|
||||
*)
|
||||
usage "unhandled option: $opt"
|
||||
;;
|
||||
|
@ -219,6 +223,10 @@ cloud_ForEachInstance() {
|
|||
prepareInstancesAndWriteConfigFile() {
|
||||
$metricsWriteDatapoint "testnet-deploy net-config-begin=1"
|
||||
|
||||
if $externalNodes; then
|
||||
echo "Appending to existing config file"
|
||||
echo "externalNodeSshKey=$sshPrivateKey" >> "$configFile"
|
||||
else
|
||||
cat >> "$configFile" <<EOF
|
||||
# autogenerated at $(date)
|
||||
netBasename=$prefix
|
||||
|
@ -226,6 +234,7 @@ publicNetwork=$publicNetwork
|
|||
sshPrivateKey=$sshPrivateKey
|
||||
leaderRotation=$leaderRotation
|
||||
EOF
|
||||
fi
|
||||
|
||||
buildSshOptions
|
||||
|
||||
|
@ -262,6 +271,9 @@ EOF
|
|||
echo "$name has booted."
|
||||
}
|
||||
|
||||
if $externalNodes; then
|
||||
echo "Bootstrap leader is already configured"
|
||||
else
|
||||
echo "Looking for bootstrap leader instance..."
|
||||
cloud_FindInstance "$prefix-bootstrap-leader"
|
||||
[[ ${#instances[@]} -eq 1 ]] || {
|
||||
|
@ -302,6 +314,7 @@ EOF
|
|||
echo "fullnodeIpListPrivate=()" >> "$configFile"
|
||||
cloud_ForEachInstance recordInstanceIp fullnodeIpList
|
||||
cloud_ForEachInstance waitForStartupComplete
|
||||
fi
|
||||
|
||||
echo "Looking for additional fullnode instances..."
|
||||
for zone in "${zones[@]}"; do
|
||||
|
@ -314,8 +327,12 @@ EOF
|
|||
cloud_ForEachInstance waitForStartupComplete
|
||||
done
|
||||
|
||||
if $externalNodes; then
|
||||
echo "Let's not reset the current client configuration"
|
||||
else
|
||||
echo "clientIpList=()" >> "$configFile"
|
||||
echo "clientIpListPrivate=()" >> "$configFile"
|
||||
fi
|
||||
echo "Looking for client bencher instances..."
|
||||
cloud_FindInstances "$prefix-client"
|
||||
[[ ${#instances[@]} -eq 0 ]] || {
|
||||
|
@ -323,8 +340,12 @@ EOF
|
|||
cloud_ForEachInstance waitForStartupComplete
|
||||
}
|
||||
|
||||
if $externalNodes; then
|
||||
echo "Let's not reset the current blockstream configuration"
|
||||
else
|
||||
echo "blockstreamerIpList=()" >> "$configFile"
|
||||
echo "blockstreamerIpListPrivate=()" >> "$configFile"
|
||||
fi
|
||||
echo "Looking for blockstreamer instances..."
|
||||
cloud_FindInstances "$prefix-blockstreamer"
|
||||
[[ ${#instances[@]} -eq 0 ]] || {
|
||||
|
@ -360,7 +381,11 @@ delete() {
|
|||
cloud_DeleteInstances true
|
||||
fi
|
||||
done
|
||||
if $externalNodes; then
|
||||
echo "Let's not delete the current configuration file"
|
||||
else
|
||||
rm -f "$configFile"
|
||||
fi
|
||||
|
||||
$metricsWriteDatapoint "testnet-deploy net-delete-complete=1"
|
||||
|
||||
|
@ -474,9 +499,13 @@ EOF
|
|||
cloud_Initialize "$prefix" "$zone"
|
||||
done
|
||||
|
||||
if $externalNodes; then
|
||||
echo "Bootstrap leader is already configured"
|
||||
else
|
||||
cloud_CreateInstances "$prefix" "$prefix-bootstrap-leader" 1 \
|
||||
"$enableGpu" "$bootstrapLeaderMachineType" "${zones[0]}" "$fullNodeBootDiskSizeInGb" \
|
||||
"$startupScript" "$bootstrapLeaderAddress" "$bootDiskType"
|
||||
fi
|
||||
|
||||
num_zones=${#zones[@]}
|
||||
numNodesPerZone=$((additionalFullNodeCount / num_zones))
|
||||
|
|
|
@ -163,6 +163,7 @@ startCommon() {
|
|||
mkdir -p ~/.cargo/bin
|
||||
"
|
||||
fi
|
||||
ssh-copy-id -f -i "$externalNodeSshKey" "${sshOptions[@]}" "solana@$ipAddress"
|
||||
rsync -vPrc -e "ssh ${sshOptions[*]}" \
|
||||
"$SOLANA_ROOT"/{fetch-perf-libs.sh,scripts,net,multinode-demo} \
|
||||
"$ipAddress":~/solana/
|
||||
|
|
Loading…
Reference in New Issue