Clean up bootstrap leader terminology in comments and variable names

This commit is contained in:
Michael Vines 2018-12-09 09:42:09 -08:00
parent 7ae9d9690b
commit f5794de636
4 changed files with 87 additions and 74 deletions

View File

@ -22,12 +22,13 @@ configFile="$netConfigDir/config"
entrypointIp= entrypointIp=
publicNetwork= publicNetwork=
bootstrapFullNodeIp=
netBasename= netBasename=
sshPrivateKey= sshPrivateKey=
clientIpList=()
sshOptions=() sshOptions=()
additionalFullNodeIps=() fullnodeIpList=()
fullnodeIpListPrivate=()
clientIpList=()
clientIpListPrivate=()
buildSshOptions() { buildSshOptions() {
sshOptions=( sshOptions=(
@ -46,12 +47,17 @@ loadConfigFile() {
# shellcheck source=/dev/null # shellcheck source=/dev/null
source "$configFile" source "$configFile"
[[ -n "$entrypointIp" ]] || usage "Config file invalid, entrypointIp unspecified: $configFile"
[[ -n "$publicNetwork" ]] || usage "Config file invalid, publicNetwork unspecified: $configFile" [[ -n "$publicNetwork" ]] || usage "Config file invalid, publicNetwork unspecified: $configFile"
[[ -n "$bootstrapFullNodeIp" ]] || usage "Config file invalid, bootstrapFullNodeIp unspecified: $configFile"
[[ -n "$netBasename" ]] || usage "Config file invalid, netBasename unspecified: $configFile" [[ -n "$netBasename" ]] || usage "Config file invalid, netBasename unspecified: $configFile"
[[ -n $sshPrivateKey ]] || usage "Config file invalid, sshPrivateKey unspecified: $configFile" [[ -n $sshPrivateKey ]] || usage "Config file invalid, sshPrivateKey unspecified: $configFile"
[[ ${#additionalFullNodeIps[@]} -gt 0 ]] || usage "Config file invalid, additionalFullNodeIps unspecified: $configFile" [[ ${#fullnodeIpList[@]} -gt 0 ]] || usage "Config file invalid, fullnodeIpList unspecified: $configFile"
[[ ${#fullnodeIpListPrivate[@]} -gt 0 ]] || usage "Config file invalid, fullnodeIpListPrivate unspecified: $configFile"
if $publicNetwork; then
entrypointIp=${fullnodeIpList[0]}
else
entrypointIp=${fullnodeIpListPrivate[0]}
fi
buildSshOptions buildSshOptions
configureMetrics configureMetrics

View File

@ -12,9 +12,9 @@ gce)
# shellcheck source=net/scripts/gce-provider.sh # shellcheck source=net/scripts/gce-provider.sh
source "$here"/scripts/gce-provider.sh source "$here"/scripts/gce-provider.sh
cpuBootstrapFullNodeMachineType=n1-standard-16 cpuBootstrapLeaderMachineType=n1-standard-16
gpuBootstrapFullNodeMachineType="$cpuBootstrapFullNodeMachineType --accelerator count=4,type=nvidia-tesla-k80" gpuBootstrapLeaderMachineType="$cpuBootstrapLeaderMachineType --accelerator count=4,type=nvidia-tesla-k80"
bootstrapFullNodeMachineType=$cpuBootstrapFullNodeMachineType bootstrapLeaderMachineType=$cpuBootstrapLeaderMachineType
fullNodeMachineType=n1-standard-16 fullNodeMachineType=n1-standard-16
clientMachineType=n1-standard-16 clientMachineType=n1-standard-16
;; ;;
@ -22,9 +22,9 @@ ec2)
# shellcheck source=net/scripts/ec2-provider.sh # shellcheck source=net/scripts/ec2-provider.sh
source "$here"/scripts/ec2-provider.sh source "$here"/scripts/ec2-provider.sh
cpuBootstrapFullNodeMachineType=m4.4xlarge cpuBootstrapLeaderMachineType=m4.4xlarge
gpuBootstrapFullNodeMachineType=p2.xlarge gpuBootstrapLeaderMachineType=p2.xlarge
bootstrapFullNodeMachineType=$cpuBootstrapFullNodeMachineType bootstrapLeaderMachineType=$cpuBootstrapLeaderMachineType
fullNodeMachineType=m4.2xlarge fullNodeMachineType=m4.2xlarge
clientMachineType=m4.2xlarge clientMachineType=m4.2xlarge
;; ;;
@ -42,7 +42,7 @@ clientBootDiskSizeInGb=75
publicNetwork=false publicNetwork=false
enableGpu=false enableGpu=false
bootstrapFullNodeAddress= bootstrapLeaderAddress=
usage() { usage() {
exitcode=0 exitcode=0
@ -64,13 +64,13 @@ Manage testnet instances
collisions (default: $prefix) collisions (default: $prefix)
create-specific options: create-specific options:
-n [number] - Number of additional full nodes (default: $additionalFullNodeCount) -n [number] - Number of additional fullnodes (default: $additionalFullNodeCount)
-c [number] - Number of client nodes (default: $clientNodeCount) -c [number] - Number of client nodes (default: $clientNodeCount)
-P - Use public network IP addresses (default: $publicNetwork) -P - Use public network IP addresses (default: $publicNetwork)
-z [zone] - Zone for the nodes (default: $zone) -z [zone] - Zone for the nodes (default: $zone)
-g - Enable GPU (default: $enableGpu) -g - Enable GPU (default: $enableGpu)
-G - Enable GPU, and set count/type of GPUs to use (e.g $cpuBootstrapFullNodeMachineType --accelerator count=4,type=nvidia-tesla-k80) -G - Enable GPU, and set count/type of GPUs to use (e.g $cpuBootstrapLeaderMachineType --accelerator count=4,type=nvidia-tesla-k80)
-a [address] - Set the bootstreap full node's external IP address to this value. -a [address] - Set the bootstreap fullnode's external IP address to this value.
For GCE, [address] is the "name" of the desired External For GCE, [address] is the "name" of the desired External
IP Address. IP Address.
For EC2, [address] is the "allocation ID" of the desired For EC2, [address] is the "allocation ID" of the desired
@ -116,14 +116,14 @@ while getopts "h?p:Pn:c:z:gG:a:d:" opt; do
;; ;;
g) g)
enableGpu=true enableGpu=true
bootstrapFullNodeMachineType=$gpuBootstrapFullNodeMachineType bootstrapLeaderMachineType=$gpuBootstrapLeaderMachineType
;; ;;
G) G)
enableGpu=true enableGpu=true
bootstrapFullNodeMachineType="$OPTARG" bootstrapLeaderMachineType="$OPTARG"
;; ;;
a) a)
bootstrapFullNodeAddress=$OPTARG bootstrapLeaderAddress=$OPTARG
;; ;;
d) d)
bootDiskType=$OPTARG bootDiskType=$OPTARG
@ -230,13 +230,7 @@ EOF
declare arrayName="$5" declare arrayName="$5"
echo "$arrayName+=($publicIp) # $name" >> "$configFile" echo "$arrayName+=($publicIp) # $name" >> "$configFile"
if [[ $arrayName = "bootstrapFullNodeIp" ]]; then echo "${arrayName}Private+=($privateIp) # $name" >> "$configFile"
if $publicNetwork; then
echo "entrypointIp=$publicIp" >> "$configFile"
else
echo "entrypointIp=$privateIp" >> "$configFile"
fi
fi
} }
waitForStartupComplete() { waitForStartupComplete() {
@ -261,10 +255,10 @@ EOF
echo "$name has booted." echo "$name has booted."
} }
echo "Looking for bootstrap fullnode instance..." echo "Looking for bootstrap leader instance..."
cloud_FindInstance "$prefix-bootstrap-fullnode" cloud_FindInstance "$prefix-bootstrap-leader"
[[ ${#instances[@]} -eq 1 ]] || { [[ ${#instances[@]} -eq 1 ]] || {
echo "Unable to find bootstrap fullnode" echo "Unable to find bootstrap leader"
exit 1 exit 1
} }
@ -296,8 +290,9 @@ EOF
fi fi
) )
echo "bootstrapFullNodeIp=()" >> "$configFile" echo "fullnodeIpList=()" >> "$configFile"
cloud_ForEachInstance recordInstanceIp bootstrapFullNodeIp echo "fullnodeIpListPrivate=()" >> "$configFile"
cloud_ForEachInstance recordInstanceIp fullnodeIpList
cloud_ForEachInstance waitForStartupComplete cloud_ForEachInstance waitForStartupComplete
echo "Looking for additional fullnode instances..." echo "Looking for additional fullnode instances..."
@ -306,11 +301,11 @@ EOF
echo "Unable to find additional fullnodes" echo "Unable to find additional fullnodes"
exit 1 exit 1
} }
echo "additionalFullNodeIps=()" >> "$configFile" cloud_ForEachInstance recordInstanceIp fullnodeIpList
cloud_ForEachInstance recordInstanceIp additionalFullNodeIps
cloud_ForEachInstance waitForStartupComplete cloud_ForEachInstance waitForStartupComplete
echo "clientIpList=()" >> "$configFile" echo "clientIpList=()" >> "$configFile"
echo "clientIpListPrivate=()" >> "$configFile"
echo "Looking for client bencher instances..." echo "Looking for client bencher instances..."
cloud_FindInstances "$prefix-client" cloud_FindInstances "$prefix-client"
[[ ${#instances[@]} -eq 0 ]] || { [[ ${#instances[@]} -eq 0 ]] || {
@ -325,11 +320,11 @@ EOF
delete() { delete() {
$metricsWriteDatapoint "testnet-deploy net-delete-begin=1" $metricsWriteDatapoint "testnet-deploy net-delete-begin=1"
# Delete the bootstrap fullnode first to prevent unusual metrics on the dashboard # Delete the bootstrap leader first to prevent unusual metrics on the dashboard
# during shutdown (only applicable when leader rotation is disabled). # during shutdown (only applicable when leader rotation is disabled).
# TODO: It would be better to fully cut-off metrics reporting before any # TODO: It would be better to fully cut-off metrics reporting before any
# instances are deleted. # instances are deleted.
for filter in "$prefix-bootstrap-fullnode" "$prefix-"; do for filter in "$prefix-bootstrap-leader" "$prefix-"; do
echo "Searching for instances: $filter" echo "Searching for instances: $filter"
cloud_FindInstances "$filter" cloud_FindInstances "$filter"
@ -370,8 +365,8 @@ create)
======================================================================================== ========================================================================================
Network composition: Network composition:
Bootstrap full node = $bootstrapFullNodeMachineType (GPU=$enableGpu) Bootstrap leader = $bootstrapLeaderMachineType (GPU=$enableGpu)
Additional full nodes = $additionalFullNodeCount x $fullNodeMachineType Additional fullnodes = $additionalFullNodeCount x $fullNodeMachineType
Client(s) = $clientNodeCount x $clientMachineType Client(s) = $clientNodeCount x $clientMachineType
======================================================================================== ========================================================================================
@ -434,9 +429,9 @@ touch /.instance-startup-complete
EOF EOF
cloud_CreateInstances "$prefix" "$prefix-bootstrap-fullnode" 1 \ cloud_CreateInstances "$prefix" "$prefix-bootstrap-leader" 1 \
"$imageName" "$bootstrapFullNodeMachineType" "$fullNodeBootDiskSizeInGb" \ "$imageName" "$bootstrapLeaderMachineType" "$fullNodeBootDiskSizeInGb" \
"$startupScript" "$bootstrapFullNodeAddress" "$bootDiskType" "$startupScript" "$bootstrapLeaderAddress" "$bootDiskType"
cloud_CreateInstances "$prefix" "$prefix-fullnode" "$additionalFullNodeCount" \ cloud_CreateInstances "$prefix" "$prefix-fullnode" "$additionalFullNodeCount" \
"$imageName" "$fullNodeMachineType" "$fullNodeBootDiskSizeInGb" \ "$imageName" "$fullNodeMachineType" "$fullNodeBootDiskSizeInGb" \

View File

@ -117,7 +117,6 @@ while getopts "h?S:s:T:t:o:f:" opt; do
done done
loadConfigFile loadConfigFile
expectedNodeCount=$((${#additionalFullNodeIps[@]} + 1))
build() { build() {
declare MAYBE_DOCKER= declare MAYBE_DOCKER=
@ -157,13 +156,13 @@ startCommon() {
"$ipAddress":~/solana/ "$ipAddress":~/solana/
} }
startBootstrapNode() { startBootstrapLeader() {
declare ipAddress=$1 declare ipAddress=$1
declare logFile="$2" declare logFile="$2"
echo "--- Starting bootstrap full node: $bootstrapFullNodeIp" echo "--- Starting bootstrap leader: $ipAddress"
echo "start log: $logFile" echo "start log: $logFile"
# Deploy local binaries to bootstrap full node. Other full nodes and clients later fetch the # Deploy local binaries to bootstrap fullnode. Other fullnodes and clients later fetch the
# binaries from it # binaries from it
( (
set -x set -x
@ -184,7 +183,14 @@ startBootstrapNode() {
esac esac
ssh "${sshOptions[@]}" -n "$ipAddress" \ ssh "${sshOptions[@]}" -n "$ipAddress" \
"./solana/net/remote/remote-node.sh $deployMethod bootstrap-leader $publicNetwork $entrypointIp $expectedNodeCount \"$RUST_LOG\"" "./solana/net/remote/remote-node.sh \
$deployMethod \
bootstrap-leader \
$publicNetwork \
$entrypointIp \
${#fullnodeIpList[@]} \
\"$RUST_LOG\" \
"
) >> "$logFile" 2>&1 || { ) >> "$logFile" 2>&1 || {
cat "$logFile" cat "$logFile"
echo "^^^ +++" echo "^^^ +++"
@ -196,13 +202,20 @@ startNode() {
declare ipAddress=$1 declare ipAddress=$1
declare logFile="$netLogDir/fullnode-$ipAddress.log" declare logFile="$netLogDir/fullnode-$ipAddress.log"
echo "--- Starting full node: $ipAddress" echo "--- Starting fullnode: $ipAddress"
echo "start log: $logFile" echo "start log: $logFile"
( (
set -x set -x
startCommon "$ipAddress" startCommon "$ipAddress"
ssh "${sshOptions[@]}" -n "$ipAddress" \ ssh "${sshOptions[@]}" -n "$ipAddress" \
"./solana/net/remote/remote-node.sh $deployMethod fullnode $publicNetwork $entrypointIp $expectedNodeCount \"$RUST_LOG\"" "./solana/net/remote/remote-node.sh \
$deployMethod \
fullnode \
$publicNetwork \
$entrypointIp \
${#fullnodeIpList[@]} \
\"$RUST_LOG\" \
"
) >> "$logFile" 2>&1 & ) >> "$logFile" 2>&1 &
declare pid=$! declare pid=$!
ln -sfT "fullnode-$ipAddress.log" "$netLogDir/fullnode-$pid.log" ln -sfT "fullnode-$ipAddress.log" "$netLogDir/fullnode-$pid.log"
@ -227,13 +240,12 @@ startClient() {
} }
sanity() { sanity() {
declare expectedNodeCount=$((${#additionalFullNodeIps[@]} + 1))
declare ok=true declare ok=true
echo "--- Sanity" echo "--- Sanity"
$metricsWriteDatapoint "testnet-deploy net-sanity-begin=1" $metricsWriteDatapoint "testnet-deploy net-sanity-begin=1"
declare host=$bootstrapFullNodeIp # TODO: maybe use ${additionalFullNodeIps[0]} ? declare host=${fullnodeIpList[0]}
( (
set -x set -x
# shellcheck disable=SC2029 # remote-client.sh args are expanded on client side intentionally # shellcheck disable=SC2029 # remote-client.sh args are expanded on client side intentionally
@ -304,22 +316,27 @@ start() {
echo "Deployment started at $(date)" echo "Deployment started at $(date)"
$metricsWriteDatapoint "testnet-deploy net-start-begin=1" $metricsWriteDatapoint "testnet-deploy net-start-begin=1"
SECONDS=0 bootstrapLeader=true
declare bootstrapNodeDeployTime= for ipAddress in "${fullnodeIpList[@]}"; do
startBootstrapNode "$bootstrapFullNodeIp" "$netLogDir/bootstrap-fullnode-$bootstrapFullNodeIp.log" if $bootstrapLeader; then
bootstrapNodeDeployTime=$SECONDS SECONDS=0
$metricsWriteDatapoint "testnet-deploy net-bootnode-fullnode-started=1" declare bootstrapNodeDeployTime=
startBootstrapLeader "$ipAddress" "$netLogDir/bootstrap-leader-$ipAddress.log"
bootstrapNodeDeployTime=$SECONDS
$metricsWriteDatapoint "testnet-deploy net-bootnode-leader-started=1"
SECONDS=0 bootstrapLeader=false
pids=() SECONDS=0
loopCount=0 pids=()
for ipAddress in "${additionalFullNodeIps[@]}"; do loopCount=0
startNode "$ipAddress" else
startNode "$ipAddress"
# Stagger additional node start time. If too many nodes start simultaneously # Stagger additional node start time. If too many nodes start simultaneously
# the bootstrap node gets more rsync requests from the additional nodes than # the bootstrap node gets more rsync requests from the additional nodes than
# it can handle. # it can handle.
((loopCount++ % 2 == 0)) && sleep 2 ((loopCount++ % 2 == 0)) && sleep 2
fi
done done
for pid in "${pids[@]}"; do for pid in "${pids[@]}"; do
@ -348,7 +365,7 @@ start() {
case $deployMethod in case $deployMethod in
snap) snap)
IFS=\ read -r _ networkVersion _ < <( IFS=\ read -r _ networkVersion _ < <(
ssh "${sshOptions[@]}" "$bootstrapFullNodeIp" \ ssh "${sshOptions[@]}" "${fullnodeIpList[0]}" \
"snap info solana | grep \"^installed:\"" "snap info solana | grep \"^installed:\""
) )
networkVersion=${networkVersion/0+git./} networkVersion=${networkVersion/0+git./}
@ -369,8 +386,8 @@ start() {
echo echo
echo "+++ Deployment Successful" echo "+++ Deployment Successful"
echo "Bootstrap full node deployment took $bootstrapNodeDeployTime seconds" echo "Bootstrap leader deployment took $bootstrapNodeDeployTime seconds"
echo "Additional full node deployment (${#additionalFullNodeIps[@]} instances) took $additionalNodeDeployTime seconds" echo "Additional fullnode deployment (${#fullnodeIpList[@]} instances) took $additionalNodeDeployTime seconds"
echo "Client deployment (${#clientIpList[@]} instances) took $clientDeployTime seconds" echo "Client deployment (${#clientIpList[@]} instances) took $clientDeployTime seconds"
echo "Network start logs in $netLogDir:" echo "Network start logs in $netLogDir:"
ls -l "$netLogDir" ls -l "$netLogDir"
@ -400,9 +417,7 @@ stop() {
SECONDS=0 SECONDS=0
$metricsWriteDatapoint "testnet-deploy net-stop-begin=1" $metricsWriteDatapoint "testnet-deploy net-stop-begin=1"
stopNode "$bootstrapFullNodeIp" for ipAddress in "${fullnodeIpList[@]}" "${clientIpList[@]}"; do
for ipAddress in "${additionalFullNodeIps[@]}" "${clientIpList[@]}"; do
stopNode "$ipAddress" stopNode "$ipAddress"
done done

View File

@ -49,11 +49,8 @@ printNode() {
printf " %-25s | For logs run: $0 $ip tail -f solana/$nodeType.log\n" "$0 $ip" printf " %-25s | For logs run: $0 $ip tail -f solana/$nodeType.log\n" "$0 $ip"
} }
echo Bootstrap full node: echo Full nodes:
printNode fullnode "$bootstrapFullNodeIp" for ipAddress in "${fullnodeIpList[@]}"; do
echo
echo Additional full nodes:
for ipAddress in "${additionalFullNodeIps[@]}"; do
printNode fullnode "$ipAddress" printNode fullnode "$ipAddress"
done done
echo echo