* multinode-demo: Pass --accounts through bootstrap leader wrapper (cherry picked from commit327be55acc
) * gce.sh: Factor out default custom memory (cherry picked from commitddf1d2dbf5
) * net/: Support accounts on swap-backed tmpfs (cherry picked from commitff599ace4d
) * net/gce.sh: Add cusom RAM arg instead of doubling default with tmpfs (cherry picked from commit3175cf1deb
) Co-authored-by: Trent Nelson <trent@solana.com>
This commit is contained in:
@ -66,6 +66,9 @@ while [[ -n $1 ]]; do
|
|||||||
elif [[ $1 == --expected-bank-hash ]]; then
|
elif [[ $1 == --expected-bank-hash ]]; then
|
||||||
args+=("$1" "$2")
|
args+=("$1" "$2")
|
||||||
shift 2
|
shift 2
|
||||||
|
elif [[ $1 == --accounts ]]; then
|
||||||
|
args+=("$1" "$2")
|
||||||
|
shift 2
|
||||||
else
|
else
|
||||||
echo "Unknown argument: $1"
|
echo "Unknown argument: $1"
|
||||||
$program --help
|
$program --help
|
||||||
|
75
net/gce.sh
75
net/gce.sh
@ -12,7 +12,7 @@ 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
|
||||||
|
|
||||||
cpuBootstrapLeaderMachineType="--custom-cpu 24 --custom-memory 64GB --min-cpu-platform Intel%20Skylake"
|
cpuBootstrapLeaderMachineType="--custom-cpu 24 --min-cpu-platform Intel%20Skylake"
|
||||||
gpuBootstrapLeaderMachineType="$cpuBootstrapLeaderMachineType --accelerator count=1,type=nvidia-tesla-p100"
|
gpuBootstrapLeaderMachineType="$cpuBootstrapLeaderMachineType --accelerator count=1,type=nvidia-tesla-p100"
|
||||||
clientMachineType="--custom-cpu 16 --custom-memory 20GB"
|
clientMachineType="--custom-cpu 16 --custom-memory 20GB"
|
||||||
blockstreamerMachineType="--machine-type n1-standard-8"
|
blockstreamerMachineType="--machine-type n1-standard-8"
|
||||||
@ -68,6 +68,9 @@ externalNodes=false
|
|||||||
failOnValidatorBootupFailure=true
|
failOnValidatorBootupFailure=true
|
||||||
preemptible=true
|
preemptible=true
|
||||||
evalInfo=false
|
evalInfo=false
|
||||||
|
tmpfsAccounts=false
|
||||||
|
defaultCustomMemoryGB="$(cloud_DefaultCustomMemoryGB)"
|
||||||
|
customMemoryGB="$defaultCustomMemoryGB"
|
||||||
|
|
||||||
publicNetwork=false
|
publicNetwork=false
|
||||||
letsEncryptDomainName=
|
letsEncryptDomainName=
|
||||||
@ -137,6 +140,12 @@ Manage testnet instances
|
|||||||
--custom-machine-type
|
--custom-machine-type
|
||||||
- Set a custom machine type without assuming whether or not
|
- Set a custom machine type without assuming whether or not
|
||||||
GPU is enabled. Set this explicitly with --enable-gpu/-g to call out the presence of GPUs.
|
GPU is enabled. Set this explicitly with --enable-gpu/-g to call out the presence of GPUs.
|
||||||
|
$(
|
||||||
|
if [[ -n "$defaultCustomMemoryGB" ]]; then
|
||||||
|
echo " --custom-memory-gb"
|
||||||
|
echo " - Set memory size for custom machine type in GB (default: $defaultCustomMemoryGB)"
|
||||||
|
fi
|
||||||
|
)
|
||||||
--enable-gpu - Use with --custom-machine-type to specify whether or not GPUs should be used/enabled
|
--enable-gpu - Use with --custom-machine-type to specify whether or not GPUs should be used/enabled
|
||||||
--validator-additional-disk-size-gb [number]
|
--validator-additional-disk-size-gb [number]
|
||||||
- Add an additional [number] GB SSD to all validators to store the config directory.
|
- Add an additional [number] GB SSD to all validators to store the config directory.
|
||||||
@ -150,6 +159,7 @@ Manage testnet instances
|
|||||||
--self-destruct-hours [number]
|
--self-destruct-hours [number]
|
||||||
- Specify lifetime of the allocated instances in hours. 0 to
|
- Specify lifetime of the allocated instances in hours. 0 to
|
||||||
disable. Only supported on GCE. (default: $selfDestructHours)
|
disable. Only supported on GCE. (default: $selfDestructHours)
|
||||||
|
--tmpfs-accounts - Put accounts directory on a swap-backed tmpfs volume
|
||||||
|
|
||||||
config-specific options:
|
config-specific options:
|
||||||
-P - Use public network IP addresses (default: $publicNetwork)
|
-P - Use public network IP addresses (default: $publicNetwork)
|
||||||
@ -218,6 +228,12 @@ while [[ -n $1 ]]; do
|
|||||||
elif [[ $1 == --reclaim-all-reservations ]]; then
|
elif [[ $1 == --reclaim-all-reservations ]]; then
|
||||||
reclaimAllReservations=true
|
reclaimAllReservations=true
|
||||||
shift
|
shift
|
||||||
|
elif [[ $1 == --tmpfs-accounts ]]; then
|
||||||
|
tmpfsAccounts=true
|
||||||
|
shift
|
||||||
|
elif [[ $1 == --custom-memory-gb ]]; then
|
||||||
|
customMemoryGB=$2
|
||||||
|
shift 2
|
||||||
else
|
else
|
||||||
usage "Unknown long option: $1"
|
usage "Unknown long option: $1"
|
||||||
fi
|
fi
|
||||||
@ -273,16 +289,6 @@ while getopts "h?p:Pn:c:r:z:gG:a:d:uxf" opt "${shortArgs[@]}"; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -n "$customMachineType" ]] ; then
|
|
||||||
bootstrapLeaderMachineType="$customMachineType"
|
|
||||||
elif [[ "$enableGpu" = "true" ]] ; then
|
|
||||||
bootstrapLeaderMachineType="$gpuBootstrapLeaderMachineType"
|
|
||||||
else
|
|
||||||
bootstrapLeaderMachineType="$cpuBootstrapLeaderMachineType"
|
|
||||||
fi
|
|
||||||
validatorMachineType=$bootstrapLeaderMachineType
|
|
||||||
blockstreamerMachineType=$bootstrapLeaderMachineType
|
|
||||||
|
|
||||||
[[ ${#zones[@]} -gt 0 ]] || zones+=("$(cloud_DefaultZone)")
|
[[ ${#zones[@]} -gt 0 ]] || zones+=("$(cloud_DefaultZone)")
|
||||||
|
|
||||||
[[ -z $1 ]] || usage "Unexpected argument: $1"
|
[[ -z $1 ]] || usage "Unexpected argument: $1"
|
||||||
@ -297,10 +303,26 @@ fi
|
|||||||
|
|
||||||
case $cloudProvider in
|
case $cloudProvider in
|
||||||
gce)
|
gce)
|
||||||
|
if [[ "$tmpfsAccounts" = "true" ]]; then
|
||||||
|
cpuBootstrapLeaderMachineType+=" --local-ssd interface=nvme"
|
||||||
|
gpuBootstrapLeaderMachineType+=" --local-ssd interface=nvme"
|
||||||
|
if [[ $customMemoryGB -lt 100 ]]; then
|
||||||
|
# shellcheck disable=SC2016 # We don't want expression expansion on these backticks
|
||||||
|
echo -e '\nWarning: At least 100GB of system RAM is recommending with `--tmpfs-accounts` (see `--custom-memory-gb`)\n'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
cpuBootstrapLeaderMachineType+=" --custom-memory ${customMemoryGB}GB"
|
||||||
|
gpuBootstrapLeaderMachineType+=" --custom-memory ${customMemoryGB}GB"
|
||||||
;;
|
;;
|
||||||
ec2|azure|colo)
|
ec2|azure|colo)
|
||||||
if [[ -n $validatorAdditionalDiskSizeInGb ]] ; then
|
if [[ -n $validatorAdditionalDiskSizeInGb ]] ; then
|
||||||
usage "Error: --validator-additional-disk-size-gb currently only supported with cloud provider: gce"
|
usage "--validator-additional-disk-size-gb currently only supported with cloud provider: gce"
|
||||||
|
fi
|
||||||
|
if [[ "$tmpfsAccounts" = "true" ]]; then
|
||||||
|
usage "--tmpfs-accounts only supported on cloud provider: gce"
|
||||||
|
fi
|
||||||
|
if [[ "$customMemoryGB" != "$defaultCustomMemoryGB" ]]; then
|
||||||
|
usage "--custom-memory-gb only supported on cloud provider: gce"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@ -328,6 +350,16 @@ if [[ -n $reclaimAllReservations || -n $reclaimOnlyPreemptibleReservations ]]; t
|
|||||||
forceDelete="true"
|
forceDelete="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$customMachineType" ]] ; then
|
||||||
|
bootstrapLeaderMachineType="$customMachineType"
|
||||||
|
elif [[ "$enableGpu" = "true" ]] ; then
|
||||||
|
bootstrapLeaderMachineType="$gpuBootstrapLeaderMachineType"
|
||||||
|
else
|
||||||
|
bootstrapLeaderMachineType="$cpuBootstrapLeaderMachineType"
|
||||||
|
fi
|
||||||
|
validatorMachineType=$bootstrapLeaderMachineType
|
||||||
|
blockstreamerMachineType=$bootstrapLeaderMachineType
|
||||||
|
|
||||||
# cloud_ForEachInstance [cmd] [extra args to cmd]
|
# cloud_ForEachInstance [cmd] [extra args to cmd]
|
||||||
#
|
#
|
||||||
# Execute a command for each element in the `instances` array
|
# Execute a command for each element in the `instances` array
|
||||||
@ -432,6 +464,7 @@ netBasename=$prefix
|
|||||||
publicNetwork=$publicNetwork
|
publicNetwork=$publicNetwork
|
||||||
sshPrivateKey=$sshPrivateKey
|
sshPrivateKey=$sshPrivateKey
|
||||||
letsEncryptDomainName=$letsEncryptDomainName
|
letsEncryptDomainName=$letsEncryptDomainName
|
||||||
|
export TMPFS_ACCOUNTS=$tmpfsAccounts
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
touch "$geoipConfigFile"
|
touch "$geoipConfigFile"
|
||||||
@ -820,6 +853,24 @@ $(printNetworkInfo)
|
|||||||
$(creationInfo)
|
$(creationInfo)
|
||||||
EOM
|
EOM
|
||||||
|
|
||||||
|
$(
|
||||||
|
if [[ "$tmpfsAccounts" = "true" ]]; then
|
||||||
|
cat <<'EOSWAP'
|
||||||
|
|
||||||
|
# Setup swap/tmpfs for accounts
|
||||||
|
tmpfsMountPoint=/mnt/solana-accounts
|
||||||
|
swapDevice="/dev/nvme0n1"
|
||||||
|
swapUUID="43076c54-7840-4e59-a368-2d164f8984fb"
|
||||||
|
mkswap --uuid "$swapUUID" "$swapDevice"
|
||||||
|
echo "UUID=$swapUUID swap swap defaults 0 0" >> /etc/fstab
|
||||||
|
swapon "UUID=$swapUUID"
|
||||||
|
mkdir -p -m 0777 "$tmpfsMountPoint"
|
||||||
|
echo "tmpfs $tmpfsMountPoint tmpfs defaults,size=300G 0 0" >> /etc/fstab
|
||||||
|
mount "$tmpfsMountPoint"
|
||||||
|
EOSWAP
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
|
||||||
touch /solana-scratch/.instance-startup-complete
|
touch /solana-scratch/.instance-startup-complete
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
@ -289,6 +289,7 @@ startBootstrapLeader() {
|
|||||||
\"$maybeWarpSlot\" \
|
\"$maybeWarpSlot\" \
|
||||||
\"$waitForNodeInit\" \
|
\"$waitForNodeInit\" \
|
||||||
\"$extraPrimordialStakes\" \
|
\"$extraPrimordialStakes\" \
|
||||||
|
\"$TMPFS_ACCOUNTS\" \
|
||||||
"
|
"
|
||||||
|
|
||||||
) >> "$logFile" 2>&1 || {
|
) >> "$logFile" 2>&1 || {
|
||||||
@ -360,6 +361,7 @@ startNode() {
|
|||||||
\"$maybeWarpSlot\" \
|
\"$maybeWarpSlot\" \
|
||||||
\"$waitForNodeInit\" \
|
\"$waitForNodeInit\" \
|
||||||
\"$extraPrimordialStakes\" \
|
\"$extraPrimordialStakes\" \
|
||||||
|
\"$TMPFS_ACCOUNTS\" \
|
||||||
"
|
"
|
||||||
) >> "$logFile" 2>&1 &
|
) >> "$logFile" 2>&1 &
|
||||||
declare pid=$!
|
declare pid=$!
|
||||||
|
@ -28,6 +28,7 @@ gpuMode="${19:-auto}"
|
|||||||
maybeWarpSlot="${20}"
|
maybeWarpSlot="${20}"
|
||||||
waitForNodeInit="${21}"
|
waitForNodeInit="${21}"
|
||||||
extraPrimordialStakes="${22:=0}"
|
extraPrimordialStakes="${22:=0}"
|
||||||
|
tmpfsAccounts="${23:false}"
|
||||||
set +x
|
set +x
|
||||||
|
|
||||||
missing() {
|
missing() {
|
||||||
@ -274,6 +275,10 @@ EOF
|
|||||||
--init-complete-file "$initCompleteFile"
|
--init-complete-file "$initCompleteFile"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if [[ "$tmpfsAccounts" = "true" ]]; then
|
||||||
|
args+=(--accounts /mnt/solana-accounts)
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $airdropsEnabled = true ]]; then
|
if [[ $airdropsEnabled = true ]]; then
|
||||||
cat >> ~/solana/on-reboot <<EOF
|
cat >> ~/solana/on-reboot <<EOF
|
||||||
./multinode-demo/faucet.sh > faucet.log 2>&1 &
|
./multinode-demo/faucet.sh > faucet.log 2>&1 &
|
||||||
@ -391,6 +396,10 @@ EOF
|
|||||||
maybeSkipAccountsCreation="export SKIP_ACCOUNTS_CREATION=1"
|
maybeSkipAccountsCreation="export SKIP_ACCOUNTS_CREATION=1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$tmpfsAccounts" = "true" ]]; then
|
||||||
|
args+=(--accounts /mnt/solana-accounts)
|
||||||
|
fi
|
||||||
|
|
||||||
cat >> ~/solana/on-reboot <<EOF
|
cat >> ~/solana/on-reboot <<EOF
|
||||||
$maybeSkipAccountsCreation
|
$maybeSkipAccountsCreation
|
||||||
nohup multinode-demo/validator.sh ${args[@]} > validator.log.\$now 2>&1 &
|
nohup multinode-demo/validator.sh ${args[@]} > validator.log.\$now 2>&1 &
|
||||||
|
@ -8,6 +8,10 @@ cloud_DefaultZone() {
|
|||||||
echo "westus"
|
echo "westus"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cloud_DefaultCustomMemoryGB() {
|
||||||
|
: # Not implemented
|
||||||
|
}
|
||||||
|
|
||||||
cloud_RestartPreemptedInstances() {
|
cloud_RestartPreemptedInstances() {
|
||||||
: # Not implemented
|
: # Not implemented
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,10 @@ cloud_DefaultZone() {
|
|||||||
echo "Denver"
|
echo "Denver"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cloud_DefaultCustomMemoryGB() {
|
||||||
|
: # Not implemented
|
||||||
|
}
|
||||||
|
|
||||||
cloud_RestartPreemptedInstances() {
|
cloud_RestartPreemptedInstances() {
|
||||||
: # Not implemented
|
: # Not implemented
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,10 @@ cloud_DefaultZone() {
|
|||||||
echo "us-east-1b"
|
echo "us-east-1b"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cloud_DefaultCustomMemoryGB() {
|
||||||
|
: # Not implemented
|
||||||
|
}
|
||||||
|
|
||||||
cloud_RestartPreemptedInstances() {
|
cloud_RestartPreemptedInstances() {
|
||||||
: # Not implemented
|
: # Not implemented
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,10 @@ cloud_DefaultZone() {
|
|||||||
echo "us-west1-b"
|
echo "us-west1-b"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cloud_DefaultCustomMemoryGB() {
|
||||||
|
echo 64
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# cloud_RestartPreemptedInstances [namePrefix]
|
# cloud_RestartPreemptedInstances [namePrefix]
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user