forked from svpmtrust/autotest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontest_setup.cf
More file actions
200 lines (193 loc) · 6.63 KB
/
contest_setup.cf
File metadata and controls
200 lines (193 loc) · 6.63 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
{
"Description" : "Template to start the test setup that includes git server, test co-ordinator and server",
"Parameters" : {
"InstanceType" : {
"Description" : "What type of instance to be used. As the load increases, better disk IO will be needed",
"Type" : "String",
"AllowedValues" : [
"m3.medium", "m3.large",
"m3.xlarge","m3.2xlarge",
"c3.2xlarge", "c3.xlarge"
],
"Default": "m3.large",
"ConstraintDescription" : "must be a valid EC2 instance type."
},
"KeyName" : {
"Description" : "What key allows SSH access",
"Type" : "String"
},
"SSHLocation" : {
"Description" : "Which IP addresses are allowed to ssh. Note: Default is very unsecure",
"Type": "String",
"Default": "0.0.0.0/0",
"AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
"ConstraintDescription": "Enter a valid IP in x.x.x.x/x CIDR form ."
},
"Zone" : {
"Description" : "Which AWS zone to use",
"Type": "String",
"ConstraintDescription": "Must be a valid zone.",
"AllowedValues" : ["ap-southeast-1b"],
"Default": "ap-southeast-1b"
},
"DBHost" : {
"Description" : "Database location",
"Type": "String"
},
"DBName": {
"Description": "Database Name",
"Type": "String",
"Default": "autotest"
},
"ContestName": {
"Description": "Name of the contest",
"Type": "String",
"AllowedPattern": "\\w+"
}
},
"Mappings" : {
"InstArchMap" : {
"m3.xlarge" : { "Arch" : "64" },
"m3.large" : { "Arch" : "64" },
"m3.2xlarge" : { "Arch" : "64" },
"m3.medium" : { "Arch" : "64" },
"m3.small" : { "Arch" : "64" },
"c3.xlarge" : { "Arch" : "64" },
"c3.2xlarge" : { "Arch" : "64" }
},
"RegionAMIMap" : {
"ap-southeast-1" : {
"64" : "ami-ca381398",
"HVM": "ami-ca381398" }
}
},
"Resources" : {
"GitAccess": {
"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupDescription" : "Enable SSH access to select IPs and web access to all",
"SecurityGroupIngress" : [
{
"IpProtocol" : "tcp",
"FromPort" : "22",
"ToPort" : "22",
"CidrIp" : { "Ref" : "SSHLocation"}
},
{
"IpProtocol" : "tcp",
"FromPort" : "80",
"ToPort" : "80",
"CidrIp" : "0.0.0.0/0"
}
]
}
},
"SSHAccess": {
"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupDescription" : "Enable SSH access to select IPs and web access to all",
"SecurityGroupIngress" : [
{
"IpProtocol" : "tcp",
"FromPort" : "22",
"ToPort" : "22",
"CidrIp" : { "Ref" : "SSHLocation"}
}
]
}
},
"GitServer": {
"Type": "AWS::EC2::Instance",
"Properties": {
"AvailabilityZone": { "Ref": "Zone" },
"InstanceType": { "Ref": "InstanceType" },
"KeyName": { "Ref": "KeyName" },
"Tags" : [
{"Key" : "Name",
"Value" : {"Fn::Join":["", [
"GitServer - ", { "Ref": "ContestName"} ]] }
}
],
"Monitoring": true,
"ImageId" : { "Fn::FindInMap" : [ "RegionAMIMap", { "Ref" : "AWS::Region" },
{ "Fn::FindInMap" : [ "InstArchMap", { "Ref" : "InstanceType" },
"Arch" ] } ] },
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["",[
"#!/bin/bash -ex\n",
"sudo apt-get update\n",
"sudo apt-get install -y git\n",
"cd ~ubuntu\n",
"git clone http://github.com/svpmtrust/autotest.git autotest\n",
"cd autotest\n",
"bash gitserver/bootstrap.sh `pwd` ", {"Ref":"DBHost"}, " ", {"Ref":"ContestName"}
]]}
},
"SecurityGroups" : [ { "Ref" : "GitAccess" } ]
}
},
"TestCoordinator": {
"Type": "AWS::EC2::Instance",
"Properties": {
"AvailabilityZone": { "Ref": "Zone" },
"InstanceType": { "Ref": "InstanceType" },
"KeyName": { "Ref": "KeyName" },
"Tags" : [
{"Key" : "Name",
"Value" : {"Fn::Join":["", [
"TestCoordinator - ", { "Ref": "ContestName"} ]] }
}
],
"Monitoring": true,
"ImageId" : { "Fn::FindInMap" : [ "RegionAMIMap", { "Ref" : "AWS::Region" },
{ "Fn::FindInMap" : [ "InstArchMap", { "Ref" : "InstanceType" },
"Arch" ] } ] },
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["",[
"#!/bin/bash -ex\n",
"sudo apt-get update\n",
"sudo apt-get install -y git\n",
"cd ~ubuntu\n",
"git clone http://github.com/svpmtrust/autotest.git autotest\n",
"cd autotest\n",
"bash testcoordinator/provision.sh `pwd` ", {"Ref":"DBHost"}," ", {"Ref":"ContestName"}, " ", { "Fn::GetAtt" : [ "GitServer", "PublicDnsName" ]}
]]}
},
"SecurityGroups" : [ { "Ref" : "SSHAccess" } ]
}
},
"TestServer": {
"Type": "AWS::EC2::Instance",
"Properties": {
"AvailabilityZone": { "Ref": "Zone" },
"InstanceType": { "Ref": "InstanceType" },
"KeyName": { "Ref": "KeyName" },
"Tags" : [
{"Key" : "Name",
"Value" : {"Fn::Join":["", [
"TestServer - ", { "Ref": "ContestName"} ]] }
}
],
"Monitoring": true,
"ImageId" : { "Fn::FindInMap" : [ "RegionAMIMap", { "Ref" : "AWS::Region" },
{ "Fn::FindInMap" : [ "InstArchMap", { "Ref" : "InstanceType" },
"Arch" ] } ] },
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["",[
"#!/bin/bash -ex\n",
"sudo apt-get update\n",
"sudo apt-get install -y git\n",
"cd ~ubuntu\n",
"git clone http://github.com/svpmtrust/autotest.git autotest\n",
"cd autotest\n",
"bash testserver/provision.sh `pwd` ", {"Ref":"DBHost"}," ", {"Ref":"ContestName"}, " ", { "Fn::GetAtt" : [ "GitServer", "PublicDnsName" ]}
]]}
},
"SecurityGroups" : [ { "Ref" : "SSHAccess" } ]
}
}
},
"Outputs" : {
"GitServerAddress" : {
"Description" : "Location of git server to use",
"Value" : { "Fn::GetAtt" : [ "GitServer", "PublicDnsName" ]}
}
}
}