FTBpro / cap-aws-ec2

Ruby gem to fetch instances from EC2 for you capistrano deploy script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cap::Aws::Ec2

Tired of setting hardcoded ips or dns names in your capistrano deploy script? You just found the solution!

cap-aws-ec2 will fetch instances from you EC2 region and define them by project, environment and roles.

This gem should be used in conjunction with capistrano multistage

Note: This gem is only compatibale with Capistrano 2.x

Installation

Add this line to your application's Gemfile:

gem 'cap-aws-ec2', require: false

And then execute:

$ bundle

Or install it yourself as:

$ gem install cap-aws-ec2

Usage

  1. Define tags for your servers on EC2:
Name Tag Project Tag Environment Tag Roles Tag Public IP
ftbpro-web1 ftbpro-web production app,web 1.1.1.1
ftbpro-web2 ftbpro-web production app,web 2.2.2.2
ftbpro-resque ftbpro-web production app,resque 3.3.3.3
  1. In your deploy.rb script:
require 'cap-aws-ec2'
set :aws_key_id, 'XXXXXXXXXXXXXX'
set :secret_access_key, 'XXXXXXXXXXXXXXXXXXXX'
set :aws_region, 'us-west-2' 
set :ec2_project, 'my-project-tag-value'
set(:ec2_env) { stage }
  1. In your corresponding stage file (config/deploy/production.rb):
define_servers

This will result in the following statements:

server 1.1.1.1, :app, :web
server 2.2.2.2, :app, :web
server 3.3.3.3, :app, :resque

Contributing

  1. Fork it ( http://github.com//cap-aws-ec2/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Ruby gem to fetch instances from EC2 for you capistrano deploy script

License:MIT License


Languages

Language:Ruby 100.0%