capistrano-asgroup is a Capistrano plugin designed to simplify the task of deploying to infrastructure hosted on Amazon EC2. It was completely inspired by the capistrano-ec2group and capistrano-ec2tag plugins, to which all credit is due.
Both of the prior plugins gave you "a way" to deploy using Capistrano to AWS Auto Scaling groups but both required you to do so in a non-straightforward manner by putting your Auto Scaling group in its own security group or by providing a unique tag for your Auto Scaling group. This plugin simply takes the name of the Auto Scaling group and uses that to find the Auto Scaling instances that it should deploy to. It will work with straight up hand created Auto Scaling groups (exact match of the AS group name) or with Cloud Formation created Auto Scaling groups (looking for the name in the Cloud Formation format).
In order for the plugin to list out the hostnames of your AWS Auto Scaling instances, it will need access to the Amazon AWS API. It is recommended to use IAM to create credentials with limited capabilities for this type of purpose. Specify the following in your Capistrano configuration:
set :aws_access_key_id, '...'
set :aws_secret_access_key, '...'
The plugin is distributed as a Ruby gem.
Ruby Gems
gem install capistrano-asgroup
Bundler
Using bundler?
gem install bundler
Then add the following to your Gemfile:
source 'http://rubygems.org'
gem 'capistrano-asgroup'
Install the gems in your manifest using:
bundle install
Instead of manually defining the hostnames to deploy to like this:
role :web, 'mysever1.example.com','myserver2.example.com'
Simple do this where is the name of an autoscale group:
asgroupname '<my-autoscale-group-name>', :web
So instead of:
task :production do
role :web, 'mysever1.example.com','myserver2.example.com'
logger.info 'Deploying to the PRODUCTION environment!'
end
You would do:
require 'capistrano/asgroup'
task :production do
asgroupname 'production-github-web', :web
logger.info 'Deploying to the PRODUCTION environment!'
end
capistrano-asgroup is copyright 2013 by Thomas Verbiscer, released under the MIT License (see LICENSE for details).