2018-08-28 10:19:33 -07:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
here=$(dirname "$0")
|
|
|
|
# shellcheck source=net/common.sh
|
|
|
|
source "$here"/common.sh
|
|
|
|
|
2018-09-16 14:46:08 -07:00
|
|
|
cloudProvider=$(basename "$0" .sh)
|
2018-09-22 16:43:47 -07:00
|
|
|
bootDiskType=""
|
2018-09-16 14:46:08 -07:00
|
|
|
case $cloudProvider in
|
|
|
|
gce)
|
|
|
|
# shellcheck source=net/scripts/gce-provider.sh
|
|
|
|
source "$here"/scripts/gce-provider.sh
|
|
|
|
|
2018-11-04 19:06:14 -08:00
|
|
|
cpuImageName="ubuntu-1804-bionic-v20181029 --image-project ubuntu-os-cloud"
|
|
|
|
|
|
|
|
# TODO: GPU image is still 16.04-based pending resolution of
|
|
|
|
# https://github.com/solana-labs/solana/issues/1702
|
|
|
|
gpuImageName="ubuntu-16-04-cuda-9-2-new"
|
|
|
|
imageName=$cpuImageName
|
|
|
|
|
2018-09-17 08:25:10 -07:00
|
|
|
cpuLeaderMachineType=n1-standard-16
|
|
|
|
gpuLeaderMachineType="$cpuLeaderMachineType --accelerator count=4,type=nvidia-tesla-k80"
|
|
|
|
leaderMachineType=$cpuLeaderMachineType
|
2018-10-17 17:16:50 -07:00
|
|
|
validatorMachineType=n1-standard-16
|
2018-09-16 14:46:08 -07:00
|
|
|
clientMachineType=n1-standard-16
|
|
|
|
;;
|
|
|
|
ec2)
|
|
|
|
# shellcheck source=net/scripts/ec2-provider.sh
|
|
|
|
source "$here"/scripts/ec2-provider.sh
|
|
|
|
|
2018-11-04 19:06:14 -08:00
|
|
|
# Deep Learning AMI (Ubuntu 16.04-based)
|
|
|
|
cpuImageName="ami-0466e26ccc0e752c1"
|
|
|
|
gpuImageName="$cpuImageName"
|
|
|
|
imageName=$cpuImageName
|
|
|
|
|
2018-09-17 08:25:10 -07:00
|
|
|
cpuLeaderMachineType=m4.4xlarge
|
|
|
|
gpuLeaderMachineType=p2.xlarge
|
|
|
|
leaderMachineType=$cpuLeaderMachineType
|
2018-11-05 08:30:10 -08:00
|
|
|
validatorMachineType=m4.4xlarge
|
2018-09-16 14:46:08 -07:00
|
|
|
clientMachineType=m4.4xlarge
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Error: Unknown cloud provider: $cloudProvider"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
2018-09-06 08:18:05 -07:00
|
|
|
prefix=testnet-dev-${USER//[^A-Za-z0-9]/}
|
2018-09-07 08:03:52 -07:00
|
|
|
validatorNodeCount=5
|
2018-08-29 08:13:35 -07:00
|
|
|
clientNodeCount=1
|
2018-09-16 14:46:08 -07:00
|
|
|
leaderBootDiskSizeInGb=1000
|
|
|
|
validatorBootDiskSizeInGb=$leaderBootDiskSizeInGb
|
2018-09-17 08:25:10 -07:00
|
|
|
clientBootDiskSizeInGb=75
|
2018-09-16 14:46:08 -07:00
|
|
|
|
2018-09-04 22:21:58 -07:00
|
|
|
publicNetwork=false
|
2018-09-16 14:46:08 -07:00
|
|
|
enableGpu=false
|
2018-09-05 09:31:50 -07:00
|
|
|
leaderAddress=
|
2018-08-28 10:19:33 -07:00
|
|
|
|
|
|
|
usage() {
|
|
|
|
exitcode=0
|
|
|
|
if [[ -n "$1" ]]; then
|
|
|
|
exitcode=1
|
|
|
|
echo "Error: $*"
|
|
|
|
fi
|
|
|
|
cat <<EOF
|
|
|
|
usage: $0 [create|config|delete] [common options] [command-specific options]
|
|
|
|
|
2018-09-16 14:46:08 -07:00
|
|
|
Manage testnet instances
|
2018-08-28 10:19:33 -07:00
|
|
|
|
|
|
|
create - create a new testnet (implies 'config')
|
|
|
|
config - configure the testnet and write a config file describing it
|
|
|
|
delete - delete the testnet
|
|
|
|
|
|
|
|
common options:
|
2018-09-06 10:08:34 -07:00
|
|
|
-p [prefix] - Optional common prefix for instance names to avoid
|
|
|
|
collisions (default: $prefix)
|
2018-08-28 10:19:33 -07:00
|
|
|
|
|
|
|
create-specific options:
|
2018-09-05 09:31:50 -07:00
|
|
|
-n [number] - Number of validator nodes (default: $validatorNodeCount)
|
|
|
|
-c [number] - Number of client nodes (default: $clientNodeCount)
|
2018-09-04 22:21:58 -07:00
|
|
|
-P - Use public network IP addresses (default: $publicNetwork)
|
2018-09-16 14:46:08 -07:00
|
|
|
-z [zone] - Zone for the nodes (default: $zone)
|
|
|
|
-g - Enable GPU (default: $enableGpu)
|
2018-09-27 11:55:56 -07:00
|
|
|
-G - Enable GPU, and set count/type of GPUs to use (e.g $cpuLeaderMachineType --accelerator count=4,type=nvidia-tesla-k80)
|
2018-09-16 14:46:08 -07:00
|
|
|
-a [address] - Set the leader node's external IP address to this value.
|
|
|
|
For GCE, [address] is the "name" of the desired External
|
|
|
|
IP Address.
|
|
|
|
For EC2, [address] is the "allocation ID" of the desired
|
|
|
|
Elastic IP.
|
2018-09-22 16:43:47 -07:00
|
|
|
-d [disk-type] - Specify a boot disk type (default None) Use pd-ssd to get ssd on GCE.
|
2018-08-28 10:19:33 -07:00
|
|
|
|
|
|
|
config-specific options:
|
|
|
|
none
|
|
|
|
|
|
|
|
delete-specific options:
|
2018-09-07 08:57:14 -07:00
|
|
|
none
|
2018-08-28 10:19:33 -07:00
|
|
|
|
|
|
|
EOF
|
|
|
|
exit $exitcode
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
command=$1
|
|
|
|
[[ -n $command ]] || usage
|
|
|
|
shift
|
|
|
|
[[ $command = create || $command = config || $command = delete ]] || usage "Invalid command: $command"
|
|
|
|
|
2018-09-27 11:55:56 -07:00
|
|
|
while getopts "h?p:Pn:c:z:gG:a:d:" opt; do
|
2018-08-28 10:19:33 -07:00
|
|
|
case $opt in
|
|
|
|
h | \?)
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
p)
|
2018-09-06 10:08:34 -07:00
|
|
|
[[ ${OPTARG//[^A-Za-z0-9-]/} == "$OPTARG" ]] || usage "Invalid prefix: \"$OPTARG\", alphanumeric only"
|
2018-08-28 10:19:33 -07:00
|
|
|
prefix=$OPTARG
|
|
|
|
;;
|
|
|
|
P)
|
2018-09-04 22:21:58 -07:00
|
|
|
publicNetwork=true
|
2018-08-28 10:19:33 -07:00
|
|
|
;;
|
|
|
|
n)
|
|
|
|
validatorNodeCount=$OPTARG
|
|
|
|
;;
|
|
|
|
c)
|
|
|
|
clientNodeCount=$OPTARG
|
|
|
|
;;
|
|
|
|
z)
|
2018-09-16 14:46:08 -07:00
|
|
|
cloud_SetZone "$OPTARG"
|
2018-08-28 10:19:33 -07:00
|
|
|
;;
|
2018-09-04 08:17:41 -07:00
|
|
|
g)
|
2018-09-16 14:46:08 -07:00
|
|
|
enableGpu=true
|
2018-11-04 19:06:14 -08:00
|
|
|
leaderMachineType=$gpuLeaderMachineType
|
|
|
|
imageName=$gpuImageName
|
2018-09-04 08:17:41 -07:00
|
|
|
;;
|
2018-09-27 11:55:56 -07:00
|
|
|
G)
|
|
|
|
enableGpu=true
|
|
|
|
leaderMachineType="$OPTARG"
|
2018-11-05 13:28:07 -08:00
|
|
|
imageName=$gpuImageName
|
2018-09-27 11:55:56 -07:00
|
|
|
;;
|
2018-09-05 09:31:50 -07:00
|
|
|
a)
|
|
|
|
leaderAddress=$OPTARG
|
|
|
|
;;
|
2018-09-22 16:43:47 -07:00
|
|
|
d)
|
|
|
|
bootDiskType=$OPTARG
|
|
|
|
;;
|
2018-08-28 10:19:33 -07:00
|
|
|
*)
|
|
|
|
usage "Error: unhandled option: $opt"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2018-09-06 20:57:05 -07:00
|
|
|
shift $((OPTIND - 1))
|
2018-08-28 10:19:33 -07:00
|
|
|
|
2018-09-06 20:57:05 -07:00
|
|
|
[[ -z $1 ]] || usage "Unexpected argument: $1"
|
2018-09-08 19:19:12 -07:00
|
|
|
sshPrivateKey="$netConfigDir/id_$prefix"
|
2018-08-28 10:19:33 -07:00
|
|
|
|
2018-09-16 14:46:08 -07:00
|
|
|
|
|
|
|
# cloud_ForEachInstance [cmd] [extra args to cmd]
|
|
|
|
#
|
|
|
|
# Execute a command for each element in the `instances` array
|
|
|
|
#
|
|
|
|
# cmd - The command to execute on each instance
|
|
|
|
# The command will receive arguments followed by any
|
|
|
|
# additionl arguments supplied to cloud_ForEachInstance:
|
|
|
|
# name - name of the instance
|
|
|
|
# publicIp - The public IP address of this instance
|
|
|
|
# privateIp - The priate IP address of this instance
|
|
|
|
# count - Monotonically increasing count for each
|
|
|
|
# invocation of cmd, starting at 1
|
|
|
|
# ... - Extra args to cmd..
|
|
|
|
#
|
|
|
|
#
|
|
|
|
cloud_ForEachInstance() {
|
|
|
|
declare cmd="$1"
|
|
|
|
shift
|
|
|
|
[[ -n $cmd ]] || { echo cloud_ForEachInstance: cmd not specified; exit 1; }
|
|
|
|
|
|
|
|
declare count=1
|
|
|
|
for info in "${instances[@]}"; do
|
|
|
|
declare name publicIp privateIp
|
|
|
|
IFS=: read -r name publicIp privateIp < <(echo "$info")
|
|
|
|
|
|
|
|
eval "$cmd" "$name" "$publicIp" "$privateIp" "$count" "$@"
|
|
|
|
count=$((count + 1))
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2018-09-03 21:15:55 -07:00
|
|
|
prepareInstancesAndWriteConfigFile() {
|
2018-09-06 13:00:01 -07:00
|
|
|
$metricsWriteDatapoint "testnet-deploy net-config-begin=1"
|
2018-08-28 10:19:33 -07:00
|
|
|
|
2018-09-04 22:21:58 -07:00
|
|
|
cat >> "$configFile" <<EOF
|
|
|
|
# autogenerated at $(date)
|
|
|
|
netBasename=$prefix
|
|
|
|
publicNetwork=$publicNetwork
|
2018-09-08 19:19:12 -07:00
|
|
|
sshPrivateKey=$sshPrivateKey
|
2018-09-04 22:21:58 -07:00
|
|
|
EOF
|
2018-09-03 21:15:55 -07:00
|
|
|
|
2018-09-08 19:19:12 -07:00
|
|
|
buildSshOptions
|
2018-08-28 10:19:33 -07:00
|
|
|
|
|
|
|
recordInstanceIp() {
|
|
|
|
declare name="$1"
|
2018-09-16 14:46:08 -07:00
|
|
|
declare publicIp="$2"
|
|
|
|
declare privateIp="$3"
|
2018-08-28 10:19:33 -07:00
|
|
|
|
2018-09-16 14:46:08 -07:00
|
|
|
declare arrayName="$5"
|
2018-08-28 10:19:33 -07:00
|
|
|
|
2018-09-04 22:21:58 -07:00
|
|
|
echo "$arrayName+=($publicIp) # $name" >> "$configFile"
|
|
|
|
if [[ $arrayName = "leaderIp" ]]; then
|
|
|
|
if $publicNetwork; then
|
|
|
|
echo "entrypointIp=$publicIp" >> "$configFile"
|
|
|
|
else
|
|
|
|
echo "entrypointIp=$privateIp" >> "$configFile"
|
|
|
|
fi
|
2018-08-28 10:19:33 -07:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-09-08 19:19:12 -07:00
|
|
|
waitForStartupComplete() {
|
|
|
|
declare name="$1"
|
2018-09-16 14:46:08 -07:00
|
|
|
declare publicIp="$2"
|
2018-09-08 19:19:12 -07:00
|
|
|
|
|
|
|
echo "Waiting for $name to finish booting..."
|
|
|
|
(
|
|
|
|
for i in $(seq 1 30); do
|
2018-11-06 14:02:27 -08:00
|
|
|
if (set -x; timeout 20s ssh "${sshOptions[@]}" "$publicIp" "test -f /.instance-startup-complete"); then
|
2018-09-08 19:19:12 -07:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
sleep 2
|
|
|
|
echo "Retry $i..."
|
|
|
|
done
|
|
|
|
)
|
2018-09-16 14:46:08 -07:00
|
|
|
echo "$name has booted."
|
2018-09-08 19:19:12 -07:00
|
|
|
}
|
|
|
|
|
2018-09-04 12:59:19 -07:00
|
|
|
echo "Looking for leader instance..."
|
2018-09-16 14:46:08 -07:00
|
|
|
cloud_FindInstance "$prefix-leader"
|
2018-08-28 10:19:33 -07:00
|
|
|
[[ ${#instances[@]} -eq 1 ]] || {
|
2018-09-08 19:19:12 -07:00
|
|
|
echo "Unable to find leader"
|
2018-08-28 10:19:33 -07:00
|
|
|
exit 1
|
|
|
|
}
|
2018-09-03 21:15:55 -07:00
|
|
|
|
2018-09-08 19:19:12 -07:00
|
|
|
(
|
|
|
|
declare leaderName
|
|
|
|
declare leaderIp
|
2018-09-16 14:46:08 -07:00
|
|
|
IFS=: read -r leaderName leaderIp _ < <(echo "${instances[0]}")
|
2018-09-08 19:19:12 -07:00
|
|
|
|
2018-09-16 14:46:08 -07:00
|
|
|
# Try to ping the machine first.
|
|
|
|
timeout 60s bash -c "set -o pipefail; until ping -c 3 $leaderIp | tr - _; do echo .; done"
|
2018-09-08 19:19:12 -07:00
|
|
|
|
2018-09-16 14:46:08 -07:00
|
|
|
if [[ ! -r $sshPrivateKey ]]; then
|
|
|
|
echo "Fetching $sshPrivateKey from $leaderName"
|
2018-09-08 19:19:12 -07:00
|
|
|
|
2018-09-16 14:46:08 -07:00
|
|
|
# Try to scp in a couple times, sshd may not yet be up even though the
|
|
|
|
# machine can be pinged...
|
|
|
|
set -x -o pipefail
|
|
|
|
for i in $(seq 1 30); do
|
|
|
|
if cloud_FetchFile "$leaderName" "$leaderIp" /solana-id_ecdsa "$sshPrivateKey"; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
|
|
|
|
sleep 1
|
|
|
|
echo "Retry $i..."
|
|
|
|
done
|
2018-09-08 19:19:12 -07:00
|
|
|
|
2018-09-16 14:46:08 -07:00
|
|
|
chmod 400 "$sshPrivateKey"
|
|
|
|
ls -l "$sshPrivateKey"
|
|
|
|
fi
|
2018-09-08 19:19:12 -07:00
|
|
|
)
|
2018-08-28 10:19:33 -07:00
|
|
|
|
|
|
|
echo "leaderIp=()" >> "$configFile"
|
2018-09-16 14:46:08 -07:00
|
|
|
cloud_ForEachInstance recordInstanceIp leaderIp
|
|
|
|
cloud_ForEachInstance waitForStartupComplete
|
2018-08-28 10:19:33 -07:00
|
|
|
|
2018-09-04 12:59:19 -07:00
|
|
|
echo "Looking for validator instances..."
|
2018-09-16 14:46:08 -07:00
|
|
|
cloud_FindInstances "$prefix-validator"
|
2018-08-28 10:19:33 -07:00
|
|
|
[[ ${#instances[@]} -gt 0 ]] || {
|
2018-09-08 19:19:12 -07:00
|
|
|
echo "Unable to find validators"
|
2018-08-28 10:19:33 -07:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
echo "validatorIpList=()" >> "$configFile"
|
2018-09-16 14:46:08 -07:00
|
|
|
cloud_ForEachInstance recordInstanceIp validatorIpList
|
|
|
|
cloud_ForEachInstance waitForStartupComplete
|
2018-08-28 10:19:33 -07:00
|
|
|
|
|
|
|
echo "clientIpList=()" >> "$configFile"
|
2018-09-04 12:59:19 -07:00
|
|
|
echo "Looking for client instances..."
|
2018-09-16 14:46:08 -07:00
|
|
|
cloud_FindInstances "$prefix-client"
|
2018-09-04 22:46:55 -07:00
|
|
|
[[ ${#instances[@]} -eq 0 ]] || {
|
2018-09-16 14:46:08 -07:00
|
|
|
cloud_ForEachInstance recordInstanceIp clientIpList
|
|
|
|
cloud_ForEachInstance waitForStartupComplete
|
2018-09-04 22:46:55 -07:00
|
|
|
}
|
2018-08-28 10:19:33 -07:00
|
|
|
|
|
|
|
echo "Wrote $configFile"
|
2018-09-06 12:14:04 -07:00
|
|
|
$metricsWriteDatapoint "testnet-deploy net-config-complete=1"
|
2018-08-28 10:19:33 -07:00
|
|
|
}
|
|
|
|
|
2018-09-16 14:46:08 -07:00
|
|
|
delete() {
|
2018-09-06 13:00:01 -07:00
|
|
|
$metricsWriteDatapoint "testnet-deploy net-delete-begin=1"
|
2018-09-06 12:14:04 -07:00
|
|
|
|
2018-09-07 08:56:43 -07:00
|
|
|
# Delete the leader node first to prevent unusual metrics on the dashboard
|
|
|
|
# during shutdown.
|
|
|
|
# TODO: It would be better to fully cut-off metrics reporting before any
|
|
|
|
# instances are deleted.
|
2018-09-16 14:46:08 -07:00
|
|
|
for filter in "$prefix-leader" "$prefix-"; do
|
|
|
|
echo "Searching for instances: $filter"
|
|
|
|
cloud_FindInstances "$filter"
|
2018-09-07 08:56:43 -07:00
|
|
|
|
|
|
|
if [[ ${#instances[@]} -eq 0 ]]; then
|
|
|
|
echo "No instances found matching '$filter'"
|
|
|
|
else
|
2018-09-16 14:46:08 -07:00
|
|
|
cloud_DeleteInstances true
|
2018-09-07 08:56:43 -07:00
|
|
|
fi
|
|
|
|
done
|
2018-09-04 09:21:03 -07:00
|
|
|
rm -f "$configFile"
|
2018-09-06 12:14:04 -07:00
|
|
|
|
|
|
|
$metricsWriteDatapoint "testnet-deploy net-delete-complete=1"
|
2018-09-16 14:46:08 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case $command in
|
|
|
|
delete)
|
|
|
|
delete
|
2018-08-28 10:19:33 -07:00
|
|
|
;;
|
|
|
|
|
|
|
|
create)
|
|
|
|
[[ -n $validatorNodeCount ]] || usage "Need number of nodes"
|
2018-09-16 14:46:08 -07:00
|
|
|
if [[ $validatorNodeCount -le 0 ]]; then
|
|
|
|
usage "One or more validator nodes is required"
|
|
|
|
fi
|
|
|
|
|
|
|
|
delete
|
2018-08-28 10:19:33 -07:00
|
|
|
|
2018-09-06 13:00:01 -07:00
|
|
|
$metricsWriteDatapoint "testnet-deploy net-create-begin=1"
|
2018-09-06 12:14:04 -07:00
|
|
|
|
2018-09-08 19:19:12 -07:00
|
|
|
rm -rf "$sshPrivateKey"{,.pub}
|
2018-09-16 14:46:08 -07:00
|
|
|
|
|
|
|
# Note: using rsa because |aws ec2 import-key-pair| seems to fail for ecdsa
|
|
|
|
ssh-keygen -t rsa -N '' -f "$sshPrivateKey"
|
2018-09-08 19:19:12 -07:00
|
|
|
|
2018-09-08 10:38:32 -07:00
|
|
|
printNetworkInfo() {
|
|
|
|
cat <<EOF
|
|
|
|
========================================================================================
|
|
|
|
|
|
|
|
Network composition:
|
2018-09-16 14:46:08 -07:00
|
|
|
Leader = $leaderMachineType (GPU=$enableGpu)
|
|
|
|
Validators = $validatorNodeCount x $validatorMachineType
|
|
|
|
Client(s) = $clientNodeCount x $clientMachineType
|
2018-09-08 10:38:32 -07:00
|
|
|
|
|
|
|
========================================================================================
|
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
printNetworkInfo
|
|
|
|
|
2018-09-16 14:46:08 -07:00
|
|
|
declare startupScript="$netConfigDir"/instance-startup-script.sh
|
2018-09-08 10:38:32 -07:00
|
|
|
cat > "$startupScript" <<EOF
|
|
|
|
#!/bin/bash -ex
|
|
|
|
# autogenerated at $(date)
|
|
|
|
|
|
|
|
cat > /etc/motd <<EOM
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
|
|
This instance has not been fully configured.
|
2018-09-16 14:46:08 -07:00
|
|
|
|
|
|
|
See startup script log messages in /var/log/syslog for status:
|
|
|
|
$ sudo cat /var/log/syslog | egrep \\(startup-script\\|cloud-init\)
|
2018-09-08 10:38:32 -07:00
|
|
|
|
2018-09-08 19:19:12 -07:00
|
|
|
To block until setup is complete, run:
|
2018-09-16 14:46:08 -07:00
|
|
|
$ until [[ -f /.instance-startup-complete ]]; do sleep 1; done
|
2018-09-08 19:19:12 -07:00
|
|
|
|
2018-09-08 10:38:32 -07:00
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
EOM
|
|
|
|
|
2018-09-08 19:19:12 -07:00
|
|
|
# Place the generated private key at /solana-id_ecdsa so it's retrievable by anybody
|
|
|
|
# who is able to log into this machine
|
|
|
|
cat > /solana-id_ecdsa <<EOK
|
|
|
|
$(cat "$sshPrivateKey")
|
|
|
|
EOK
|
|
|
|
cat > /solana-id_ecdsa.pub <<EOK
|
|
|
|
$(cat "$sshPrivateKey.pub")
|
|
|
|
EOK
|
|
|
|
chmod 444 /solana-id_ecdsa
|
|
|
|
|
2018-09-08 10:38:32 -07:00
|
|
|
USER=\$(id -un)
|
|
|
|
|
|
|
|
$(
|
|
|
|
cd "$here"/scripts/
|
|
|
|
cat \
|
|
|
|
disable-background-upgrades.sh \
|
2018-09-08 19:19:12 -07:00
|
|
|
create-solana-user.sh \
|
2018-09-16 14:46:08 -07:00
|
|
|
add-solana-user-authorized_keys.sh \
|
2018-09-08 10:38:32 -07:00
|
|
|
install-earlyoom.sh \
|
|
|
|
install-libssl-compatability.sh \
|
2018-09-12 16:22:22 -07:00
|
|
|
install-rsync.sh \
|
2018-10-30 09:17:35 -07:00
|
|
|
network-config.sh \
|
2018-09-08 10:38:32 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
cat > /etc/motd <<EOM
|
|
|
|
$(printNetworkInfo)
|
|
|
|
EOM
|
|
|
|
|
2018-09-16 14:46:08 -07:00
|
|
|
touch /.instance-startup-complete
|
2018-09-08 19:19:12 -07:00
|
|
|
|
2018-09-08 10:38:32 -07:00
|
|
|
EOF
|
|
|
|
|
2018-09-16 14:46:08 -07:00
|
|
|
cloud_CreateInstances "$prefix" "$prefix-leader" 1 \
|
2018-09-17 08:25:10 -07:00
|
|
|
"$imageName" "$leaderMachineType" "$leaderBootDiskSizeInGb" \
|
2018-09-22 16:43:47 -07:00
|
|
|
"$startupScript" "$leaderAddress" "$bootDiskType"
|
2018-09-05 09:31:50 -07:00
|
|
|
|
2018-09-16 14:46:08 -07:00
|
|
|
cloud_CreateInstances "$prefix" "$prefix-validator" "$validatorNodeCount" \
|
2018-09-17 08:25:10 -07:00
|
|
|
"$imageName" "$validatorMachineType" "$validatorBootDiskSizeInGb" \
|
2018-09-22 16:43:47 -07:00
|
|
|
"$startupScript" "" "$bootDiskType"
|
2018-09-08 10:38:32 -07:00
|
|
|
|
2018-09-06 10:34:24 -07:00
|
|
|
if [[ $clientNodeCount -gt 0 ]]; then
|
2018-09-16 14:46:08 -07:00
|
|
|
cloud_CreateInstances "$prefix" "$prefix-client" "$clientNodeCount" \
|
2018-09-17 08:25:10 -07:00
|
|
|
"$imageName" "$clientMachineType" "$clientBootDiskSizeInGb" \
|
2018-09-22 16:43:47 -07:00
|
|
|
"$startupScript" "" "$bootDiskType"
|
2018-08-28 10:19:33 -07:00
|
|
|
fi
|
2018-08-29 08:13:35 -07:00
|
|
|
|
2018-09-06 12:14:04 -07:00
|
|
|
$metricsWriteDatapoint "testnet-deploy net-create-complete=1"
|
|
|
|
|
2018-09-03 21:15:55 -07:00
|
|
|
prepareInstancesAndWriteConfigFile
|
2018-08-28 10:19:33 -07:00
|
|
|
;;
|
|
|
|
|
|
|
|
config)
|
2018-09-03 21:15:55 -07:00
|
|
|
prepareInstancesAndWriteConfigFile
|
2018-08-28 10:19:33 -07:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
usage "Unknown command: $command"
|
|
|
|
esac
|