Add an OpenShift template.
This is based off of http://www.krishnaraman.net/openshift-origin-on-openstack/ This is the broker, the node is TODO (but simpler). Change-Id: I5d500a460e43de1172aa7636d9b94f590a979d97 Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
parent
9ce1d94553
commit
dfacb9f49b
140
templates/OpenShift.template
Normal file
140
templates/OpenShift.template
Normal file
@ -0,0 +1,140 @@
|
||||
{
|
||||
"AWSTemplateFormatVersion" : "2010-09-09",
|
||||
|
||||
"Description" : "OpenShift Template.",
|
||||
|
||||
"Parameters" : {
|
||||
|
||||
"KeyName" : {
|
||||
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances",
|
||||
"Type" : "String",
|
||||
"MinLength": "1",
|
||||
"MaxLength": "64",
|
||||
"AllowedPattern" : "[-_ a-zA-Z0-9]*",
|
||||
"ConstraintDescription" : "can contain only alphanumeric characters, spaces, dashes and underscores."
|
||||
},
|
||||
|
||||
"InstanceType" : {
|
||||
"Description" : "Instance type",
|
||||
"Type" : "String",
|
||||
"Default" : "m1.small",
|
||||
"AllowedValues" : [ "t1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m2.xlarge","m2.2xlarge","m2.4xlarge","c1.medium","c1.xlarge","cc1.4xlarge","cc2.8xlarge","cg1.4xlarge"],
|
||||
"ConstraintDescription" : "must be a valid EC2 instance type."
|
||||
}
|
||||
},
|
||||
|
||||
"Mappings" : {
|
||||
"AWSInstanceType2Arch" : {
|
||||
"t1.micro" : { "Arch" : "64" },
|
||||
"m1.small" : { "Arch" : "64" },
|
||||
"m1.medium" : { "Arch" : "64" },
|
||||
"m1.large" : { "Arch" : "64" },
|
||||
"m1.xlarge" : { "Arch" : "64" },
|
||||
"m2.xlarge" : { "Arch" : "64" },
|
||||
"m2.2xlarge" : { "Arch" : "64" },
|
||||
"m2.4xlarge" : { "Arch" : "64" },
|
||||
"c1.medium" : { "Arch" : "64" },
|
||||
"c1.xlarge" : { "Arch" : "64" },
|
||||
"cc1.4xlarge" : { "Arch" : "64HVM" },
|
||||
"cc2.8xlarge" : { "Arch" : "64HVM" },
|
||||
"cg1.4xlarge" : { "Arch" : "64HVM" }
|
||||
},
|
||||
|
||||
"AWSRegionArch2AMI" : {
|
||||
"us-east-1" : { "32" : "ami-31814f58", "64" : "ami-1b814f72", "64HVM" : "ami-0da96764" },
|
||||
"us-west-2" : { "32" : "ami-38fe7308", "64" : "ami-30fe7300", "64HVM" : "NOT_YET_SUPPORTED" },
|
||||
"us-west-1" : { "32" : "ami-11d68a54", "64" : "ami-1bd68a5e", "64HVM" : "NOT_YET_SUPPORTED" },
|
||||
"eu-west-1" : { "32" : "ami-973b06e3", "64" : "ami-953b06e1", "64HVM" : "NOT_YET_SUPPORTED" },
|
||||
"ap-southeast-1" : { "32" : "ami-b4b0cae6", "64" : "F16-x86_64-cfntools", "64HVM" : "NOT_YET_SUPPORTED" },
|
||||
"ap-northeast-1" : { "32" : "ami-0644f007", "64" : "ami-0a44f00b", "64HVM" : "NOT_YET_SUPPORTED" },
|
||||
"sa-east-1" : { "32" : "ami-3e3be423", "64" : "ami-3c3be421", "64HVM" : "NOT_YET_SUPPORTED" }
|
||||
}
|
||||
},
|
||||
|
||||
"Resources" : {
|
||||
|
||||
"OpenShiftBrokerServer": {
|
||||
"Type": "AWS::EC2::Instance",
|
||||
"Metadata" : {
|
||||
"AWS::CloudFormation::Init" : {
|
||||
"config" : {
|
||||
"packages" : {
|
||||
"yum" : {
|
||||
"ntp" : [],
|
||||
"git" : [],
|
||||
"vim" : [],
|
||||
"emacs" : [],
|
||||
"wget" : [],
|
||||
"tig" : [],
|
||||
"mock" : [],
|
||||
"createrepo" : [],
|
||||
"tito" : [],
|
||||
"fedora-kickstarts" : [],
|
||||
"livecd-tools" : [],
|
||||
"ruby" : [],
|
||||
"rubygems" : [],
|
||||
"rubygem-rake" : [],
|
||||
"java-1.6.0-openjdk" : [],
|
||||
"jpackage-utils" : [],
|
||||
"java-1.6.0-openjdk-devel" : []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Properties": {
|
||||
"ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" },
|
||||
{ "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } ] },
|
||||
"InstanceType" : { "Ref" : "InstanceType" },
|
||||
"KeyName" : { "Ref" : "KeyName" },
|
||||
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
|
||||
"#!/bin/bash -v\n",
|
||||
"# Helper function\n",
|
||||
"function error_exit\n",
|
||||
"{\n",
|
||||
" /opt/aws/bin/cfn-signal -e 1 -r \"$1\" '", { "Ref" : "WaitHandle" }, "'\n",
|
||||
" exit 1\n",
|
||||
"}\n",
|
||||
|
||||
"/opt/aws/bin/cfn-init -s ", { "Ref" : "AWS::StackName" }, " -r OpenShiftBrokerServer ",
|
||||
" --access-key Ref_HostKeys",
|
||||
" --secret-key Fn_GetAtt_HostKeys_SecretAccessKey",
|
||||
" --region ", { "Ref" : "AWS::Region" }, " || error_exit 'Failed to run cfn-init'\n",
|
||||
|
||||
"useradd builder\n",
|
||||
"usermod -a -G mock builder\n",
|
||||
"su builder -c 'cd /home/builder ; git clone git://github.com/openshift/crankcase.git /home/builder/crankcase'\n",
|
||||
"su builder -c 'cd /home/builder/crankcase ; git checkout features/mcollective'\n",
|
||||
"cd /home/builder/crankcase/build ; rake build_setup\n",
|
||||
"cd /home/builder/crankcase/build ; rake build\n",
|
||||
"cd /home/builder/crankcase/build ; rake install_broker || error_exit 'Failed to install broker'\n",
|
||||
|
||||
"ss-setup-broker\n",
|
||||
|
||||
"# All is well so signal success\n",
|
||||
"/opt/aws/bin/cfn-signal -e 0 -r \"Rails application setup complete\" '", { "Ref" : "WaitHandle" }, "'\n"
|
||||
]]}}
|
||||
}
|
||||
},
|
||||
|
||||
"WaitHandle" : {
|
||||
"Type" : "AWS::CloudFormation::WaitConditionHandle"
|
||||
},
|
||||
|
||||
"WaitCondition" : {
|
||||
"Type" : "AWS::CloudFormation::WaitCondition",
|
||||
"DependsOn" : "OpenShiftBrokerServer",
|
||||
"Properties" : {
|
||||
"Handle" : {"Ref" : "WaitHandle"},
|
||||
"Timeout" : "1500"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"Outputs" : {
|
||||
"WebsiteURL" : {
|
||||
"Value" : { "Fn::Join" : ["", ["http://", { "Fn::GetAtt" : [ "OpenShiftBrokerServer", "PublicIp" ]}, ":3000" ]] },
|
||||
"Description" : "URL for newly created Rails application"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user