21
21
"Default" : "c1.medium",
22
22
"ConstraintDescription" : "must be a valid EC2 instance type."
23
23
},
24
-
25
- "ApplicationName" : {
26
- "Description" : "CNAME for the application",
27
- "Type" : "String",
28
- "Default" : "target"
29
- },
30
-
31
- "HostedZone" : {
32
- "Description" : "Domain to use",
33
- "Type" : "String",
34
- "Default" : "devopscloud.com"
35
- },
36
-
37
- "EnvironmentType" : {
38
- "Description" : "Mode for rails to run in",
39
- "Type" : "String",
40
- "Default" : "development"
41
- },
42
24
43
25
"PrivateBucket" : {
44
26
"Description" : "S3 bucket for storing credentials",
110
92
}
111
93
},
112
94
113
- "Domain" : {
114
- "Type" : "AWS::Route53::RecordSetGroup",
115
- "Properties" : {
116
- "HostedZoneName" : { "Fn::Join" : [ "", [ {"Ref" : "HostedZone"}, "." ]]},
117
- "RecordSets" : [
118
- {
119
- "Name" : { "Fn::Join" : ["", [ { "Ref" : "ApplicationName" }, ".", { "Ref" : "HostedZone" }, "." ]]},
120
- "Type" : "A",
121
- "TTL" : "900",
122
- "ResourceRecords" : [ { "Ref" : "IPAddress" } ]
123
- }]
124
- }
125
- },
126
-
127
95
"WebServer": {
128
96
"Type": "AWS::EC2::Instance",
129
97
"DependsOn" : "PrivateBucketPolicy",
132
100
"config" : {
133
101
"packages" : {
134
102
"yum" : {
135
- "puppet" : []
103
+ "mysql-server" : [],
104
+ "mysql" : [],
105
+ "ant" : [],
106
+ "tomcat6" : []
136
107
}
137
108
},
138
109
139
- "sources" : {
140
- "/home/ec2-user/" : { "Fn::Join" : ["", ["https://s3.amazonaws.com/stelligentlabs/puppet.tar.gz"]]}
141
- },
142
-
143
110
"files" : {
144
111
"/home/ec2-user/id_rsa.pub" : {
145
112
"source" : { "Fn::Join" : ["", ["https://s3.amazonaws.com/", { "Ref" : "PrivateBucket" }, "/id_rsa.pub"]]},
146
113
"mode" : "000500",
147
114
"owner" : "root",
148
115
"group" : "root",
149
116
"authentication" : "S3AccessCreds"
150
- },
151
- "/home/ec2-user/nodes.pp" : {
152
- "content" : { "Fn::Join" : ["", [
153
- "node default {\n",
154
- "include system\n",
155
- "include bundler\n",
156
- "include passenger\n",
157
- "include sqlite\n",
158
- "include git\n",
159
- "include httpd\n",
160
- "}"
161
- ]]},
162
- "mode" : "000500",
163
- "owner" : "root",
164
- "group" : "root"
165
- },
166
-
167
-
168
- "/etc/httpd/conf/virtualhosts" : {
169
- "content" : { "Fn::Join" : ["", [
170
- "NameVirtualHost *:80\n",
171
- "<VirtualHost *:80>\n",
172
- "ServerName ", { "Fn::Join" : [ ".", [ { "Ref" : "ApplicationName" }, { "Ref" : "HostedZone" }]]}, "\n",
173
- "ServerAlias ", { "Fn::Join" : [ ".", [ { "Ref" : "ApplicationName" }, { "Ref" : "HostedZone" }]]}, "\n",
174
- "RailsEnv ", {"Ref" : "EnvironmentType"}, "\n",
175
- "DocumentRoot /var/www/rails/public\n",
176
- "<Directory /var/www/rails/public>\n",
177
- "AllowOverride all\n",
178
- "Options -MultiViews\n",
179
- "</Directory>\n",
180
- "</VirtualHost>\n"
181
- ]]},
182
- "mode" : "000500",
183
- "owner" : "root",
184
- "group" : "root"
185
- },
186
- "/etc/httpd/conf/passenger" : {
187
- "content" : { "Fn::Join" : ["", [
188
- "LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.13/ext/apache2/mod_passenger.so\n",
189
- "PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.13\n",
190
- "PassengerRuby /usr/bin/ruby\n"
191
- ]]},
192
- "mode" : "000500",
193
- "owner" : "root",
194
- "group" : "root"
195
- }
117
+ }
196
118
}
197
119
}
198
120
},
224
146
" --secret-key ", {"Fn::GetAtt": ["HostKeys", "SecretAccessKey"]},
225
147
" --region ", { "Ref" : "AWS::Region" }, " || error_exit 'Failed to run cfn-init'\n",
226
148
227
- "# Build environment using Puppet\n",
228
- "puppet apply --modulepath=/home/ec2-user/modules /home/ec2-user/nodes.pp\n",
229
-
230
- "# Add in virtual hosts config\n",
231
- "cat /etc/httpd/conf/passenger >> /etc/httpd/conf/httpd.conf\n",
232
- "cat /etc/httpd/conf/virtualhosts >> /etc/httpd/conf/httpd.conf\n",
149
+ "sudo service mysqld start\n",
150
+ "/usr/bin/mysqladmin -u root password 'mysql'\n",
151
+ "sudo service tomcat6 start \n",
233
152
234
153
"# Add Public key for passwordless authentication from Jenkins Instance\n",
235
154
"cat /home/ec2-user/id_rsa.pub >> /home/ec2-user/.ssh/authorized_keys\n",
244
163
]]}}
245
164
}
246
165
},
247
-
248
- "IPAddress" : {
249
- "Type" : "AWS::EC2::EIP"
250
- },
251
-
252
- "IPAssoc" : {
253
- "Type" : "AWS::EC2::EIPAssociation",
254
- "Properties" : {
255
- "InstanceId" : { "Ref" : "WebServer" },
256
- "EIP" : { "Ref" : "IPAddress" }
257
- }
258
- },
259
166
260
167
"FrontendGroup" : {
261
168
"Type" : "AWS::EC2::SecurityGroup",
291
198
},
292
199
"ArtifactBucket" : {
293
200
"Value" : { "Ref" : "PublicBucket" }
294
- },
295
- "Domain" : {
296
- "Value" : { "Fn::Join" : ["", [{ "Ref" : "ApplicationName" }, ".", { "Ref" : "HostedZone" }]] },
297
- "Description" : "Full domain"
298
- },
299
- "SampleApp" : {
300
- "Value" : { "Fn::Join" : ["", ["http://", { "Ref" : "ApplicationName" }, ".", { "Ref" : "HostedZone" }, "/"]] },
301
- "Description" : "URL for newly created Sample App"
302
201
}
303
202
}
304
203
}
0 commit comments