aboutsummaryrefslogtreecommitdiff
path: root/control
diff options
context:
space:
mode:
authorPaul Sokolovsky <paul.sokolovsky@linaro.org>2011-06-21 18:47:36 +0300
committerPaul Sokolovsky <paul.sokolovsky@linaro.org>2011-06-21 18:47:36 +0300
commit1be0a03a676811033395012ef4c2434d091b15ea (patch)
treefa6b90897a72751b2e4d6ed69163869461124f28 /control
parentfdbb91f82b071db8ddfd2e7f8bc8ca156086dd1a (diff)
Factor out EC2 parameters used to create master node, document them in-place.
Split EC2 params to sandbox-create.conf, add in-place docs there, to not crowd README. Still, tweak README for better readability.
Diffstat (limited to 'control')
-rwxr-xr-xcontrol/sandbox-create3
-rw-r--r--control/sandbox-create.conf31
-rwxr-xr-xcontrol/start-instance13
3 files changed, 39 insertions, 8 deletions
diff --git a/control/sandbox-create b/control/sandbox-create
index 6019ec0..7492f58 100755
--- a/control/sandbox-create
+++ b/control/sandbox-create
@@ -21,9 +21,10 @@ if [ -z "$EC2_PRIVATE_KEY" -o -z "$EC2_CERT" ]; then
exit 1
fi
+. sandbox-create.conf
. start-instance --include
-ec2_start_instance $1
+ec2_start_instance "$1" "$AMI" "$INSTANCE_TYPE" "$SECURITY_GROUPS"
echo "Instance ID: $instance_id"
echo "Hostname: $instance_hostname"
./setup-control-node-via-ssh $instance_hostname
diff --git a/control/sandbox-create.conf b/control/sandbox-create.conf
new file mode 100644
index 0000000..a6f89ee
--- /dev/null
+++ b/control/sandbox-create.conf
@@ -0,0 +1,31 @@
+# API name of EC2 instance type to use for master node
+# See http://aws.amazon.com/ec2/instance-types/
+# Default: m1.small, enough to run 5-6 build slaves concurrently
+INSTANCE_TYPE="m1.small"
+
+# Amazon Image (AMI) id to use for master node, should match instance type above
+# See http://uec-images.ubuntu.com/
+# Default: ami-e2af508b, Ubuntu 11.04 (Natty) 32bit, instance store at us-east-1 region
+AMI=ami-e2af508b
+
+# EC2 Security groups to run master node with
+# Default: git-mirror, jenkins-master which corresponds to servers running on the node
+# git-mirror should allow connections TCP connections on ports:
+# * 22 from outside (for# install and maintenance)
+# * 8080 from machines of your account/default group (for mirror requests from slave,
+# jenkins slave implicitly have default group (Jenkins limitation)).
+# jenkins-master should allow TCP connections on ports:
+# * 22 from outside (for install/maintenance)
+# * 443 from outside (for web frontend).
+#
+# You can configure these groups by:
+# 1. Asking your EC2 admin (recommended)
+# 2. Via Amazon Web Console or other similar web frontend
+# 3. Via command line:
+# ec2-add-group git-mirror -d "Cloud Buildd git mirror"
+# ec2-add-group jenkins-master -d "Cloud Buildd Jenkins master"
+# ec2-authorize git-mirror -p 22
+# ec2-authorize git-mirror -p 8080 -u <Your EC2 numeric account id> -o default
+# ec2-authorize jenkins-master -p 22
+# ec2-authorize jenkins-mirror -p 443
+SECURITY_GROUPS="-g git-mirror -g jenkins-master"
diff --git a/control/start-instance b/control/start-instance
index a6be823..9b337a5 100755
--- a/control/start-instance
+++ b/control/start-instance
@@ -10,14 +10,13 @@
# Script/functions to create EC2 instance and make sure it's running
#
-AMI=ami-e2af508b
-TYPE="-t m1.small"
-SEC_GROUPS="-g git-mirror -g jenkins-master"
-
function ec2_create_instance() {
local keypair=$1
+ local ami=$2
+ local instance_type=$3
+ local security_groups="$4"
echo "Creating instance..."
- local cmd="ec2-run-instances $AMI -k $keypair $TYPE $SEC_GROUPS"
+ local cmd="ec2-run-instances $ami -k $keypair -t $instance_type $security_groups"
# echo $cmd
instance_id=`$cmd | grep ^INSTANCE | cut -f2`
if [ -z "$instance_id" ]; then
@@ -64,7 +63,7 @@ function ec2_wait_till_booted() {
}
function ec2_start_instance() {
- ec2_create_instance $*
+ ec2_create_instance "$1" "$2" "$3" "$4"
ec2_wait_till_running $instance_id
if ! ec2_wait_till_booted $instance_hostname; then
echo "Error starting instance"
@@ -75,7 +74,7 @@ function ec2_start_instance() {
if [ "$1" != "--include" ]; then
if [ "$1" == "" ]; then
- echo "Usage: $0 <ec2 keypair name>"
+ echo "Usage: $0 <ec2 keypair name> <AMI> <instance type> <security groups>"
exit
fi