ec2launcher 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +4 -0
- data/lib/ec2launcher/block_device_builder.rb +63 -41
- data/lib/ec2launcher/dsl/application.rb +297 -0
- data/lib/ec2launcher/dsl/block_device.rb +96 -0
- data/lib/ec2launcher/dsl/config.rb +78 -0
- data/lib/ec2launcher/dsl/email_notification.rb +67 -0
- data/lib/ec2launcher/dsl/environment.rb +221 -0
- data/lib/ec2launcher/hostname_generator.rb +117 -0
- data/lib/ec2launcher/init_options.rb +18 -7
- data/lib/ec2launcher/version.rb +1 -1
- data/lib/ec2launcher.rb +111 -148
- metadata +7 -6
- data/lib/ec2launcher/application.rb +0 -295
- data/lib/ec2launcher/block_device.rb +0 -94
- data/lib/ec2launcher/config.rb +0 -76
- data/lib/ec2launcher/email_notification.rb +0 -65
- data/lib/ec2launcher/environment.rb +0 -219
@@ -1,94 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2012 Sean Laurent
|
3
|
-
#
|
4
|
-
|
5
|
-
module EC2Launcher
|
6
|
-
class BlockDevice
|
7
|
-
attr_reader :mount_point
|
8
|
-
attr_reader :name
|
9
|
-
|
10
|
-
def initialize()
|
11
|
-
@count = 1
|
12
|
-
@group = "root"
|
13
|
-
@user = "root"
|
14
|
-
end
|
15
|
-
|
16
|
-
def is_raid?()
|
17
|
-
@raid_level.nil?
|
18
|
-
end
|
19
|
-
|
20
|
-
def count(*block_count)
|
21
|
-
if block_count.empty?
|
22
|
-
@count
|
23
|
-
else
|
24
|
-
@count = block_count[0]
|
25
|
-
self
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def group(*group)
|
30
|
-
if group.empty?
|
31
|
-
@group
|
32
|
-
else
|
33
|
-
@group = group[0]
|
34
|
-
self
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def mount(*mount)
|
39
|
-
if mount.empty?
|
40
|
-
@mount
|
41
|
-
else
|
42
|
-
@mount_point = mount[0]
|
43
|
-
self
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def name(*name)
|
48
|
-
if name.empty?
|
49
|
-
@name
|
50
|
-
else
|
51
|
-
@name = name[0]
|
52
|
-
self
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def owner(*owner)
|
57
|
-
if owner.empty?
|
58
|
-
@owner
|
59
|
-
else
|
60
|
-
@owner = owner[0]
|
61
|
-
self
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def raid_level(*raid_level)
|
66
|
-
if raid_level.empty?
|
67
|
-
@raid_level
|
68
|
-
else
|
69
|
-
@raid_level = raid_level[0]
|
70
|
-
self
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def size(*volume_size)
|
75
|
-
if volume_size.empty?
|
76
|
-
@size
|
77
|
-
else
|
78
|
-
@size = volume_size[0].to_i
|
79
|
-
self
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def to_json(*a)
|
84
|
-
{
|
85
|
-
"name" => @name,
|
86
|
-
"count" => @count,
|
87
|
-
"raid_level" => @raid_level,
|
88
|
-
"mount_point" => @mount_point,
|
89
|
-
"owner" => @owner,
|
90
|
-
"group" => @group
|
91
|
-
}.to_json(*a)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
data/lib/ec2launcher/config.rb
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2012 Sean Laurent
|
3
|
-
#
|
4
|
-
module EC2Launcher
|
5
|
-
class ConfigDSL
|
6
|
-
attr_reader :config
|
7
|
-
|
8
|
-
def config(&block)
|
9
|
-
return @config if block.nil?
|
10
|
-
|
11
|
-
@config = Config.new
|
12
|
-
@config.instance_eval &block
|
13
|
-
@config
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.execute(dsl)
|
17
|
-
new.tap do |context|
|
18
|
-
context.instance_eval(dsl)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class Config
|
24
|
-
DEFAULT_CONFIG_ERB = %q{
|
25
|
-
config do
|
26
|
-
environments "environments"
|
27
|
-
applications "applications"
|
28
|
-
|
29
|
-
package_manager "apt"
|
30
|
-
config_manager "chef"
|
31
|
-
end
|
32
|
-
}.gsub(/^ /, '')
|
33
|
-
|
34
|
-
def environments(*environments)
|
35
|
-
if environments.empty?
|
36
|
-
@environments
|
37
|
-
else
|
38
|
-
if environments[0].kind_of? Array
|
39
|
-
@environments = @environments[0]
|
40
|
-
else
|
41
|
-
@environments = [ environments[0] ]
|
42
|
-
end
|
43
|
-
self
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def applications(*applications)
|
48
|
-
if applications.empty?
|
49
|
-
@applications
|
50
|
-
else
|
51
|
-
if applications[0].kind_of? Array
|
52
|
-
@applications = @applications[0]
|
53
|
-
else
|
54
|
-
@applications = [ applications[0] ]
|
55
|
-
end
|
56
|
-
self
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def package_manager(*package_manager)
|
61
|
-
if package_manager.empty?
|
62
|
-
@package_manager
|
63
|
-
else
|
64
|
-
@package_manager = package_manager[0]
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def config_manager(*config_manager)
|
69
|
-
if config_manager.empty?
|
70
|
-
@config_manager
|
71
|
-
else
|
72
|
-
@config_manager = config_manager[0]
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2012 Sean Laurent
|
3
|
-
#
|
4
|
-
|
5
|
-
module EC2Launcher
|
6
|
-
module EmailNotifications
|
7
|
-
attr_reader :email_notifications
|
8
|
-
|
9
|
-
def email_notification(&block)
|
10
|
-
notifications = EmailNotification.new
|
11
|
-
notifications.instance_exec(&block)
|
12
|
-
@email_notifications = notifications
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
class EmailNotification
|
17
|
-
def initialize()
|
18
|
-
end
|
19
|
-
|
20
|
-
def from(*from)
|
21
|
-
if from.empty?
|
22
|
-
@from
|
23
|
-
else
|
24
|
-
@from = from[0]
|
25
|
-
self
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def to(*to)
|
30
|
-
if to.empty?
|
31
|
-
@to
|
32
|
-
else
|
33
|
-
@to = to[0]
|
34
|
-
self
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def ses_access_key(*ses_access_key)
|
39
|
-
if ses_access_key.empty?
|
40
|
-
@ses_access_key
|
41
|
-
else
|
42
|
-
@ses_access_key = ses_access_key[0]
|
43
|
-
self
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def ses_secret_key(*ses_secret_key)
|
48
|
-
if ses_secret_key.empty?
|
49
|
-
@ses_secret_key
|
50
|
-
else
|
51
|
-
@ses_secret_key = ses_secret_key[0]
|
52
|
-
self
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def to_json(*a)
|
57
|
-
{
|
58
|
-
"from" => @from,
|
59
|
-
"to" => @to,
|
60
|
-
"ses_access_key" => @ses_access_key,
|
61
|
-
"ses_secret_key" => @ses_secret_key
|
62
|
-
}.to_json(*a)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,219 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2012 Sean Laurent
|
3
|
-
#
|
4
|
-
require 'ec2launcher/email_notification'
|
5
|
-
require 'ec2launcher/security_group_handler'
|
6
|
-
|
7
|
-
module EC2Launcher
|
8
|
-
class Environment
|
9
|
-
include EC2Launcher::EmailNotifications
|
10
|
-
include EC2Launcher::SecurityGroupHandler
|
11
|
-
|
12
|
-
attr_reader :name
|
13
|
-
attr_reader :precommands
|
14
|
-
attr_reader :postcommands
|
15
|
-
|
16
|
-
def initialize()
|
17
|
-
@aliases = []
|
18
|
-
@email_notifications = nil
|
19
|
-
@gems = []
|
20
|
-
@packages = []
|
21
|
-
@precommands = []
|
22
|
-
@postcommands = []
|
23
|
-
@roles = []
|
24
|
-
@security_groups = {}
|
25
|
-
end
|
26
|
-
|
27
|
-
def environment(name)
|
28
|
-
@name = name
|
29
|
-
yield self
|
30
|
-
self
|
31
|
-
end
|
32
|
-
|
33
|
-
def aws_keyfile(*aws_keyfile)
|
34
|
-
if aws_keyfile.empty?
|
35
|
-
@aws_keyfile
|
36
|
-
else
|
37
|
-
@aws_keyfile = aws_keyfile[0]
|
38
|
-
self
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def aliases(*aliases)
|
43
|
-
if aliases.empty?
|
44
|
-
@aliases
|
45
|
-
else
|
46
|
-
if aliases[0].kind_of? String
|
47
|
-
@aliases = [ aliases[0] ]
|
48
|
-
else
|
49
|
-
@aliases = aliases[0]
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def ami_name(*ami_name)
|
55
|
-
if ami_name.empty?
|
56
|
-
@ami_name
|
57
|
-
else
|
58
|
-
if ami_name[0].kind_of? String
|
59
|
-
@ami_name = /#{ami_name[0]}/
|
60
|
-
else
|
61
|
-
@ami_name = ami_name[0]
|
62
|
-
end
|
63
|
-
self
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def availability_zone(*zone)
|
68
|
-
if zone.empty?
|
69
|
-
@availability_zone
|
70
|
-
else
|
71
|
-
@availability_zone = zone[0].to_s
|
72
|
-
self
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def chef_server_url(*server_url)
|
77
|
-
if server_url.empty?
|
78
|
-
@chef_server_url
|
79
|
-
else
|
80
|
-
@chef_server_url = server_url[0]
|
81
|
-
self
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def chef_validation_pem_url(*chef_validation_pem_url)
|
86
|
-
if chef_validation_pem_url.empty?
|
87
|
-
@chef_validation_pem_url
|
88
|
-
else
|
89
|
-
@chef_validation_pem_url = chef_validation_pem_url[0]
|
90
|
-
self
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
def domain_name(*domain_name)
|
95
|
-
if domain_name.empty?
|
96
|
-
@domain_name
|
97
|
-
else
|
98
|
-
@domain_name = domain_name[0]
|
99
|
-
self
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
def gems(*gems)
|
104
|
-
if gems.empty?
|
105
|
-
@gems
|
106
|
-
else
|
107
|
-
@gems = gems[0]
|
108
|
-
self
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
def inherit(*inherit_type)
|
113
|
-
if inherit_type.empty?
|
114
|
-
@inherit_type
|
115
|
-
else
|
116
|
-
@inherit_type = inherit_type[0]
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
def key_name(*key)
|
121
|
-
if key.empty?
|
122
|
-
@key_name
|
123
|
-
else
|
124
|
-
@key_name = key[0]
|
125
|
-
self
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
def packages(*packages)
|
130
|
-
if packages.empty?
|
131
|
-
@packages
|
132
|
-
else
|
133
|
-
@packages = packages[0]
|
134
|
-
self
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
def precommand(*command)
|
139
|
-
@precommands << command[0]
|
140
|
-
end
|
141
|
-
|
142
|
-
def postcommand(*command)
|
143
|
-
@postcommands << command[0]
|
144
|
-
end
|
145
|
-
|
146
|
-
def roles(*roles)
|
147
|
-
if roles.empty?
|
148
|
-
@roles
|
149
|
-
else
|
150
|
-
@roles = [] if @roles.nil?
|
151
|
-
if roles[0].kind_of? Array
|
152
|
-
@roles += roles[0]
|
153
|
-
else
|
154
|
-
@roles = []
|
155
|
-
@roles << roles[0]
|
156
|
-
end
|
157
|
-
self
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
def short_name(*short_name)
|
162
|
-
if short_name.empty?
|
163
|
-
@short_name
|
164
|
-
else
|
165
|
-
@short_name = short_name[0]
|
166
|
-
self
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
def subnet(*subnet)
|
171
|
-
if subnet.empty?
|
172
|
-
@subnet
|
173
|
-
else
|
174
|
-
@subnet = subnet[0]
|
175
|
-
self
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
# Takes values from the other environment and merges them into this one
|
180
|
-
def merge(other_env)
|
181
|
-
@name =other_env.name
|
182
|
-
|
183
|
-
@gems += other_env.gems unless other_env.gems.nil?
|
184
|
-
@packages += other_env.packages unless other_env.packages.nil?
|
185
|
-
@roles += other_env.roles unless other_env.roles.nil?
|
186
|
-
@precommands += other_env.precommands unless other_env.precommands.nil?
|
187
|
-
@postcommands += other_env.postcommands unless other_env.postcommands.nil?
|
188
|
-
unless other_env.security_groups.nil?
|
189
|
-
other_env.security_groups.keys.each do |key|
|
190
|
-
@security_groups[key] = [] if @security_groups[key].nil?
|
191
|
-
@security_groups[key] += other_env.security_groups[key]
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
@aliases = other_env.aliases.nil? ? nil : other_env.aliases
|
196
|
-
|
197
|
-
@ami_name = other_env.ami_name unless other_env.ami_name.nil?
|
198
|
-
@aws_keyfile = other_env.aws_keyfile unless other_env.aws_keyfile.nil?
|
199
|
-
@availability_zone = other_env.availability_zone unless other_env.availability_zone.nil?
|
200
|
-
@chef_server_url = other_env.chef_server_url unless other_env.chef_server_url.nil?
|
201
|
-
@chef_validation_pem_url = other_env.chef_validation_pem_url unless other_env.chef_validation_pem_url.nil?
|
202
|
-
@domain_name = other_env.domain_name unless other_env.domain_name.nil?
|
203
|
-
@email_notifications = other_env.email_notifications unless other_env.email_notifications.nil?
|
204
|
-
@key_name = other_env.key_name unless other_env.key_name.nil?
|
205
|
-
@subnet = other_env.subnet unless other_env.subnet.nil?
|
206
|
-
@short_name = other_env.short_name unless other_env.short_name.nil?
|
207
|
-
end
|
208
|
-
|
209
|
-
def load(dsl)
|
210
|
-
self.instance_eval(dsl)
|
211
|
-
self
|
212
|
-
end
|
213
|
-
|
214
|
-
def self.load(dsl)
|
215
|
-
env = Environment.new.instance_eval(dsl)
|
216
|
-
env
|
217
|
-
end
|
218
|
-
end
|
219
|
-
end
|