github.com/inflatablewoman/deis@v1.0.1-0.20141111034523-a4511c46a6ce/contrib/rackspace/provision-rackspace-cluster.sh (about) 1 #!/usr/bin/env bash 2 # 3 # Usage: ./provision-rackspace-cluster.sh <key pair name> [flavor] [environment] 4 # 5 6 set -e 7 8 THIS_DIR=$(cd $(dirname $0); pwd) # absolute path 9 CONTRIB_DIR=$(dirname $THIS_DIR) 10 11 source $CONTRIB_DIR/utils.sh 12 13 if [ -z "$1" ]; then 14 echo_red 'Usage: provision-rackspace-cluster.sh <key pair name> [flavor] [environment]' 15 exit 1 16 fi 17 18 if [ -z "$2" ]; then 19 FLAVOR="performance1-2" 20 else 21 FLAVOR=$2 22 fi 23 24 if [ -z "$3" ]; then 25 ENV="production" 26 else 27 ENV=$3 28 fi 29 30 if ! which supernova > /dev/null; then 31 echo_red 'Please install the dependencies listed in the README and ensure they are in your $PATH.' 32 exit 1 33 fi 34 35 if ! supernova $ENV network-list|grep -q deis &>/dev/null; then 36 echo_yellow "Creating deis private network..." 37 supernova $ENV network-create deis 10.21.12.0/24 38 fi 39 40 NETWORK_ID=`supernova $ENV network-list|grep deis|awk -F"|" '{print $2}'|sed 's/^ *//g'` 41 42 if [ -z "$DEIS_NUM_INSTANCES" ]; then 43 DEIS_NUM_INSTANCES=3 44 fi 45 46 # check that the CoreOS user-data file is valid 47 $CONTRIB_DIR/util/check-user-data.sh 48 49 i=1 ; while [[ $i -le $DEIS_NUM_INSTANCES ]] ; do \ 50 echo_yellow "Provisioning deis-$i..." 51 # TODO: update to CoreOS 494.0.0 when it is available at Rackspace 52 # This image is CoreOS 490.0.0 53 supernova $ENV boot --image 3c7e97fa-a9f5-4b09-97aa-c94e66dbbfeb --flavor $FLAVOR --key-name $1 --user-data ../coreos/user-data --no-service-net --nic net-id=$NETWORK_ID --config-drive true deis-$i ; \ 54 ((i = i + 1)) ; \ 55 done 56 57 echo_green "Your Deis cluster has successfully deployed to Rackspace." 58 echo_green "Please continue to follow the instructions in the README."