-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathprovision-do-cluster.sh
More file actions
executable file
·56 lines (45 loc) · 1.4 KB
/
provision-do-cluster.sh
File metadata and controls
executable file
·56 lines (45 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
#
# Usage: ./provision-do-cluster.sh <REGION_ID> <IMAGE_ID> <SSH_ID> <SIZE>
#
set -e
listcontains() {
for i in $1; do
[[ $i = $2 ]] && return 0
done
return 1
}
THIS_DIR=$(cd $(dirname $0); pwd) # absolute path
CONTRIB_DIR=$(dirname $THIS_DIR)
source $CONTRIB_DIR/utils.sh
if [ -z "$4" ]; then
echo_red 'Usage: provision-do-cluster.sh <REGION_ID> <IMAGE_ID> <SSH_ID> <SIZE>'
exit 1
fi
# check for DO tools in $PATH
if ! which tugboat > /dev/null; then
echo_red 'Please install the tugboat gem and ensure it is in your $PATH.'
exit 1
fi
if [ -z "$DEIS_NUM_INSTANCES" ]; then
DEIS_NUM_INSTANCES=3
fi
regions_without_private_networking="1 2 3"
if listcontains "$regions_without_private_networking" "$1";
then
echo_red "Invalid region. Please supply a region with private networking support."
echo_red "Valid regions are:"
tugboat regions | grep -v "id: [$regions_without_private_networking])"
exit 1
fi
# check that the CoreOS user-data file is valid
$CONTRIB_DIR/util/check-user-data.sh
# launch the Deis cluster on DigitalOcean
i=1 ; while [[ $i -le $DEIS_NUM_INSTANCES ]] ; do \
NAME=deis-$i
echo_yellow "Provisioning ${NAME}..."
tugboat create $NAME -r $1 -i $2 -p true -k $3 -s $4
((i = i + 1)) ; \
done
echo_green "Your Deis cluster has successfully deployed to DigitalOcean."
echo_green "Please continue to follow the instructions in the README."