Capazon 0.2 Released - Capistrano 2.0 Compatible

Capazon 0.2.0 is out. There’s only one new feature: support for Capistrano 2.0. There’s no backwards compatibility. If you’re still on Capistrano 1.4.x, please don’t upgrade. It won’t work.

To update Capazon:

  • gem install capazon

Changes

Capistrano 2.0 has support for Rake-like namespaces, so I’ve moved all tasks provided by Capazon to the ec2 namespace:

$ cap ec2:describe_images
  * executing `ec2:describe_images'
IMAGE   ami-0386636a    rbuilder-online/nuxleus-1.3-x86_9327.img.manifest.xml  099034111737     available       true
IMAGE   ami-0683666f    rbuilder-online/fedoracore6-1.0-x86_9677.img.manifest.xml       099034111737    available       true
[...]

To call these tasks from another namespace in a Capistrano recipe:

namespace :whatever do
  task :something_cool do
    [...]
    ec2.describe_images
    [...]
  end
end

Capistrano 2.0

Turns out updating extensions to work w/ Capistrano 2.0 is extremely easy. Just replace blocks like this:

Capistrano.configuration(:must_exist).load do
  task :take_over_the _world do
    [...]
  end
end

...with this:

Capistrano::Configuration.instance.load do do
  task :take_over_the _world do
    [...]
  end
end

For more on upgrading your recipes to Capistrano 2, head over to the upgrade guide on Capistrano’s new website or this post on NubyOnRails. Happy capifying!

Capazon - Capistrano Meets Amazon EC2

UPDATE: For those looking for Capistrano 2.0 support, check out Capazon 0.2.0

Just a quick note to announce Capazon 0.1.0, a Capistrano extension library to manage Amazon EC2 instances. If you are familiar with Capistrano and have an Amazon EC2 account, give it a whirl:

  • gem install capazon
  • Edit your your config/deploy.rb:
require 'capazon'

#AWS login info
set :aws_access_key_id, 'XXX'
set :aws_secret_access_key, 'X'

# Name of the keypair used to spawn and connect to the Amazon EC2 Instance
# Defaults to one created by the setup_keypair task
set :aws_keypair_name, "#{application}-capazon"

# Path to the private key for the Amazon EC2 Instance mentioned above
# Detaults to one created by setup_keypair task
set :aws_private_key_path, "#{Dir.pwd}/#{aws_keypair_name}-key"

#defaults to an ubuntu image
#set :aws_ami_id, "ami-e4b6538d"

#defaults to, um, default
#set :aws_security_group, "default"
  • $ cap describe_images
  * executing task describe_images
IMAGE   ami-0386636a    rbuilder-online/nuxleus-1.3-x86_9327.img.manifest.xml   099034111737    available       true
IMAGE   ami-08866361    rbuilder-online/test1-1.0-x86_9326.img.manifest.xml     099034111737    available       true
IMAGE   ami-1281647b    rbuilder-online/mw-tour-1.6.8-x86_9458.img.manifest.xml 099034111737    available       true
IMAGE   ami-1681647f    rbuilder-online/mw-tour-1.6.8-x86_9459.img.manifest.xml 099034111737    available       true
  • $ AWS_AMI_ID=XXXX cap run_instance

This release just scratches the surface of what I hope to accomplish with Capazon – my end goal is to provide a shared AMI as a companion to Capazon which will encapsulate some Rails deployment best practices.

Please report any bugs you may come across, and stay tuned for updates!