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!

Comments

Leave a response

  1. Ilya Grigorik had this to say Wed, 28 Mar 2007 01:50:04 GMT

    Very cool. Question, how are you handling dns when you deploy your app? Also, database persistence? :)

  2. Jesse Newland had this to say Wed, 28 Mar 2007 02:21:29 GMT

    For DNS, I’ve simply created a CNAME for soylentfoo.jnewland.com pointing to the amazon hostname for the instance it’s running on.

    For database persistance – I’m currently backing up the DB every hour to s3. s3infinidisk shows some real promise, however.

  3. Alex MacCaw had this to say Sun, 01 Apr 2007 23:06:00 GMT

    Great stuff! What about bundling images, registering them with ec2 and uploading them to s3?

    http://niblets.wordpress.com/2007/02/12/capistrano-ec2-sitting-in-a-tree-k-i-s-s-i-n-g/

  4. TJ had this to say Wed, 18 Apr 2007 11:44:50 GMT

    I’ve install amazon-ec2 gem, installed capazon gem, have ruby 1.8.5, but when I try this example I got an error in /capazon-0.1.1/lib/capazon/capistrano_plugin.rb

    no such file to load—ec2 (LoadError)

    It seems that the most recent amazon-ec2 gem uses EC2.rb, not ec2.rb

  5. Jesse Newland had this to say Wed, 18 Apr 2007 15:13:53 GMT

    Hey, TJ – Thanks for reporting that. I’ll take a look and fix it ASAP.

Your Comments