2018-11-11 08:19:04 -08:00
#!/usr/bin/env bash
set -e
2018-11-05 13:21:34 -08:00
cd " $( dirname " $0 " ) " /..
if [ [ -z $BUILDKITE ] ] ; then
echo BUILDKITE not defined
exit 1
fi
2018-11-06 07:24:49 -08:00
if [ [ -z $SOLANA_METRICS_PARTIAL_CONFIG ] ] ; then
2018-11-06 19:23:20 -08:00
echo SOLANA_METRICS_PARTIAL_CONFIG not defined
2018-11-05 13:21:34 -08:00
exit 1
fi
if [ [ -z $TESTNET ] ] ; then
TESTNET = $( buildkite-agent meta-data get "testnet" --default "" )
fi
if [ [ -z $TESTNET_OP ] ] ; then
TESTNET_OP = $( buildkite-agent meta-data get "testnet-operation" --default "" )
fi
if [ [ -z $TESTNET || -z $TESTNET_OP ] ] ; then
(
cat <<EOF
steps:
- block: "Manage Testnet"
fields:
- select : "Network"
key: "testnet"
options:
- label: "testnet"
value: "testnet"
- label: "testnet-perf"
value: "testnet-perf"
2018-11-06 19:23:20 -08:00
- label: "testnet-edge"
value: "testnet-edge"
- label: "testnet-edge-perf"
value: "testnet-edge-perf"
- label: "testnet-beta"
value: "testnet-beta"
- label: "testnet-beta-perf"
value: "testnet-beta-perf"
2019-04-26 09:02:23 -07:00
- label: "testnet-demo"
value: "testnet-demo"
2019-07-10 09:26:24 -07:00
- label: "tds"
value: "tds"
2018-11-05 13:21:34 -08:00
- select : "Operation"
key: "testnet-operation"
default: "sanity-or-restart"
options:
2019-04-26 22:08:58 -07:00
- label: "Create testnet and then start software. If the testnet already exists it will be deleted and re-created"
2019-04-26 09:02:23 -07:00
value: "create-and-start"
2019-04-26 22:08:58 -07:00
- label: "Create testnet, but do not start software. If the testnet already exists it will be deleted and re-created"
2019-04-26 09:02:23 -07:00
value: "create"
2019-04-27 07:41:21 -07:00
- label: "Start network software on an existing testnet. If software is already running it will be restarted"
2018-11-05 13:21:34 -08:00
value: "start"
2019-04-26 09:02:23 -07:00
- label: "Stop network software without deleting testnet nodes"
2018-11-05 13:21:34 -08:00
value: "stop"
2019-04-26 09:02:23 -07:00
- label: "Update the network software. Restart network software on failure"
value: "update-or-restart"
- label: "Sanity check. Restart network software on failure"
value: "sanity-or-restart"
2018-11-05 13:21:34 -08:00
- label: "Sanity check only"
value: "sanity"
2019-04-27 07:41:21 -07:00
- label: "Delete the testnet"
2019-04-26 09:02:23 -07:00
value: "delete"
2019-04-27 07:41:21 -07:00
- label: "Enable/unlock the testnet"
2019-04-26 13:26:05 -07:00
value: "enable"
2019-04-27 07:41:21 -07:00
- label: "Delete and then lock the testnet from further operation until it is re-enabled"
2019-04-26 13:26:05 -07:00
value: "disable"
2018-11-05 13:21:34 -08:00
- command: " ci/ $( basename " $0 " ) "
agents:
- " queue= $BUILDKITE_AGENT_META_DATA_QUEUE "
EOF
) | buildkite-agent pipeline upload
exit 0
fi
2019-04-25 11:44:58 -07:00
ci/channel-info.sh
eval " $( ci/channel-info.sh) "
2019-05-05 09:44:01 -07:00
EC2_ZONES = (
us-west-1a
us-west-2a
us-east-1a
us-east-2a
sa-east-1a
eu-west-1a
eu-west-2a
eu-central-1a
ap-northeast-2a
ap-southeast-2a
ap-south-1a
ca-central-1a
)
2019-04-28 19:50:02 -07:00
# GCE zones with _lots_ of quota
2019-04-27 16:52:03 -07:00
GCE_ZONES = (
2019-04-28 19:50:02 -07:00
us-west1-a
us-central1-a
us-east1-b
europe-west4-a
us-west1-b
us-central1-b
us-east1-c
europe-west4-b
us-west1-c
us-east1-d
europe-west4-c
)
# GCE zones with enough quota for one CPU-only fullnode
GCE_LOW_QUOTA_ZONES = (
asia-east2-a
asia-northeast1-b
asia-northeast2-b
asia-south1-c
asia-southeast1-b
australia-southeast1-b
europe-north1-a
europe-west2-b
europe-west3-c
europe-west6-a
northamerica-northeast1-a
southamerica-east1-b
2019-04-27 16:52:03 -07:00
)
2019-04-25 11:44:58 -07:00
case $TESTNET in
testnet-edge| testnet-edge-perf)
CHANNEL_OR_TAG = edge
CHANNEL_BRANCH = $EDGE_CHANNEL
; ;
testnet-beta| testnet-beta-perf)
CHANNEL_OR_TAG = beta
CHANNEL_BRANCH = $BETA_CHANNEL
; ;
2019-04-26 20:12:27 -07:00
testnet)
2019-04-25 11:44:58 -07:00
CHANNEL_OR_TAG = $STABLE_CHANNEL_LATEST_TAG
CHANNEL_BRANCH = $STABLE_CHANNEL
; ;
2019-04-26 20:12:27 -07:00
testnet-perf)
CHANNEL_OR_TAG = $STABLE_CHANNEL_LATEST_TAG
CHANNEL_BRANCH = $STABLE_CHANNEL
; ;
2019-04-26 09:02:23 -07:00
testnet-demo)
2019-04-26 23:23:42 -07:00
CHANNEL_OR_TAG = beta
CHANNEL_BRANCH = $BETA_CHANNEL
2019-04-29 10:36:00 -07:00
: " ${ GCE_NODE_COUNT : =150 } "
: " ${ GCE_LOW_QUOTA_NODE_COUNT : =70 } "
2019-04-26 09:02:23 -07:00
; ;
2019-07-10 09:26:24 -07:00
tds)
2019-08-05 17:22:06 -07:00
: " ${ TDS_CHANNEL_OR_TAG : =edge } "
CHANNEL_OR_TAG = " $TDS_CHANNEL_OR_TAG "
CHANNEL_BRANCH = " $CI_BRANCH "
2019-07-09 13:39:55 -07:00
; ;
2019-04-25 11:44:58 -07:00
*)
echo " Error: Invalid TESTNET= $TESTNET "
exit 1
; ;
esac
2019-04-26 22:08:58 -07:00
EC2_ZONE_ARGS = ( )
for val in " ${ EC2_ZONES [@] } " ; do
EC2_ZONE_ARGS += ( " -z $val " )
done
GCE_ZONE_ARGS = ( )
for val in " ${ GCE_ZONES [@] } " ; do
GCE_ZONE_ARGS += ( " -z $val " )
done
2019-04-28 19:50:02 -07:00
GCE_LOW_QUOTA_ZONE_ARGS = ( )
for val in " ${ GCE_LOW_QUOTA_ZONES [@] } " ; do
GCE_LOW_QUOTA_ZONE_ARGS += ( " -z $val " )
done
2019-04-26 22:08:58 -07:00
2019-08-24 07:38:16 -07:00
if [ [ -z $TESTNET_DB_HOST ] ] ; then
TESTNET_DB_HOST = "https://metrics.solana.com:8086"
2019-03-26 14:03:03 -07:00
fi
2019-08-24 07:38:16 -07:00
export SOLANA_METRICS_CONFIG = " db= $TESTNET ,host= $TESTNET_DB_HOST , $SOLANA_METRICS_PARTIAL_CONFIG "
2018-11-06 07:24:49 -08:00
echo " SOLANA_METRICS_CONFIG: $SOLANA_METRICS_CONFIG "
2019-01-04 17:36:14 -08:00
source scripts/configure-metrics.sh
2018-11-06 07:24:49 -08:00
2019-04-09 13:00:45 -07:00
if [ [ -n $TESTNET_TAG ] ] ; then
CHANNEL_OR_TAG = $TESTNET_TAG
else
2019-04-26 09:02:23 -07:00
2019-06-06 12:20:47 -07:00
if [ [ $CI_BRANCH != " $CHANNEL_BRANCH " ] ] ; then
2019-04-09 13:00:45 -07:00
(
cat <<EOF
2018-11-05 13:21:34 -08:00
steps:
- trigger: " $BUILDKITE_PIPELINE_SLUG "
async: true
build:
message: " $BUILDKITE_MESSAGE "
branch: " $CHANNEL_BRANCH "
env:
TESTNET: " $TESTNET "
TESTNET_OP: " $TESTNET_OP "
2019-03-26 14:22:08 -07:00
TESTNET_DB_HOST: " $TESTNET_DB_HOST "
2019-04-07 11:21:42 -07:00
GCE_NODE_COUNT: " $GCE_NODE_COUNT "
2019-04-28 19:50:02 -07:00
GCE_LOW_QUOTA_NODE_COUNT: " $GCE_LOW_QUOTA_NODE_COUNT "
2018-11-05 13:21:34 -08:00
EOF
2019-04-09 13:00:45 -07:00
) | buildkite-agent pipeline upload
exit 0
fi
2018-11-05 13:21:34 -08:00
fi
sanity( ) {
echo " --- sanity $TESTNET "
case $TESTNET in
2018-11-06 19:23:20 -08:00
testnet-edge)
2018-11-05 13:21:34 -08:00
(
2018-12-22 11:57:47 -08:00
set -x
2019-06-05 15:31:29 -07:00
NO_INSTALL_CHECK = 1 \
2019-08-10 13:03:19 -07:00
NO_VALIDATOR_SANITY = 1 \
2019-08-04 20:42:28 -07:00
ci/testnet-sanity.sh edge-testnet-solana-com gce us-west1-b
2018-11-06 19:23:20 -08:00
)
; ;
testnet-edge-perf)
(
2018-12-22 11:57:47 -08:00
set -x
REJECT_EXTRA_NODES = 1 \
NO_VALIDATOR_SANITY = 1 \
ci/testnet-sanity.sh edge-perf-testnet-solana-com ec2 us-west-2b
2018-11-06 19:23:20 -08:00
)
; ;
testnet-beta)
(
2018-12-22 11:57:47 -08:00
set -x
2019-06-05 15:31:29 -07:00
NO_INSTALL_CHECK = 1 \
2019-08-10 13:03:19 -07:00
NO_VALIDATOR_SANITY = 1 \
2019-08-04 20:42:28 -07:00
ci/testnet-sanity.sh beta-testnet-solana-com gce us-west1-b
2018-11-06 19:23:20 -08:00
)
; ;
testnet-beta-perf)
(
2018-12-22 11:57:47 -08:00
set -x
REJECT_EXTRA_NODES = 1 \
NO_VALIDATOR_SANITY = 1 \
ci/testnet-sanity.sh beta-perf-testnet-solana-com ec2 us-west-2b
2018-11-05 13:21:34 -08:00
)
; ;
testnet)
(
2018-12-22 11:57:47 -08:00
set -x
2019-08-04 21:02:27 -07:00
NO_VALIDATOR_SANITY = 1 \
2019-08-04 21:28:13 -07:00
ci/testnet-sanity.sh testnet-solana-com gce us-west1-b
2018-11-05 13:21:34 -08:00
)
; ;
testnet-perf)
(
2018-12-22 11:57:47 -08:00
set -x
REJECT_EXTRA_NODES = 1 \
NO_VALIDATOR_SANITY = 1 \
ci/testnet-sanity.sh perf-testnet-solana-com gce us-west1-b
2018-11-07 10:48:21 -08:00
#ci/testnet-sanity.sh perf-testnet-solana-com ec2 us-east-1a
2018-11-05 13:21:34 -08:00
)
; ;
2019-04-26 22:08:58 -07:00
testnet-demo)
(
set -x
ok = true
if [ [ -n $GCE_NODE_COUNT ] ] ; then
2019-04-29 21:38:03 -07:00
NO_VALIDATOR_SANITY = 1 \
2019-04-27 21:31:36 -07:00
ci/testnet-sanity.sh demo-testnet-solana-com gce " ${ GCE_ZONES [0] } " -f || ok = false
2019-04-26 22:08:58 -07:00
else
echo "Error: no GCE nodes"
ok = false
fi
$ok
)
; ;
2019-07-10 09:26:24 -07:00
tds)
2019-07-09 13:39:55 -07:00
(
set -x
NO_VALIDATOR_SANITY = 1 \
ci/testnet-sanity.sh tds-solana-com gce " ${ GCE_ZONES [0] } " -f
)
; ;
2018-11-05 13:21:34 -08:00
*)
echo " Error: Invalid TESTNET= $TESTNET "
exit 1
; ;
esac
}
2019-04-26 09:02:23 -07:00
deploy( ) {
declare maybeCreate = $1
declare maybeStart = $2
declare maybeStop = $3
declare maybeDelete = $4
2018-11-05 13:21:34 -08:00
2019-04-26 20:12:27 -07:00
echo " --- deploy \" $maybeCreate \" \" $maybeStart \" \" $maybeStop \" \" $maybeDelete \" "
2019-04-26 09:02:23 -07:00
# Create or recreate the nodes
if [ [ -z $maybeCreate ] ] ; then
skipCreate = skip
else
skipCreate = ""
fi
# Start or restart the network software on the nodes
if [ [ -z $maybeStart ] ] ; then
skipStart = skip
2018-11-05 13:21:34 -08:00
else
2019-04-26 09:02:23 -07:00
skipStart = ""
fi
2018-11-05 13:21:34 -08:00
case $TESTNET in
2018-11-06 19:23:20 -08:00
testnet-edge)
2018-11-05 13:21:34 -08:00
(
2018-12-22 11:57:47 -08:00
set -x
2019-08-04 20:42:28 -07:00
ci/testnet-deploy.sh -p edge-testnet-solana-com -C gce -z us-west1-b \
2019-08-03 23:49:46 -07:00
-t " $CHANNEL_OR_TAG " -n 2 -c 0 -u -P \
2019-08-04 20:42:28 -07:00
-a edge-testnet-solana-com --letsencrypt edge.testnet.solana.com \
2019-04-28 19:50:02 -07:00
${ skipCreate : +-e } \
2019-04-26 09:02:23 -07:00
${ skipStart : +-s } \
${ maybeStop : +-S } \
2019-06-06 12:49:46 -07:00
${ maybeDelete : +-D }
2018-11-06 19:23:20 -08:00
)
; ;
testnet-edge-perf)
(
2018-12-22 11:57:47 -08:00
set -x
NO_VALIDATOR_SANITY = 1 \
2019-04-09 10:39:31 -07:00
RUST_LOG = solana = warn \
2019-04-05 11:10:54 -07:00
ci/testnet-deploy.sh -p edge-perf-testnet-solana-com -C ec2 -z us-west-2b \
2018-12-22 11:57:47 -08:00
-g -t " $CHANNEL_OR_TAG " -c 2 \
2019-04-28 19:50:02 -07:00
${ skipCreate : +-e } \
2019-04-26 09:02:23 -07:00
${ skipStart : +-s } \
${ maybeStop : +-S } \
2019-06-06 12:49:46 -07:00
${ maybeDelete : +-D }
2018-11-06 19:23:20 -08:00
)
; ;
testnet-beta)
(
2018-12-22 11:57:47 -08:00
set -x
2019-04-26 23:23:42 -07:00
NO_VALIDATOR_SANITY = 1 \
2019-08-04 20:42:28 -07:00
ci/testnet-deploy.sh -p beta-testnet-solana-com -C gce -z us-west1-b \
2019-08-03 23:49:46 -07:00
-t " $CHANNEL_OR_TAG " -n 2 -c 0 -u -P \
2019-08-04 20:42:28 -07:00
-a beta-testnet-solana-com --letsencrypt beta.testnet.solana.com \
2019-04-28 19:50:02 -07:00
${ skipCreate : +-e } \
2019-04-26 09:02:23 -07:00
${ skipStart : +-s } \
${ maybeStop : +-S } \
2019-06-06 12:49:46 -07:00
${ maybeDelete : +-D }
2018-11-06 19:23:20 -08:00
)
; ;
testnet-beta-perf)
(
2018-12-22 11:57:47 -08:00
set -x
NO_VALIDATOR_SANITY = 1 \
2019-04-09 10:39:31 -07:00
RUST_LOG = solana = warn \
2019-04-05 11:10:54 -07:00
ci/testnet-deploy.sh -p beta-perf-testnet-solana-com -C ec2 -z us-west-2b \
2018-12-22 11:57:47 -08:00
-g -t " $CHANNEL_OR_TAG " -c 2 \
2019-04-28 19:50:02 -07:00
${ skipCreate : +-e } \
2019-04-26 09:02:23 -07:00
${ skipStart : +-s } \
${ maybeStop : +-S } \
2019-06-06 12:49:46 -07:00
${ maybeDelete : +-D }
2018-11-05 13:21:34 -08:00
)
; ;
testnet)
(
2018-12-22 11:57:47 -08:00
set -x
2019-08-04 21:02:27 -07:00
NO_VALIDATOR_SANITY = 1 \
2019-08-04 21:28:13 -07:00
ci/testnet-deploy.sh -p testnet-solana-com -C gce -z us-west1-b \
2019-08-04 21:02:27 -07:00
-t " $CHANNEL_OR_TAG " -n 2 -c 0 -u -P \
-a testnet-solana-com --letsencrypt testnet.solana.com \
2019-04-28 19:50:02 -07:00
${ skipCreate : +-e } \
2019-04-26 09:02:23 -07:00
${ skipStart : +-s } \
${ maybeStop : +-S } \
2019-08-04 21:02:27 -07:00
${ maybeDelete : +-D }
2018-11-05 13:21:34 -08:00
)
; ;
testnet-perf)
(
2018-12-22 11:57:47 -08:00
set -x
NO_VALIDATOR_SANITY = 1 \
2019-04-09 10:39:31 -07:00
RUST_LOG = solana = warn \
2019-04-05 11:10:54 -07:00
ci/testnet-deploy.sh -p perf-testnet-solana-com -C gce -z us-west1-b \
2019-04-18 15:12:35 -07:00
-G "--machine-type n1-standard-16 --accelerator count=2,type=nvidia-tesla-v100" \
2018-12-22 11:57:47 -08:00
-t " $CHANNEL_OR_TAG " -c 2 \
-d pd-ssd \
2019-04-28 19:50:02 -07:00
${ skipCreate : +-e } \
2019-04-26 09:02:23 -07:00
${ skipStart : +-s } \
${ maybeStop : +-S } \
2019-06-06 12:49:46 -07:00
${ maybeDelete : +-D }
2018-11-05 13:21:34 -08:00
)
; ;
2019-04-26 09:02:23 -07:00
testnet-demo)
(
set -x
2019-04-28 19:50:02 -07:00
if [ [ -n $GCE_LOW_QUOTA_NODE_COUNT ] ] || [ [ -n $skipStart ] ] ; then
maybeSkipStart = "skip"
fi
# shellcheck disable=SC2068
2019-04-29 21:38:03 -07:00
NO_VALIDATOR_SANITY = 1 \
ci/testnet-deploy.sh -p demo-testnet-solana-com -C gce ${ GCE_ZONE_ARGS [@] } \
2019-07-09 13:39:55 -07:00
-t " $CHANNEL_OR_TAG " -n " $GCE_NODE_COUNT " -c 0 -P -u -f \
--skip-deploy-update \
--skip-remote-log-retrieval \
2019-04-29 21:38:03 -07:00
-a demo-testnet-solana-com \
2019-04-28 19:50:02 -07:00
${ skipCreate : +-e } \
2019-04-29 21:38:03 -07:00
${ maybeSkipStart : +-s } \
2019-04-26 22:08:58 -07:00
${ maybeStop : +-S } \
2019-06-06 12:49:46 -07:00
${ maybeDelete : +-D }
2019-04-29 21:38:03 -07:00
if [ [ -n $GCE_LOW_QUOTA_NODE_COUNT ] ] ; then
# shellcheck disable=SC2068
NO_VALIDATOR_SANITY = 1 \
ci/testnet-deploy.sh -p demo-testnet-solana-com2 -C gce ${ GCE_LOW_QUOTA_ZONE_ARGS [@] } \
2019-07-09 13:39:55 -07:00
-t " $CHANNEL_OR_TAG " -n " $GCE_LOW_QUOTA_NODE_COUNT " -c 0 -P -f -x \
--skip-deploy-update \
--skip-remote-log-retrieval \
2019-04-29 21:38:03 -07:00
${ skipCreate : +-e } \
${ skipStart : +-s } \
${ maybeStop : +-S } \
2019-06-06 12:49:46 -07:00
${ maybeDelete : +-D }
2019-04-26 22:08:58 -07:00
fi
2019-04-26 09:02:23 -07:00
)
; ;
2019-07-10 09:26:24 -07:00
tds)
2019-07-09 13:39:55 -07:00
(
set -x
2019-07-12 08:38:47 -07:00
2019-07-14 21:40:18 -07:00
# Allow cluster configuration to be overridden from env vars
if [ [ -z $TDS_ZONES ] ] ; then
TDS_ZONES = "us-west1-a,us-central1-a,europe-west4-a"
fi
GCE_CLOUD_ZONES = ( ) ; while read -r -d, ; do GCE_CLOUD_ZONES += ( " $REPLY " ) ; done <<< " ${ TDS_ZONES } , "
if [ [ -z $TDS_NODE_COUNT ] ] ; then
TDS_NODE_COUNT = "3"
fi
if [ [ -z $TDS_CLIENT_COUNT ] ] ; then
TDS_CLIENT_COUNT = "1"
fi
2019-07-14 19:27:49 -07:00
if [ [ -z $ENABLE_GPU ] ] ; then
maybeGpu = ( -G "--machine-type n1-standard-16 --accelerator count=2,type=nvidia-tesla-v100" )
elif [ [ $ENABLE_GPU = = skip ] ] ; then
maybeGpu = ( )
else
maybeGpu = ( -G " ${ ENABLE_GPU } " )
fi
if [ [ -z $HASHES_PER_TICK ] ] ; then
maybeHashesPerTick = "--hashes-per-tick auto"
elif [ [ $HASHES_PER_TICK = = skip ] ] ; then
maybeHashesPerTick = ""
else
maybeHashesPerTick = " --hashes-per-tick ${ HASHES_PER_TICK } "
fi
2019-07-19 11:51:38 -07:00
if [ [ -z $DISABLE_AIRDROPS ] ] ; then
DISABLE_AIRDROPS = "true"
fi
if [ [ $DISABLE_AIRDROPS = = true ] ] ; then
maybeDisableAirdrops = "--no-airdrop"
else
maybeDisableAirdrops = ""
fi
if [ [ -z $INTERNAL_NODES_STAKE_LAMPORTS ] ] ; then
maybeInternalNodesStakeLamports = "--internal-nodes-stake-lamports 1000000000000"
elif [ [ $INTERNAL_NODES_STAKE_LAMPORTS = = skip ] ] ; then
maybeInternalNodesStakeLamports = ""
else
maybeInternalNodesStakeLamports = " --internal-nodes-stake-lamports ${ INTERNAL_NODES_STAKE_LAMPORTS } "
fi
if [ [ -z $INTERNAL_NODES_LAMPORTS ] ] ; then
maybeInternalNodesLamports = "--internal-nodes-lamports 2000000000000"
elif [ [ $INTERNAL_NODES_LAMPORTS = = skip ] ] ; then
maybeInternalNodesLamports = ""
2019-07-14 19:27:49 -07:00
else
2019-07-19 11:51:38 -07:00
maybeInternalNodesLamports = " --internal-nodes-lamports ${ INTERNAL_NODES_LAMPORTS } "
2019-07-14 19:27:49 -07:00
fi
2019-07-12 08:38:47 -07:00
EXTERNAL_ACCOUNTS_FILE = /tmp/validator.yml
2019-07-14 19:27:49 -07:00
if [ [ -z $EXTERNAL_ACCOUNTS_FILE_URL ] ] ; then
2019-07-21 17:37:58 -07:00
EXTERNAL_ACCOUNTS_FILE_URL = https://raw.githubusercontent.com/solana-labs/tour-de-sol/master/validators/all.yml
2019-07-14 19:27:49 -07:00
wget ${ EXTERNAL_ACCOUNTS_FILE_URL } -O ${ EXTERNAL_ACCOUNTS_FILE }
maybeExternalAccountsFile = " --external-accounts-file ${ EXTERNAL_ACCOUNTS_FILE } "
elif [ [ $EXTERNAL_ACCOUNTS_FILE_URL = = skip ] ] ; then
maybeExternalAccountsFile = ""
else
wget ${ EXTERNAL_ACCOUNTS_FILE_URL } -O ${ EXTERNAL_ACCOUNTS_FILE }
maybeExternalAccountsFile = " --external-accounts-file ${ EXTERNAL_ACCOUNTS_FILE } "
fi
if [ [ -z $LAMPORTS ] ] ; then
maybeLamports = "--lamports 8589934592000000000"
elif [ [ $LAMPORTS = = skip ] ] ; then
maybeLamports = ""
else
maybeLamports = " --lamports ${ LAMPORTS } "
fi
if [ [ -z $ADDITIONAL_DISK_SIZE_GB ] ] ; then
maybeAdditionalDisk = "--fullnode-additional-disk-size-gb 32000"
elif [ [ $ADDITIONAL_DISK_SIZE_GB = = skip ] ] ; then
maybeAdditionalDisk = ""
else
maybeAdditionalDisk = " --fullnode-additional-disk-size-gb ${ ADDITIONAL_DISK_SIZE_GB } "
fi
2019-07-12 08:38:47 -07:00
# Multiple V100 GPUs are available in us-west1, us-central1 and europe-west4
2019-07-09 13:39:55 -07:00
# shellcheck disable=SC2068
# shellcheck disable=SC2086
NO_VALIDATOR_SANITY = 1 \
2019-07-12 08:38:47 -07:00
ci/testnet-deploy.sh -p tds-solana-com -C gce \
2019-07-14 19:27:49 -07:00
" ${ maybeGpu [@] } " \
2019-07-12 08:38:47 -07:00
-d pd-ssd \
2019-07-14 21:40:18 -07:00
${ GCE_CLOUD_ZONES [@]/#/-z } \
-t " $CHANNEL_OR_TAG " \
-n ${ TDS_NODE_COUNT } \
-c ${ TDS_CLIENT_COUNT } \
-P -u \
2019-07-09 15:45:46 -07:00
-a tds-solana-com --letsencrypt tds.solana.com \
2019-07-14 19:27:49 -07:00
${ maybeHashesPerTick } \
2019-07-09 13:39:55 -07:00
${ skipCreate : +-e } \
${ skipStart : +-s } \
${ maybeStop : +-S } \
${ maybeDelete : +-D } \
2019-07-19 11:51:38 -07:00
${ maybeDisableAirdrops } \
${ maybeInternalNodesStakeLamports } \
${ maybeInternalNodesLamports } \
2019-07-14 19:27:49 -07:00
${ maybeExternalAccountsFile } \
${ maybeLamports } \
${ maybeAdditionalDisk } \
2019-07-31 14:51:54 -07:00
--skip-deploy-update
2019-07-09 13:39:55 -07:00
)
; ;
2018-11-05 13:21:34 -08:00
*)
echo " Error: Invalid TESTNET= $TESTNET "
exit 1
; ;
esac
}
2019-04-26 10:22:23 -07:00
ENABLED_LOCKFILE = " ${ HOME } / ${ TESTNET } .is_enabled "
2019-04-26 09:02:23 -07:00
create-and-start( ) {
deploy create start
}
create( ) {
deploy create
}
start( ) {
2019-04-26 21:36:20 -07:00
deploy "" start
2019-04-26 09:02:23 -07:00
}
2018-11-05 13:21:34 -08:00
stop( ) {
2019-04-26 09:02:23 -07:00
deploy "" ""
}
delete( ) {
deploy "" "" "" delete
2019-04-26 10:22:23 -07:00
}
enable_testnet( ) {
touch " ${ ENABLED_LOCKFILE } "
2019-04-26 20:12:27 -07:00
echo " +++ $TESTNET now enabled "
2019-04-26 10:22:23 -07:00
}
disable_testnet( ) {
rm -f " ${ ENABLED_LOCKFILE } "
2019-04-26 20:12:27 -07:00
echo " +++ $TESTNET now disabled "
2019-04-26 10:22:23 -07:00
}
is_testnet_enabled( ) {
if [ [ ! -f ${ ENABLED_LOCKFILE } ] ] ; then
2019-04-26 21:36:20 -07:00
echo " +++ ${ TESTNET } is currently disabled. Enable ${ TESTNET } by running ci/testnet-manager.sh with \$TESTNET_OP=enable, then re-run with current settings. "
2019-04-26 10:22:23 -07:00
exit 0
fi
2018-11-05 13:21:34 -08:00
}
case $TESTNET_OP in
2019-04-26 10:22:23 -07:00
enable )
enable_testnet
; ;
disable)
disable_testnet
2019-04-26 20:12:27 -07:00
delete
2019-04-26 10:22:23 -07:00
; ;
2019-04-26 09:02:23 -07:00
create-and-start)
2019-04-26 10:22:23 -07:00
is_testnet_enabled
2019-04-26 09:02:23 -07:00
create-and-start
; ;
create)
2019-04-26 10:22:23 -07:00
is_testnet_enabled
2019-04-26 09:02:23 -07:00
create
2018-11-05 13:21:34 -08:00
; ;
start)
2019-04-26 10:22:23 -07:00
is_testnet_enabled
2018-11-05 13:21:34 -08:00
start
; ;
stop)
2019-04-26 10:22:23 -07:00
is_testnet_enabled
2018-11-05 13:21:34 -08:00
stop
; ;
2019-04-26 09:02:23 -07:00
sanity)
2019-04-26 10:22:23 -07:00
is_testnet_enabled
2019-04-26 09:02:23 -07:00
sanity
; ;
delete)
2019-04-26 10:22:23 -07:00
is_testnet_enabled
2019-04-26 09:02:23 -07:00
delete
; ;
2019-01-08 14:29:24 -08:00
update-or-restart)
2019-04-26 10:22:23 -07:00
is_testnet_enabled
2019-04-26 09:02:23 -07:00
if start; then
2019-01-08 14:29:24 -08:00
echo Update successful
else
echo "+++ Update failed, restarting the network"
$metricsWriteDatapoint "testnet-manager update-failure=1"
2019-04-26 10:22:23 -07:00
create-and-start
2019-01-08 14:29:24 -08:00
fi
; ;
2018-11-05 13:21:34 -08:00
sanity-or-restart)
2019-04-26 10:22:23 -07:00
is_testnet_enabled
2018-11-05 13:21:34 -08:00
if sanity; then
echo Pass
else
2019-01-08 14:29:24 -08:00
echo "+++ Sanity failed, updating the network"
2019-01-04 17:36:14 -08:00
$metricsWriteDatapoint "testnet-manager sanity-failure=1"
2019-04-15 09:50:52 -07:00
# TODO: Restore attempt to restart the cluster before recreating it
# See https://github.com/solana-labs/solana/issues/3774
if false; then
2019-04-26 09:02:23 -07:00
if start; then
2019-04-15 09:50:52 -07:00
echo Update successful
else
echo "+++ Update failed, restarting the network"
$metricsWriteDatapoint "testnet-manager update-failure=1"
2019-04-26 10:22:23 -07:00
create-and-start
2019-04-15 09:50:52 -07:00
fi
2019-01-08 14:29:24 -08:00
else
2019-04-26 10:22:23 -07:00
create-and-start
2019-01-08 14:29:24 -08:00
fi
2018-11-05 13:21:34 -08:00
fi
; ;
2019-04-26 09:02:23 -07:00
*)
echo " Error: Invalid TESTNET_OP= $TESTNET_OP "
exit 1
; ;
2018-11-05 13:21:34 -08:00
esac
echo --- fin
exit 0