elbow 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Elbow
2
2
 
3
- TODO: Write a gem description
3
+ Elbow is a Capistrano plugin for deploying to an AWS Elastic Load Balancer (ELB)
4
+
5
+ In the cloud, your web instances are forever changing. This Gem allows you to define in
6
+ your cap file that a host is using an ELB and it will detect the EC2 instances and deploy
7
+ your app to each of them.
4
8
 
5
9
  ## Installation
6
10
 
@@ -18,7 +22,29 @@ Or install it yourself as:
18
22
 
19
23
  ## Usage
20
24
 
21
- TODO: Write usage instructions here
25
+ In your `deploy.rb`
26
+
27
+ require 'elbow/capistrano'
28
+
29
+ `elbow` requires your aws credentials, set them in your `deploy.rb`
30
+
31
+ set :aws_access_key_id, 'YOUR_ACCESS_KEY_ID'
32
+ set :aws_secret_access_key, 'YOUR_SECRET_ACCESS_KEY'
33
+
34
+ Tell `elbow` that a host is using an ELB by specifying the `elastic_load_balancer`
35
+ configuration in in your `deploy.rb`. The first argument is the host name followed
36
+ by a list of roles.
37
+
38
+ elastic_load_balancer example.com, :app, :web
39
+
40
+ The host name is expected to be a CNAME for the ELB public DNS, as such a DNS looked is
41
+ performed against the host name.
42
+
43
+ By default the ELB is assumed to be in the AWS region `us-east-1`. You can use a
44
+ different region by setting the following in your `deploy.rb`
45
+
46
+ set :aws_region, 'ap-southeast-2'
47
+
22
48
 
23
49
  ## Contributing
24
50
 
@@ -9,11 +9,14 @@ Capistrano::Configuration.instance(:must_exist).load do
9
9
  all_cnames= packet.answer.reject { |p| !p.instance_of? Net::DNS::RR::CNAME }
10
10
  cname = all_cnames.find { |c| c.name == "#{name}."}.cname[0..-2]
11
11
 
12
- elb = AWS::ELB.new(:access_key_id => fetch(:aws_access_key_id),
13
- :secret_access_key => fetch(:aws_secret_access_key))
14
-
15
- load_balancer = elb.load_balancers.find { |elb| elb.dns_name == cname }
16
- raise "EC2 Load Balancer not found for #{name}" if load_balancer.nil?
12
+ aws_region= fetch(:aws_region, 'us-east-1')
13
+ AWS.config(:access_key_id => fetch(:aws_access_key_id),
14
+ :secret_access_key => fetch(:aws_secret_access_key),
15
+ :ec2_endpoint => "ec2.#{aws_region}.amazonaws.com",
16
+ :elb_endpoint => "elasticloadbalancing.#{aws_region}.amazonaws.com")
17
+
18
+ load_balancer = AWS::ELB.new.load_balancers.find { |elb| elb.dns_name.downcase == cname.downcase }
19
+ raise "EC2 Load Balancer not found for #{name} in region #{aws_region}" if load_balancer.nil?
17
20
 
18
21
  load_balancer.instances.each do |instance|
19
22
  hostname = instance.dns_name
data/lib/elbow/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Elbow
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elbow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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-10-11 00:00:00.000000000 Z
12
+ date: 2013-03-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk
@@ -71,18 +71,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
71
71
  - - ! '>='
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0'
74
- segments:
75
- - 0
76
- hash: -3654321242792836432
77
74
  required_rubygems_version: !ruby/object:Gem::Requirement
78
75
  none: false
79
76
  requirements:
80
77
  - - ! '>='
81
78
  - !ruby/object:Gem::Version
82
79
  version: '0'
83
- segments:
84
- - 0
85
- hash: -3654321242792836432
86
80
  requirements: []
87
81
  rubyforge_project:
88
82
  rubygems_version: 1.8.23