the-maestro 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- <b>Maestro: Conduct your clouds</b>
1
+ == Maestro: Conduct your clouds
2
2
 
3
3
  Maestro is a cloud provisioning, configuration, and management utility for your Ruby and Ruby On Rails applications.
4
4
  Simply declare the structure of your clouds via configuration files, create {Chef}[http://wiki.opscode.com/display/chef/Home]
@@ -31,6 +31,12 @@ Then run the following to install the Maestro gem:
31
31
 
32
32
  bundle install
33
33
 
34
+ You'll interact with Maestro through custom Rake tasks that Maestro adds to your Rails 3 project.
35
+ When running <code>rake</code> within the context of your Rails 3 application, prefix the call to rake with
36
+ <code>bundle exec</code>. For example:
37
+
38
+ bundle exec rake maestro:validate_configs
39
+
34
40
 
35
41
  === Installation with Ruby On Rails 2
36
42
 
@@ -109,6 +115,7 @@ that these capabilities are enabled in your Amazon Web Services account. See the
109
115
  aws_access_key "XXXXXXXXXXXXXXXXXXXX"
110
116
  aws_secret_access_key "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
111
117
  chef_bucket "maestro.yourdomain.com"
118
+ region "us-east"
112
119
 
113
120
  roles do
114
121
  role "web" do
@@ -157,6 +164,11 @@ The following attributes must be present within your aws_cloud declaration:
157
164
  - <b>aws_secret_access_key</b>: Your Amazon Web Services Secret Access Key
158
165
  - <b>chef_bucket</b>: The name of the Amazon S3 Bucket where you want your Chef recipes and roles stored. If this Bucket does not exist, Maestro will create it for you. Please note that the Bucket itself, and all objects stored within the Bucket use the canned 'private' access policy, meaning no one but the Bucket owner (i.e. you) may access the Bucket or the objects within it. Maestro uses query string authentication when accessing the objects to ensure the integrity of your data.
159
166
 
167
+ The following attributes are optional within your aws_cloud declaration:
168
+
169
+ - <b>region</b>: The name of an AWS region to run this cloud in. If this attribute is ommitted, the US-East region will be used.
170
+ Allowed values are: "us-east", "us-west", "eu", "asia-pacific".
171
+
160
172
 
161
173
  ==== roles
162
174
  The <code>roles</code> method allows you to apply configuration to all of the nodes in your cloud which are in a given role, rather than repeating that configuration for all nodes individually.
@@ -432,6 +444,8 @@ At this point, you can use Maestro as described above. Define your clouds, creat
432
444
 
433
445
  The {Maestro Users Google Group}[http://groups.google.com/group/maestro-users] is the recommended place to get help.
434
446
 
447
+ An {example Rails 3 application}[http://github.com/bploetz/maestro-rails3-example] can be used as a starting point for creating your own
448
+ application and cookbooks.
435
449
 
436
450
  == Contributing
437
451
  Please use the {Issues}[http://github.com/bploetz/maestro/issues] page on the Maestro GitHub site to report bugs or feature requests.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
@@ -22,6 +22,27 @@ module Maestro
22
22
  MAESTRO_NODE_PREFIX = "node."
23
23
  MAESTRO_ROLE_PREFIX = "role."
24
24
  MAESTRO_DEFAULT_ROLE = "default"
25
+
26
+ US_EAST_REGION = "us-east"
27
+ US_WEST_REGION = "us-west"
28
+ EU_REGION = "eu"
29
+ ASIA_PACIFIC_REGION = "asia-pacific"
30
+ REGIONS = [US_EAST_REGION, US_WEST_REGION, EU_REGION, ASIA_PACIFIC_REGION]
31
+
32
+ EC2_ENDPOINTS = {US_EAST_REGION => "ec2.us-east-1.amazonaws.com",
33
+ US_WEST_REGION => "ec2.us-west-1.amazonaws.com",
34
+ EU_REGION => "ec2.eu-west-1.amazonaws.com",
35
+ ASIA_PACIFIC_REGION => "ec2.ap-southeast-1.amazonaws.com"}
36
+
37
+ ELB_ENDPOINTS = {US_EAST_REGION => "elasticloadbalancing.us-east-1.amazonaws.com",
38
+ US_WEST_REGION => "elasticloadbalancing.us-west-1.amazonaws.com",
39
+ EU_REGION => "elasticloadbalancing.eu-west-1.amazonaws.com",
40
+ ASIA_PACIFIC_REGION => "elasticloadbalancing.ap-southeast-1.amazonaws.com"}
41
+
42
+ RDS_ENDPOINTS = {US_EAST_REGION => "rds.us-east-1.amazonaws.com",
43
+ US_WEST_REGION => "rds.us-west-1.amazonaws.com",
44
+ EU_REGION => "rds.eu-west-1.amazonaws.com",
45
+ ASIA_PACIFIC_REGION => "rds.ap-southeast-1.amazonaws.com"}
25
46
 
26
47
  # Array of all ec2 security groups names in this Cloud
27
48
  attr_reader :ec2_security_groups
@@ -41,7 +62,7 @@ module Maestro
41
62
  attr_reader :elb_nodes
42
63
  # Hash of Rds Nodes
43
64
  attr_reader :rds_nodes
44
- dsl_property :aws_account_id, :aws_access_key, :aws_secret_access_key, :chef_bucket
65
+ dsl_property :aws_account_id, :aws_access_key, :aws_secret_access_key, :chef_bucket, :region
45
66
 
46
67
  def initialize(name, cfg_file=nil, &block)
47
68
  @ec2_nodes = Hash.new
@@ -98,9 +119,19 @@ module Maestro
98
119
 
99
120
  # establishes a connection to Amazon
100
121
  def connect!
101
- @ec2 = AWS::EC2::Base.new(:access_key_id => aws_access_key, :secret_access_key => aws_secret_access_key, :use_ssl => true)
102
- @elb = AWS::ELB::Base.new(:access_key_id => aws_access_key, :secret_access_key => aws_secret_access_key, :use_ssl => true)
103
- @rds = AWS::RDS::Base.new(:access_key_id => aws_access_key, :secret_access_key => aws_secret_access_key, :use_ssl => true)
122
+ region.nil? || region.empty? ? region_name = US_EAST_REGION : region_name = region
123
+ @ec2 = AWS::EC2::Base.new(:access_key_id => aws_access_key,
124
+ :secret_access_key => aws_secret_access_key,
125
+ :use_ssl => true,
126
+ :server => EC2_ENDPOINTS[region_name])
127
+ @elb = AWS::ELB::Base.new(:access_key_id => aws_access_key,
128
+ :secret_access_key => aws_secret_access_key,
129
+ :use_ssl => true,
130
+ :server => ELB_ENDPOINTS[region_name])
131
+ @rds = AWS::RDS::Base.new(:access_key_id => aws_access_key,
132
+ :secret_access_key => aws_secret_access_key,
133
+ :use_ssl => true,
134
+ :server => RDS_ENDPOINTS[region_name])
104
135
  s3_logger = Logger.new(STDOUT)
105
136
  s3_logger.level = Logger::FATAL
106
137
  AWS::S3::Base.establish_connection!(:access_key_id => aws_access_key, :secret_access_key => aws_secret_access_key, :use_ssl => true)
@@ -886,6 +917,9 @@ module Maestro
886
917
  invalidate "Missing aws_access_key" if aws_access_key.nil?
887
918
  invalidate "Missing aws_secret_access_key" if aws_secret_access_key.nil?
888
919
  invalidate "Missing chef_bucket" if chef_bucket.nil?
920
+ if !region.nil? && !region.empty?
921
+ invalidate "Invalid region" if !REGIONS.include?(region)
922
+ end
889
923
  end
890
924
 
891
925
  # Ensures that the given EC2 security group exists. Creates it if it does not exist.
@@ -37,6 +37,9 @@ module BaseAws
37
37
  #
38
38
  # # Name of the S3 bucket to store Chef assets in
39
39
  # :chef_bucket => "maestro-tests-aws.XXXXXXXX.com"
40
+ #
41
+ # # Name of the region to run the tests in. Must match region names in Maestro::Cloud::Aws::REGIONS
42
+ # :region => "us-east"
40
43
  # }
41
44
  #
42
45
  # Make sure you set the appropriate permissions on this file, and delete it when you're done running the integration tests.
@@ -59,10 +62,20 @@ module BaseAws
59
62
  raise "Invalid Maestro::Cloud::Aws integration test config file: ~/#{@config_file_name}. Missing :aws_access_key key" if !@credentials.has_key?(:aws_access_key)
60
63
  raise "Invalid Maestro::Cloud::Aws integration test config file: ~/#{@config_file_name}. Missing :aws_secret_access_key key" if !@credentials.has_key?(:aws_secret_access_key)
61
64
  raise "Invalid Maestro::Cloud::Aws integration test config file: ~/#{@config_file_name}. Missing :chef_bucket key" if !@credentials.has_key?(:chef_bucket)
65
+ raise "Invalid Maestro::Cloud::Aws integration test config file: ~/#{@config_file_name}. Missing :region key" if !@credentials.has_key?(:region)
62
66
 
63
- @ec2 = AWS::EC2::Base.new(:access_key_id => @credentials[:aws_access_key], :secret_access_key => @credentials[:aws_secret_access_key], :use_ssl => true)
64
- @elb = AWS::ELB::Base.new(:access_key_id => @credentials[:aws_access_key], :secret_access_key => @credentials[:aws_secret_access_key], :use_ssl => true)
65
- @rds = AWS::RDS::Base.new(:access_key_id => @credentials[:aws_access_key], :secret_access_key => @credentials[:aws_secret_access_key], :use_ssl => true)
67
+ @ec2 = AWS::EC2::Base.new(:access_key_id => @credentials[:aws_access_key],
68
+ :secret_access_key => @credentials[:aws_secret_access_key],
69
+ :use_ssl => true,
70
+ :server => Maestro::Cloud::Aws::EC2_ENDPOINTS[@credentials[:region]])
71
+ @elb = AWS::ELB::Base.new(:access_key_id => @credentials[:aws_access_key],
72
+ :secret_access_key => @credentials[:aws_secret_access_key],
73
+ :use_ssl => true,
74
+ :server => Maestro::Cloud::Aws::ELB_ENDPOINTS[@credentials[:region]])
75
+ @rds = AWS::RDS::Base.new(:access_key_id => @credentials[:aws_access_key],
76
+ :secret_access_key => @credentials[:aws_secret_access_key],
77
+ :use_ssl => true,
78
+ :server => Maestro::Cloud::Aws::RDS_ENDPOINTS[@credentials[:region]])
66
79
  AWS::S3::Base.establish_connection!(:access_key_id => @credentials[:aws_access_key], :secret_access_key => @credentials[:aws_secret_access_key], :use_ssl => true)
67
80
 
68
81
  # keep track of the Elastic IPs we started with
@@ -258,7 +258,35 @@ class TestAwsCloud < Test::Unit::TestCase
258
258
  # Tests
259
259
  #######################
260
260
 
261
- should "be able to connect to AWS" do
261
+ should "be able to connect to default AWS endpoints" do
262
+ assert_nothing_raised do
263
+ @cloud.connect!
264
+ end
265
+ end
266
+
267
+ should "be able to connect to us-east AWS endpoints" do
268
+ @cloud.region("us-east")
269
+ assert_nothing_raised do
270
+ @cloud.connect!
271
+ end
272
+ end
273
+
274
+ should "be able to connect to us-west AWS endpoints" do
275
+ @cloud.region("us-west")
276
+ assert_nothing_raised do
277
+ @cloud.connect!
278
+ end
279
+ end
280
+
281
+ should "be able to connect to eu AWS endpoints" do
282
+ @cloud.region("eu")
283
+ assert_nothing_raised do
284
+ @cloud.connect!
285
+ end
286
+ end
287
+
288
+ should "be able to connect to asia-pacific AWS endpoints" do
289
+ @cloud.region("asia-pacific")
262
290
  assert_nothing_raised do
263
291
  @cloud.connect!
264
292
  end
@@ -124,6 +124,13 @@ class TestAwsCloud < Test::Unit::TestCase
124
124
  assert @cloud.validation_errors.any? {|message| !message.index("Missing chef_bucket").nil? }
125
125
  end
126
126
 
127
+ should "be invalid due to invalid region name" do
128
+ @cloud.region "foo"
129
+ @cloud.validate
130
+ assert !@cloud.valid?
131
+ assert @cloud.validation_errors.any? {|message| !message.index("Invalid region").nil? }
132
+ end
133
+
127
134
  should "be valid" do
128
135
  @cloud.validate
129
136
  assert @cloud.valid?
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{the-maestro}
8
- s.version = "0.4.0"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Ploetz"]
12
- s.date = %q{2010-10-05}
12
+ s.date = %q{2010-10-10}
13
13
  s.description = %q{Maestro is a cloud provisioning, configuration, and management utility for your Ruby and Ruby On Rails applications.}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -81,7 +81,7 @@ Gem::Specification.new do |s|
81
81
  s.homepage = %q{http://github.com/bploetz/maestro}
82
82
  s.rdoc_options = ["--charset=UTF-8"]
83
83
  s.require_paths = ["lib"]
84
- s.rubygems_version = %q{1.3.7}
84
+ s.rubygems_version = %q{1.3.5}
85
85
  s.summary = %q{Maestro: Conduct your clouds.}
86
86
  s.test_files = [
87
87
  "test/integration/base_aws.rb",
@@ -117,7 +117,7 @@ Gem::Specification.new do |s|
117
117
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
118
118
  s.specification_version = 3
119
119
 
120
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
120
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
121
121
  s.add_development_dependency(%q<thoughtbot-shoulda>, ["= 2.10.2"])
122
122
  s.add_runtime_dependency(%q<net-ssh>, ["= 2.0.15"])
123
123
  s.add_runtime_dependency(%q<net-scp>, ["= 1.0.2"])
metadata CHANGED
@@ -1,12 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: the-maestro
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 4
8
- - 0
9
- version: 0.4.0
4
+ version: 0.4.1
10
5
  platform: ruby
11
6
  authors:
12
7
  - Brian Ploetz
@@ -14,144 +9,99 @@ autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
11
 
17
- date: 2010-10-05 00:00:00 -04:00
12
+ date: 2010-10-10 00:00:00 -04:00
18
13
  default_executable:
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: thoughtbot-shoulda
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
25
20
  requirements:
26
21
  - - "="
27
22
  - !ruby/object:Gem::Version
28
- segments:
29
- - 2
30
- - 10
31
- - 2
32
23
  version: 2.10.2
33
- type: :development
34
- version_requirements: *id001
24
+ version:
35
25
  - !ruby/object:Gem::Dependency
36
26
  name: net-ssh
37
- prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
40
30
  requirements:
41
31
  - - "="
42
32
  - !ruby/object:Gem::Version
43
- segments:
44
- - 2
45
- - 0
46
- - 15
47
33
  version: 2.0.15
48
- type: :runtime
49
- version_requirements: *id002
34
+ version:
50
35
  - !ruby/object:Gem::Dependency
51
36
  name: net-scp
52
- prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
55
40
  requirements:
56
41
  - - "="
57
42
  - !ruby/object:Gem::Version
58
- segments:
59
- - 1
60
- - 0
61
- - 2
62
43
  version: 1.0.2
63
- type: :runtime
64
- version_requirements: *id003
44
+ version:
65
45
  - !ruby/object:Gem::Dependency
66
46
  name: net-ssh-multi
67
- prerelease: false
68
- requirement: &id004 !ruby/object:Gem::Requirement
69
- none: false
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
70
50
  requirements:
71
51
  - - "="
72
52
  - !ruby/object:Gem::Version
73
- segments:
74
- - 1
75
- - 0
76
- - 1
77
53
  version: 1.0.1
78
- type: :runtime
79
- version_requirements: *id004
54
+ version:
80
55
  - !ruby/object:Gem::Dependency
81
56
  name: net-ssh-gateway
82
- prerelease: false
83
- requirement: &id005 !ruby/object:Gem::Requirement
84
- none: false
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
85
60
  requirements:
86
61
  - - "="
87
62
  - !ruby/object:Gem::Version
88
- segments:
89
- - 1
90
- - 0
91
- - 1
92
63
  version: 1.0.1
93
- type: :runtime
94
- version_requirements: *id005
64
+ version:
95
65
  - !ruby/object:Gem::Dependency
96
66
  name: archive-tar-minitar
97
- prerelease: false
98
- requirement: &id006 !ruby/object:Gem::Requirement
99
- none: false
67
+ type: :runtime
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
100
70
  requirements:
101
71
  - - "="
102
72
  - !ruby/object:Gem::Version
103
- segments:
104
- - 0
105
- - 5
106
- - 2
107
73
  version: 0.5.2
108
- type: :runtime
109
- version_requirements: *id006
74
+ version:
110
75
  - !ruby/object:Gem::Dependency
111
76
  name: amazon-ec2
112
- prerelease: false
113
- requirement: &id007 !ruby/object:Gem::Requirement
114
- none: false
77
+ type: :runtime
78
+ version_requirement:
79
+ version_requirements: !ruby/object:Gem::Requirement
115
80
  requirements:
116
81
  - - "="
117
82
  - !ruby/object:Gem::Version
118
- segments:
119
- - 0
120
- - 9
121
- - 11
122
83
  version: 0.9.11
123
- type: :runtime
124
- version_requirements: *id007
84
+ version:
125
85
  - !ruby/object:Gem::Dependency
126
86
  name: aws-s3
127
- prerelease: false
128
- requirement: &id008 !ruby/object:Gem::Requirement
129
- none: false
87
+ type: :runtime
88
+ version_requirement:
89
+ version_requirements: !ruby/object:Gem::Requirement
130
90
  requirements:
131
91
  - - "="
132
92
  - !ruby/object:Gem::Version
133
- segments:
134
- - 0
135
- - 6
136
- - 2
137
93
  version: 0.6.2
138
- type: :runtime
139
- version_requirements: *id008
94
+ version:
140
95
  - !ruby/object:Gem::Dependency
141
96
  name: log4r
142
- prerelease: false
143
- requirement: &id009 !ruby/object:Gem::Requirement
144
- none: false
97
+ type: :runtime
98
+ version_requirement:
99
+ version_requirements: !ruby/object:Gem::Requirement
145
100
  requirements:
146
101
  - - "="
147
102
  - !ruby/object:Gem::Version
148
- segments:
149
- - 1
150
- - 1
151
- - 7
152
103
  version: 1.1.7
153
- type: :runtime
154
- version_requirements: *id009
104
+ version:
155
105
  description: Maestro is a cloud provisioning, configuration, and management utility for your Ruby and Ruby On Rails applications.
156
106
  email:
157
107
  executables: []
@@ -233,25 +183,21 @@ rdoc_options:
233
183
  require_paths:
234
184
  - lib
235
185
  required_ruby_version: !ruby/object:Gem::Requirement
236
- none: false
237
186
  requirements:
238
187
  - - ">="
239
188
  - !ruby/object:Gem::Version
240
- segments:
241
- - 0
242
189
  version: "0"
190
+ version:
243
191
  required_rubygems_version: !ruby/object:Gem::Requirement
244
- none: false
245
192
  requirements:
246
193
  - - ">="
247
194
  - !ruby/object:Gem::Version
248
- segments:
249
- - 0
250
195
  version: "0"
196
+ version:
251
197
  requirements: []
252
198
 
253
199
  rubyforge_project:
254
- rubygems_version: 1.3.7
200
+ rubygems_version: 1.3.5
255
201
  signing_key:
256
202
  specification_version: 3
257
203
  summary: "Maestro: Conduct your clouds."