logandk-capistrano-ec2group 1.0.0

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/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Logan Raarup
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,65 @@
1
+ capistrano-ec2group
2
+ =================================================
3
+
4
+ Capistrano plugin for deploying to Amazon EC2 instances by security groups.
5
+
6
+
7
+ Introduction
8
+ ============
9
+
10
+ This plugin supports the deployment strategy of using the *security groups* feature of Amazon EC2. If you are using
11
+ auto-scaling of instances, new hostnames will be added and removed regularly, causing problems when you have to specify
12
+ your servers hostnames in your Capistrano recipes.
13
+
14
+ By using *security groups* to organize your instances by roles, you have created a simple database of instances that is
15
+ automatically updated as auto-scaling happens. By using a provisioning tool like Sprinkle, Moonshine, Chef, Puppet, Rubber
16
+ (etc.) to automatically configure instances upon launch (through EC2 `user-data`), you have a completely automated workflow for
17
+ configuring and deploying auto-scaling instances.
18
+
19
+
20
+ Installation
21
+ ============
22
+
23
+ `capistrano-ec2group` is provided as a Ruby gem, with the following dependencies:
24
+
25
+ * Capistrano 2 gem
26
+ * RightAWS gem
27
+
28
+ You can install it with RubyGems:
29
+
30
+ $ gem sources -a http://gems.github.com (you only have to do this once)
31
+ $ sudo gem install logandk-capistrano-ec2group
32
+
33
+
34
+ Usage
35
+ =====
36
+
37
+ In order to use the `capistrano-ec2group` plugin, you must require it in your `deploy.rb`:
38
+
39
+ require 'capistrano/ec2group'
40
+
41
+ Then you must specify your Amazon EC2 credentials:
42
+
43
+ set :aws_access_key_id, '???'
44
+ set :aws_secret_access_key, '???'
45
+
46
+ Optionally setting additional parameters, such as the region:
47
+
48
+ set :aws_params, :region => 'eu-west-1'
49
+
50
+ In order to define your instance groups, you must specify the security group name, the roles and params:
51
+
52
+ group :webserver, :web
53
+ group :app_myappname, :app
54
+ group :lamp, :web, :app
55
+ group "MySQL Servers", :db, :port => 22000
56
+
57
+ Then just sit back, relax and `cap deploy`!
58
+
59
+ Credits
60
+ =======
61
+ * Capistrano: [http://github.com/jamis/capistrano](http://github.com/jamis/capistrano)
62
+ * RightAws: [http://rightaws.rubyforge.org](http://rightaws.rubyforge.org)
63
+ * Amazon AWS: [http://aws.amazon.com](http://aws.amazon.com)
64
+
65
+ Copyright (c) 2009 Logan Raarup, released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Test the sprockets_compressor plugin.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.libs << 'test'
12
+ t.pattern = 'test/**/*_test.rb'
13
+ t.verbose = true
14
+ end
15
+
16
+ desc 'Generate documentation for the sprockets_compressor plugin.'
17
+ Rake::RDocTask.new(:rdoc) do |rdoc|
18
+ rdoc.rdoc_dir = 'rdoc'
19
+ rdoc.title = 'capistrano-ec2group'
20
+ rdoc.options << '--line-numbers' << '--inline-source'
21
+ rdoc.rdoc_files.include('README.markdown')
22
+ rdoc.rdoc_files.include('lib/**/*.rb')
23
+ end
@@ -0,0 +1,30 @@
1
+ require 'right_aws'
2
+
3
+ unless Capistrano::Configuration.respond_to?(:instance)
4
+ abort "capistrano/ec2group requires Capistrano 2"
5
+ end
6
+
7
+ module Capistrano
8
+ class Configuration
9
+ module Groups
10
+ # Associate a group of EC2 instances with a role. In order to use this, you
11
+ # must use the security groups feature in Amazon EC2 to group your servers
12
+ # by role.
13
+ #
14
+ # First, specify the security group name, then the roles and params:
15
+ #
16
+ # group :webserver, :web
17
+ # group :app_myappname, :app
18
+ # group "MySQL Servers", :db, :port => 22000
19
+ def group(which, *args)
20
+ @ec2_api ||= RightAws::Ec2.new(fetch(:aws_access_key_id), fetch(:aws_secret_access_key), fetch(:aws_params, {}))
21
+
22
+ @ec2_api.describe_instances.each do |instance|
23
+ server(instance[:dns_name], *args) if instance[:aws_groups].include?(which.to_s)
24
+ end
25
+ end
26
+ end
27
+
28
+ include Groups
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logandk-capistrano-ec2group
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Logan Raarup
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-06-18 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: capistrano
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.1.0
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: right_aws
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ description: Capistrano plugin for deploying to Amazon EC2 instances by security groups.
36
+ email: logan@logan.dk
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - MIT-LICENSE
45
+ - Rakefile
46
+ - README.markdown
47
+ - lib/capistrano/ec2group.rb
48
+ has_rdoc: true
49
+ homepage: http://github.com/logandk/capistrano-ec2group
50
+ post_install_message:
51
+ rdoc_options:
52
+ - --line-numbers
53
+ - --inline-source
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "0"
61
+ version:
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ version:
68
+ requirements: []
69
+
70
+ rubyforge_project:
71
+ rubygems_version: 1.2.0
72
+ signing_key:
73
+ specification_version: 2
74
+ summary: Capistrano plugin for deploying to Amazon EC2 instances by security groups.
75
+ test_files: []
76
+