lono 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/lono/dsl.rb +7 -0
- data/lib/lono/version.rb +1 -1
- data/lono.gemspec +2 -2
- data/spec/project/config/lono/bootstrap_app.sh +8 -0
- data/spec/project/templates/app.json.erb +400 -413
- metadata +8 -4
data/README.md
CHANGED
data/lib/lono/dsl.rb
CHANGED
@@ -45,6 +45,7 @@ module Lono
|
|
45
45
|
|
46
46
|
class Template
|
47
47
|
include ERB::Util
|
48
|
+
|
48
49
|
def initialize(name, block, options={})
|
49
50
|
@name = name
|
50
51
|
@block = block
|
@@ -67,5 +68,11 @@ module Lono
|
|
67
68
|
instance_variable_set("@#{var}", value)
|
68
69
|
end
|
69
70
|
end
|
71
|
+
|
72
|
+
def user_data(path)
|
73
|
+
path = "#{@options[:project_root]}/config/lono/#{path}"
|
74
|
+
template = IO.read(path)
|
75
|
+
ERB.new(template).result(binding).split("\n").to_json
|
76
|
+
end
|
70
77
|
end
|
71
78
|
end
|
data/lib/lono/version.rb
CHANGED
data/lono.gemspec
CHANGED
@@ -4,8 +4,8 @@ require File.expand_path('../lib/lono/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Tung Nguyen"]
|
6
6
|
gem.email = ["tongueroo@gmail.com"]
|
7
|
-
gem.description = %q{Lono generates
|
8
|
-
gem.summary = %q{Lono generates
|
7
|
+
gem.description = %q{Lono is a Cloud Formation Template ruby generator. Lono generates Cloud Formation templates based on ERB templates.}
|
8
|
+
gem.summary = %q{Lono is a Cloud Formation Template ruby generator. Lono generates Cloud Formation templates based on ERB templates.}
|
9
9
|
gem.homepage = ""
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/bin/bash -lexv
|
2
|
+
<% stack_name = "#{@env}-#{@app}-#{@role}" %>
|
3
|
+
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
|
4
|
+
echo <%= stack_name %> > /tmp/stack_name
|
5
|
+
set +e
|
6
|
+
rvm use system --default
|
7
|
+
set -e
|
8
|
+
cat /proc/uptime | cut -f1 -d'.' > /tmp/time-to-boot
|
@@ -1,424 +1,411 @@
|
|
1
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
|
-
|
2
|
+
"AWSTemplateFormatVersion": "2010-09-09",
|
3
|
+
"Description": "<%= @app.capitalize %> Stack",
|
4
|
+
"Mappings": {
|
5
|
+
"AWSInstanceType2Arch": {
|
6
|
+
"c1.medium": {
|
7
|
+
"Arch": "64"
|
8
|
+
},
|
9
|
+
"c1.xlarge": {
|
10
|
+
"Arch": "64"
|
11
|
+
},
|
12
|
+
"cc1.4xlarge": {
|
13
|
+
"Arch": "64"
|
14
|
+
},
|
15
|
+
"cc2.8xlarge": {
|
16
|
+
"Arch": "64"
|
17
|
+
},
|
18
|
+
"cg1.4xlarge": {
|
19
|
+
"Arch": "64"
|
20
|
+
},
|
21
|
+
"m1.large": {
|
22
|
+
"Arch": "64"
|
23
|
+
},
|
24
|
+
"m1.medium": {
|
25
|
+
"Arch": "64"
|
26
|
+
},
|
27
|
+
"m1.small": {
|
28
|
+
"Arch": "64"
|
29
|
+
},
|
30
|
+
"m1.xlarge": {
|
31
|
+
"Arch": "64"
|
32
|
+
},
|
33
|
+
"m2.2xlarge": {
|
34
|
+
"Arch": "64"
|
35
|
+
},
|
36
|
+
"m2.4xlarge": {
|
37
|
+
"Arch": "64"
|
38
|
+
},
|
39
|
+
"m2.xlarge": {
|
40
|
+
"Arch": "64"
|
41
|
+
},
|
42
|
+
"t1.micro": {
|
43
|
+
"Arch": "64"
|
44
|
+
}
|
45
|
+
},
|
46
|
+
"AWSRegionArch2AMI": {
|
47
|
+
"us-east-1": {
|
48
|
+
"32": "",
|
49
|
+
"64": "<%= @ami %>"
|
50
|
+
},
|
51
|
+
"us-west-1": {
|
52
|
+
"32": "",
|
53
|
+
"64": ""
|
54
|
+
}
|
55
|
+
}
|
56
|
+
},
|
57
|
+
"Outputs": {
|
58
|
+
"ELBHostname": {
|
59
|
+
"Description": "The URL of the website",
|
60
|
+
"Value": {
|
61
|
+
"Fn::Join": [
|
62
|
+
"",
|
63
|
+
[
|
64
|
+
"http://",
|
65
|
+
{
|
66
|
+
"Fn::GetAtt": [
|
67
|
+
"elb",
|
68
|
+
"DNSName"
|
69
|
+
]
|
44
70
|
}
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
71
|
+
]
|
72
|
+
]
|
73
|
+
}
|
74
|
+
}
|
75
|
+
},
|
76
|
+
"Parameters": {
|
77
|
+
"Application": {
|
78
|
+
"Default": "<%= @app %>",
|
79
|
+
"Description": "Application name",
|
80
|
+
"Type": "String"
|
81
|
+
},
|
82
|
+
"Environment": {
|
83
|
+
"Default": "<%= @env %>",
|
84
|
+
"Description": "stag, prod etc",
|
85
|
+
"Type": "String"
|
86
|
+
},
|
87
|
+
"InstanceType": {
|
88
|
+
"AllowedValues": [
|
89
|
+
"t1.micro",
|
90
|
+
"m1.small",
|
91
|
+
"m1.medium",
|
92
|
+
"m1.large",
|
93
|
+
"m1.xlarge",
|
94
|
+
"m2.xlarge",
|
95
|
+
"m2.2xlarge",
|
96
|
+
"m2.4xlarge",
|
97
|
+
"c1.medium",
|
98
|
+
"c1.xlarge",
|
99
|
+
"cc1.4xlarge",
|
100
|
+
"cc2.8xlarge",
|
101
|
+
"cg1.4xlarge"
|
102
|
+
],
|
103
|
+
"ConstraintDescription": "must be a valid EC2 instance type.",
|
104
|
+
"Default": "<%= @instance_type %>",
|
105
|
+
"Description": "WebServer EC2 instance type",
|
106
|
+
"Type": "String"
|
107
|
+
},
|
108
|
+
"KeyName": {
|
109
|
+
"Default": "default",
|
110
|
+
"Description": "The EC2 Key Pair to allow SSH access to the instances",
|
111
|
+
"Type": "String"
|
112
|
+
},
|
113
|
+
"Role": {
|
114
|
+
"Default": "<%= @role %>",
|
115
|
+
"Description": "redis, psql, app, etc",
|
116
|
+
"Type": "String"
|
117
|
+
},
|
118
|
+
"StackNumber": {
|
119
|
+
"Description": "s1, s2, s3, etc",
|
120
|
+
"Type": "String"
|
121
|
+
},
|
122
|
+
"WebServerPort": {
|
123
|
+
"Default": "<%= @port %>",
|
124
|
+
"Description": "The TCP port for the Web Server",
|
125
|
+
"Type": "Number"
|
126
|
+
}
|
127
|
+
},
|
128
|
+
"Resources": {
|
129
|
+
"CPUAlarmHigh": {
|
130
|
+
"Properties": {
|
131
|
+
"AlarmActions": [
|
132
|
+
{
|
133
|
+
"Ref": "WebServerScaleUpPolicy"
|
134
|
+
}
|
135
|
+
],
|
136
|
+
"AlarmDescription": "Scale-up if CPU > <%= @high_threshold %>% for <%= @high_mins %> minutes",
|
137
|
+
"ComparisonOperator": "GreaterThanThreshold",
|
138
|
+
"Dimensions": [
|
139
|
+
{
|
140
|
+
"Name": "AutoScalingGroupName",
|
141
|
+
"Value": {
|
142
|
+
"Ref": "WebServerGroup"
|
54
143
|
}
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
"
|
59
|
-
|
144
|
+
}
|
145
|
+
],
|
146
|
+
"EvaluationPeriods": "<%= @high_periods %>",
|
147
|
+
"MetricName": "CPUUtilization",
|
148
|
+
"Namespace": "AWS/EC2",
|
149
|
+
"Period": "60",
|
150
|
+
"Statistic": "Average",
|
151
|
+
"Threshold": "<%= @high_threshold %>"
|
152
|
+
},
|
153
|
+
"Type": "AWS::CloudWatch::Alarm"
|
154
|
+
},
|
155
|
+
"CPUAlarmLow": {
|
156
|
+
"Properties": {
|
157
|
+
"AlarmActions": [
|
158
|
+
{
|
159
|
+
"Ref": "WebServerScaleDownPolicy"
|
160
|
+
}
|
161
|
+
],
|
162
|
+
"AlarmDescription": "Scale-down if CPU < <%= @low_threshold %>% for 10 minutes",
|
163
|
+
"ComparisonOperator": "LessThanThreshold",
|
164
|
+
"Dimensions": [
|
165
|
+
{
|
166
|
+
"Name": "AutoScalingGroupName",
|
60
167
|
"Value": {
|
61
|
-
|
62
|
-
"",
|
63
|
-
[
|
64
|
-
"http://",
|
65
|
-
{
|
66
|
-
"Fn::GetAtt": [
|
67
|
-
"elb",
|
68
|
-
"DNSName"
|
69
|
-
]
|
70
|
-
}
|
71
|
-
]
|
72
|
-
]
|
168
|
+
"Ref": "WebServerGroup"
|
73
169
|
}
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
"
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
170
|
+
}
|
171
|
+
],
|
172
|
+
"EvaluationPeriods": "<%= @low_periods %>",
|
173
|
+
"MetricName": "CPUUtilization",
|
174
|
+
"Namespace": "AWS/EC2",
|
175
|
+
"Period": "60",
|
176
|
+
"Statistic": "Average",
|
177
|
+
"Threshold": "<%= @low_threshold %>"
|
178
|
+
},
|
179
|
+
"Type": "AWS::CloudWatch::Alarm"
|
180
|
+
},
|
181
|
+
"HostRecord": {
|
182
|
+
"Properties": {
|
183
|
+
"Comment": "DNS name for my stack.",
|
184
|
+
"HostedZoneName": "mydomain.net.",
|
185
|
+
"Name": {
|
186
|
+
"Fn::Join": [
|
187
|
+
"",
|
188
|
+
[
|
189
|
+
{
|
190
|
+
"Ref": "AWS::StackName"
|
191
|
+
},
|
192
|
+
".mydomain.net"
|
193
|
+
]
|
194
|
+
]
|
195
|
+
},
|
196
|
+
"ResourceRecords": [
|
197
|
+
{
|
198
|
+
"Fn::GetAtt": [
|
199
|
+
"elb",
|
200
|
+
"DNSName"
|
201
|
+
]
|
202
|
+
}
|
203
|
+
],
|
204
|
+
"TTL": "60",
|
205
|
+
"Type": "CNAME"
|
206
|
+
},
|
207
|
+
"Type": "AWS::Route53::RecordSet"
|
208
|
+
},
|
209
|
+
"LaunchConfig": {
|
210
|
+
"Properties": {
|
211
|
+
"BlockDeviceMappings": [
|
212
|
+
{
|
213
|
+
"DeviceName": "/dev/sdb",
|
214
|
+
"VirtualName": "ephemeral0"
|
215
|
+
}
|
216
|
+
],
|
217
|
+
"ImageId": {
|
218
|
+
"Fn::FindInMap": [
|
219
|
+
"AWSRegionArch2AMI",
|
220
|
+
{
|
221
|
+
"Ref": "AWS::Region"
|
222
|
+
},
|
223
|
+
{
|
224
|
+
"Fn::FindInMap": [
|
225
|
+
"AWSInstanceType2Arch",
|
226
|
+
{
|
227
|
+
"Ref": "InstanceType"
|
228
|
+
},
|
229
|
+
"Arch"
|
230
|
+
]
|
231
|
+
}
|
232
|
+
]
|
233
|
+
},
|
87
234
|
"InstanceType": {
|
88
|
-
|
89
|
-
|
90
|
-
"m1.small",
|
91
|
-
"m1.medium",
|
92
|
-
"m1.large",
|
93
|
-
"m1.xlarge",
|
94
|
-
"m2.xlarge",
|
95
|
-
"m2.2xlarge",
|
96
|
-
"m2.4xlarge",
|
97
|
-
"c1.medium",
|
98
|
-
"c1.xlarge",
|
99
|
-
"cc1.4xlarge",
|
100
|
-
"cc2.8xlarge",
|
101
|
-
"cg1.4xlarge"
|
102
|
-
],
|
103
|
-
"ConstraintDescription": "must be a valid EC2 instance type.",
|
104
|
-
"Default": "<%= @instance_type %>",
|
105
|
-
"Description": "WebServer EC2 instance type",
|
106
|
-
"Type": "String"
|
107
|
-
},
|
235
|
+
"Ref": "InstanceType"
|
236
|
+
},
|
108
237
|
"KeyName": {
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
"
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
"WebServerPort": {
|
123
|
-
"Default": "<%= @port %>",
|
124
|
-
"Description": "The TCP port for the Web Server",
|
125
|
-
"Type": "Number"
|
126
|
-
}
|
127
|
-
},
|
128
|
-
"Resources": {
|
129
|
-
"CPUAlarmHigh": {
|
130
|
-
"Properties": {
|
131
|
-
"AlarmActions": [
|
132
|
-
{
|
133
|
-
"Ref": "WebServerScaleUpPolicy"
|
134
|
-
}
|
135
|
-
],
|
136
|
-
"AlarmDescription": "Scale-up if CPU > <%= @high_threshold %>% for <%= @high_mins %> minutes",
|
137
|
-
"ComparisonOperator": "GreaterThanThreshold",
|
138
|
-
"Dimensions": [
|
139
|
-
{
|
140
|
-
"Name": "AutoScalingGroupName",
|
141
|
-
"Value": {
|
142
|
-
"Ref": "WebServerGroup"
|
143
|
-
}
|
144
|
-
}
|
145
|
-
],
|
146
|
-
"EvaluationPeriods": "<%= @high_periods %>",
|
147
|
-
"MetricName": "CPUUtilization",
|
148
|
-
"Namespace": "AWS/EC2",
|
149
|
-
"Period": "60",
|
150
|
-
"Statistic": "Average",
|
151
|
-
"Threshold": "<%= @high_threshold %>"
|
152
|
-
},
|
153
|
-
"Type": "AWS::CloudWatch::Alarm"
|
154
|
-
},
|
155
|
-
"CPUAlarmLow": {
|
156
|
-
"Properties": {
|
157
|
-
"AlarmActions": [
|
158
|
-
{
|
159
|
-
"Ref": "WebServerScaleDownPolicy"
|
160
|
-
}
|
161
|
-
],
|
162
|
-
"AlarmDescription": "Scale-down if CPU < <%= @low_threshold %>% for 10 minutes",
|
163
|
-
"ComparisonOperator": "LessThanThreshold",
|
164
|
-
"Dimensions": [
|
165
|
-
{
|
166
|
-
"Name": "AutoScalingGroupName",
|
167
|
-
"Value": {
|
168
|
-
"Ref": "WebServerGroup"
|
169
|
-
}
|
170
|
-
}
|
171
|
-
],
|
172
|
-
"EvaluationPeriods": "<%= @low_periods %>",
|
173
|
-
"MetricName": "CPUUtilization",
|
174
|
-
"Namespace": "AWS/EC2",
|
175
|
-
"Period": "60",
|
176
|
-
"Statistic": "Average",
|
177
|
-
"Threshold": "<%= @low_threshold %>"
|
178
|
-
},
|
179
|
-
"Type": "AWS::CloudWatch::Alarm"
|
180
|
-
},
|
181
|
-
"HostRecord": {
|
182
|
-
"Properties": {
|
183
|
-
"Comment": "DNS name for my stack.",
|
184
|
-
"HostedZoneName": "mydomain.net.",
|
185
|
-
"Name": {
|
186
|
-
"Fn::Join": [
|
187
|
-
"",
|
188
|
-
[
|
189
|
-
{
|
190
|
-
"Ref": "AWS::StackName"
|
191
|
-
},
|
192
|
-
".mydomain.net"
|
193
|
-
]
|
194
|
-
]
|
195
|
-
},
|
196
|
-
"ResourceRecords": [
|
197
|
-
{
|
198
|
-
"Fn::GetAtt": [
|
199
|
-
"elb",
|
200
|
-
"DNSName"
|
201
|
-
]
|
202
|
-
}
|
203
|
-
],
|
204
|
-
"TTL": "60",
|
205
|
-
"Type": "CNAME"
|
206
|
-
},
|
207
|
-
"Type": "AWS::Route53::RecordSet"
|
208
|
-
},
|
209
|
-
"LaunchConfig": {
|
210
|
-
"Properties": {
|
211
|
-
"BlockDeviceMappings": [
|
212
|
-
{
|
213
|
-
"DeviceName": "/dev/sdb",
|
214
|
-
"VirtualName": "ephemeral0"
|
215
|
-
}
|
216
|
-
],
|
217
|
-
"ImageId": {
|
218
|
-
"Fn::FindInMap": [
|
219
|
-
"AWSRegionArch2AMI",
|
220
|
-
{
|
221
|
-
"Ref": "AWS::Region"
|
222
|
-
},
|
223
|
-
{
|
224
|
-
"Fn::FindInMap": [
|
225
|
-
"AWSInstanceType2Arch",
|
226
|
-
{
|
227
|
-
"Ref": "InstanceType"
|
228
|
-
},
|
229
|
-
"Arch"
|
230
|
-
]
|
231
|
-
}
|
232
|
-
]
|
233
|
-
},
|
234
|
-
"InstanceType": {
|
235
|
-
"Ref": "InstanceType"
|
236
|
-
},
|
237
|
-
"KeyName": {
|
238
|
-
"Ref": "KeyName"
|
239
|
-
},
|
240
|
-
"SecurityGroups": [
|
241
|
-
"global",
|
242
|
-
{
|
243
|
-
"Fn::Join": [
|
244
|
-
"-",
|
245
|
-
[
|
246
|
-
{
|
247
|
-
"Ref": "Environment"
|
248
|
-
},
|
249
|
-
{
|
250
|
-
"Ref": "Application"
|
251
|
-
}
|
252
|
-
]
|
253
|
-
]
|
254
|
-
},
|
255
|
-
{
|
256
|
-
"Ref": "ServiceSecurityGroup"
|
257
|
-
}
|
258
|
-
],
|
259
|
-
"UserData": {
|
260
|
-
"Fn::Base64": {
|
261
|
-
"Fn::Join": [
|
262
|
-
"",
|
263
|
-
[
|
264
|
-
"#!/bin/bash -lexv\n",
|
265
|
-
"exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1\n",
|
266
|
-
"echo ",
|
267
|
-
{
|
268
|
-
"Ref": "AWS::StackName"
|
269
|
-
},
|
270
|
-
" > /tmp/stackname\n",
|
271
|
-
"echo \"\" >> /etc/profile.d/base.sh\n",
|
272
|
-
"'\" >> /etc/profile.d/base.sh\n",
|
273
|
-
"source /etc/profile.d/base.sh\n",
|
274
|
-
"set +e\n",
|
275
|
-
"rvm use system --default\n",
|
276
|
-
"set -e\n",
|
277
|
-
"echo 'running' > /tmp/type-of-instance\n",
|
278
|
-
"cat /proc/uptime | cut -f1 -d'.' > /tmp/time-to-boot\n"
|
279
|
-
]
|
280
|
-
]
|
281
|
-
}
|
282
|
-
}
|
283
|
-
},
|
284
|
-
"Type": "AWS::AutoScaling::LaunchConfiguration"
|
285
|
-
},
|
286
|
-
"ServiceSecurityGroup": {
|
287
|
-
"Properties": {
|
288
|
-
"GroupDescription": "Enable SSH access and HTTP from the load balancer only",
|
289
|
-
"SecurityGroupIngress": [
|
290
|
-
{
|
291
|
-
"CidrIp": "0.0.0.0/0",
|
292
|
-
"FromPort": "22",
|
293
|
-
"IpProtocol": "tcp",
|
294
|
-
"ToPort": "22"
|
295
|
-
},
|
296
|
-
{
|
297
|
-
"FromPort": {
|
298
|
-
"Ref": "WebServerPort"
|
299
|
-
},
|
300
|
-
"IpProtocol": "tcp",
|
301
|
-
"SourceSecurityGroupName": {
|
302
|
-
"Fn::GetAtt": [
|
303
|
-
"elb",
|
304
|
-
"SourceSecurityGroup.GroupName"
|
305
|
-
]
|
306
|
-
},
|
307
|
-
"SourceSecurityGroupOwnerId": {
|
308
|
-
"Fn::GetAtt": [
|
309
|
-
"elb",
|
310
|
-
"SourceSecurityGroup.OwnerAlias"
|
311
|
-
]
|
312
|
-
},
|
313
|
-
"ToPort": {
|
314
|
-
"Ref": "WebServerPort"
|
315
|
-
}
|
316
|
-
}
|
317
|
-
]
|
318
|
-
},
|
319
|
-
"Type": "AWS::EC2::SecurityGroup"
|
320
|
-
},
|
321
|
-
"WebServerGroup": {
|
322
|
-
"Properties": {
|
323
|
-
"AvailabilityZones": [
|
324
|
-
"us-east-1a",
|
325
|
-
"us-east-1d",
|
326
|
-
"us-east-1e"
|
327
|
-
],
|
328
|
-
"HealthCheckGracePeriod": "300",
|
329
|
-
"HealthCheckType": "ELB",
|
330
|
-
"LaunchConfigurationName": {
|
331
|
-
"Ref": "LaunchConfig"
|
332
|
-
},
|
333
|
-
"LoadBalancerNames": [
|
334
|
-
{
|
335
|
-
"Ref": "elb"
|
336
|
-
}
|
337
|
-
],
|
338
|
-
"MaxSize": "<%= @max_size %>",
|
339
|
-
"MinSize": "<%= @min_size %>",
|
340
|
-
"NotificationConfiguration": {
|
341
|
-
"NotificationTypes": [
|
342
|
-
"autoscaling:EC2_INSTANCE_LAUNCH",
|
343
|
-
"autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
|
344
|
-
"autoscaling:EC2_INSTANCE_TERMINATE",
|
345
|
-
"autoscaling:EC2_INSTANCE_TERMINATE_ERROR"
|
346
|
-
],
|
347
|
-
"TopicARN": [
|
348
|
-
"arn:aws:sns:us-east-1:867690557112:ops"
|
349
|
-
]
|
238
|
+
"Ref": "KeyName"
|
239
|
+
},
|
240
|
+
"SecurityGroups": [
|
241
|
+
"global",
|
242
|
+
{
|
243
|
+
"Fn::Join": [
|
244
|
+
"-",
|
245
|
+
[
|
246
|
+
{
|
247
|
+
"Ref": "Environment"
|
248
|
+
},
|
249
|
+
{
|
250
|
+
"Ref": "Application"
|
350
251
|
}
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
"
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
"AdjustmentType": "ChangeInCapacity",
|
368
|
-
"AutoScalingGroupName": {
|
369
|
-
"Ref": "WebServerGroup"
|
370
|
-
},
|
371
|
-
"Cooldown": "120",
|
372
|
-
"ScalingAdjustment": "<%= @up_adjustment %>"
|
373
|
-
},
|
374
|
-
"Type": "AWS::AutoScaling::ScalingPolicy"
|
375
|
-
},
|
376
|
-
"elb": {
|
377
|
-
"Properties": {
|
378
|
-
"AvailabilityZones": [
|
379
|
-
"us-east-1a",
|
380
|
-
"us-east-1d",
|
381
|
-
"us-east-1e"
|
382
|
-
],
|
383
|
-
"HealthCheck": {
|
384
|
-
"HealthyThreshold": "3",
|
385
|
-
"Interval": "6",
|
386
|
-
"Target": {
|
387
|
-
"Fn::Join": [
|
388
|
-
"",
|
389
|
-
[
|
390
|
-
"HTTP:",
|
391
|
-
{
|
392
|
-
"Ref": "WebServerPort"
|
393
|
-
},
|
394
|
-
"/up/elb"
|
395
|
-
]
|
396
|
-
]
|
397
|
-
},
|
398
|
-
"Timeout": "5",
|
399
|
-
"UnhealthyThreshold": "5"
|
400
|
-
},
|
401
|
-
"Listeners": [
|
402
|
-
{
|
403
|
-
"InstancePort": {
|
404
|
-
"Ref": "WebServerPort"
|
405
|
-
},
|
406
|
-
"LoadBalancerPort": "80",
|
407
|
-
"Protocol": "HTTP"
|
408
|
-
},
|
409
|
-
{
|
410
|
-
"InstancePort": {
|
411
|
-
"Ref": "WebServerPort"
|
412
|
-
},
|
413
|
-
"LoadBalancerPort": "443",
|
414
|
-
"PolicyNames": [],
|
415
|
-
"Protocol": "HTTPS",
|
416
|
-
"SSLCertificateId": "<%= @ssl_cert %>"
|
417
|
-
}
|
418
|
-
|
419
|
-
]
|
420
|
-
},
|
421
|
-
"Type": "AWS::ElasticLoadBalancing::LoadBalancer"
|
252
|
+
]
|
253
|
+
]
|
254
|
+
},
|
255
|
+
{
|
256
|
+
"Ref": "ServiceSecurityGroup"
|
257
|
+
}
|
258
|
+
],
|
259
|
+
"UserData": {
|
260
|
+
"Fn::Base64": {
|
261
|
+
"Fn::Join": [
|
262
|
+
"",
|
263
|
+
[
|
264
|
+
<%= user_data("bootstrap_app.sh") %>
|
265
|
+
]
|
266
|
+
]
|
267
|
+
}
|
422
268
|
}
|
269
|
+
},
|
270
|
+
"Type": "AWS::AutoScaling::LaunchConfiguration"
|
271
|
+
},
|
272
|
+
"ServiceSecurityGroup": {
|
273
|
+
"Properties": {
|
274
|
+
"GroupDescription": "Enable SSH access and HTTP from the load balancer only",
|
275
|
+
"SecurityGroupIngress": [
|
276
|
+
{
|
277
|
+
"CidrIp": "0.0.0.0/0",
|
278
|
+
"FromPort": "22",
|
279
|
+
"IpProtocol": "tcp",
|
280
|
+
"ToPort": "22"
|
281
|
+
},
|
282
|
+
{
|
283
|
+
"FromPort": {
|
284
|
+
"Ref": "WebServerPort"
|
285
|
+
},
|
286
|
+
"IpProtocol": "tcp",
|
287
|
+
"SourceSecurityGroupName": {
|
288
|
+
"Fn::GetAtt": [
|
289
|
+
"elb",
|
290
|
+
"SourceSecurityGroup.GroupName"
|
291
|
+
]
|
292
|
+
},
|
293
|
+
"SourceSecurityGroupOwnerId": {
|
294
|
+
"Fn::GetAtt": [
|
295
|
+
"elb",
|
296
|
+
"SourceSecurityGroup.OwnerAlias"
|
297
|
+
]
|
298
|
+
},
|
299
|
+
"ToPort": {
|
300
|
+
"Ref": "WebServerPort"
|
301
|
+
}
|
302
|
+
}
|
303
|
+
]
|
304
|
+
},
|
305
|
+
"Type": "AWS::EC2::SecurityGroup"
|
306
|
+
},
|
307
|
+
"WebServerGroup": {
|
308
|
+
"Properties": {
|
309
|
+
"AvailabilityZones": [
|
310
|
+
"us-east-1a",
|
311
|
+
"us-east-1d",
|
312
|
+
"us-east-1e"
|
313
|
+
],
|
314
|
+
"HealthCheckGracePeriod": "300",
|
315
|
+
"HealthCheckType": "ELB",
|
316
|
+
"LaunchConfigurationName": {
|
317
|
+
"Ref": "LaunchConfig"
|
318
|
+
},
|
319
|
+
"LoadBalancerNames": [
|
320
|
+
{
|
321
|
+
"Ref": "elb"
|
322
|
+
}
|
323
|
+
],
|
324
|
+
"MaxSize": "<%= @max_size %>",
|
325
|
+
"MinSize": "<%= @min_size %>",
|
326
|
+
"NotificationConfiguration": {
|
327
|
+
"NotificationTypes": [
|
328
|
+
"autoscaling:EC2_INSTANCE_LAUNCH",
|
329
|
+
"autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
|
330
|
+
"autoscaling:EC2_INSTANCE_TERMINATE",
|
331
|
+
"autoscaling:EC2_INSTANCE_TERMINATE_ERROR"
|
332
|
+
],
|
333
|
+
"TopicARN": [
|
334
|
+
"arn:aws:sns:us-east-1:867690557112:ops"
|
335
|
+
]
|
336
|
+
}
|
337
|
+
},
|
338
|
+
"Type": "AWS::AutoScaling::AutoScalingGroup"
|
339
|
+
},
|
340
|
+
"WebServerScaleDownPolicy": {
|
341
|
+
"Properties": {
|
342
|
+
"AdjustmentType": "ChangeInCapacity",
|
343
|
+
"AutoScalingGroupName": {
|
344
|
+
"Ref": "WebServerGroup"
|
345
|
+
},
|
346
|
+
"Cooldown": "120",
|
347
|
+
"ScalingAdjustment": "<%= @down_adjustment %>"
|
348
|
+
},
|
349
|
+
"Type": "AWS::AutoScaling::ScalingPolicy"
|
350
|
+
},
|
351
|
+
"WebServerScaleUpPolicy": {
|
352
|
+
"Properties": {
|
353
|
+
"AdjustmentType": "ChangeInCapacity",
|
354
|
+
"AutoScalingGroupName": {
|
355
|
+
"Ref": "WebServerGroup"
|
356
|
+
},
|
357
|
+
"Cooldown": "120",
|
358
|
+
"ScalingAdjustment": "<%= @up_adjustment %>"
|
359
|
+
},
|
360
|
+
"Type": "AWS::AutoScaling::ScalingPolicy"
|
361
|
+
},
|
362
|
+
"elb": {
|
363
|
+
"Properties": {
|
364
|
+
"AvailabilityZones": [
|
365
|
+
"us-east-1a",
|
366
|
+
"us-east-1d",
|
367
|
+
"us-east-1e"
|
368
|
+
],
|
369
|
+
"HealthCheck": {
|
370
|
+
"HealthyThreshold": "3",
|
371
|
+
"Interval": "6",
|
372
|
+
"Target": {
|
373
|
+
"Fn::Join": [
|
374
|
+
"",
|
375
|
+
[
|
376
|
+
"HTTP:",
|
377
|
+
{
|
378
|
+
"Ref": "WebServerPort"
|
379
|
+
},
|
380
|
+
"/up/elb"
|
381
|
+
]
|
382
|
+
]
|
383
|
+
},
|
384
|
+
"Timeout": "5",
|
385
|
+
"UnhealthyThreshold": "5"
|
386
|
+
},
|
387
|
+
"Listeners": [
|
388
|
+
{
|
389
|
+
"InstancePort": {
|
390
|
+
"Ref": "WebServerPort"
|
391
|
+
},
|
392
|
+
"LoadBalancerPort": "80",
|
393
|
+
"Protocol": "HTTP"
|
394
|
+
},
|
395
|
+
{
|
396
|
+
"InstancePort": {
|
397
|
+
"Ref": "WebServerPort"
|
398
|
+
},
|
399
|
+
"LoadBalancerPort": "443",
|
400
|
+
"PolicyNames": [
|
401
|
+
|
402
|
+
],
|
403
|
+
"Protocol": "HTTPS",
|
404
|
+
"SSLCertificateId": "<%= @ssl_cert %>"
|
405
|
+
}
|
406
|
+
]
|
407
|
+
},
|
408
|
+
"Type": "AWS::ElasticLoadBalancing::LoadBalancer"
|
423
409
|
}
|
410
|
+
}
|
424
411
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lono
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -187,7 +187,8 @@ dependencies:
|
|
187
187
|
- - ! '>='
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: '0'
|
190
|
-
description: Lono
|
190
|
+
description: Lono is a Cloud Formation Template ruby generator. Lono generates Cloud
|
191
|
+
Formation templates based on ERB templates.
|
191
192
|
email:
|
192
193
|
- tongueroo@gmail.com
|
193
194
|
executables:
|
@@ -213,6 +214,7 @@ files:
|
|
213
214
|
- lono.gemspec
|
214
215
|
- spec/lib/lono_spec.rb
|
215
216
|
- spec/project/config/lono.rb
|
217
|
+
- spec/project/config/lono/bootstrap_app.sh
|
216
218
|
- spec/project/templates/app.json.erb
|
217
219
|
- spec/spec_helper.rb
|
218
220
|
homepage: ''
|
@@ -238,9 +240,11 @@ rubyforge_project:
|
|
238
240
|
rubygems_version: 1.8.24
|
239
241
|
signing_key:
|
240
242
|
specification_version: 3
|
241
|
-
summary: Lono
|
243
|
+
summary: Lono is a Cloud Formation Template ruby generator. Lono generates Cloud
|
244
|
+
Formation templates based on ERB templates.
|
242
245
|
test_files:
|
243
246
|
- spec/lib/lono_spec.rb
|
244
247
|
- spec/project/config/lono.rb
|
248
|
+
- spec/project/config/lono/bootstrap_app.sh
|
245
249
|
- spec/project/templates/app.json.erb
|
246
250
|
- spec/spec_helper.rb
|