Project

cloud_info

0.0
No commit activity in last 3 years
No release in over 3 years
cloud_info summary
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.5.1
>= 1.0.0
>= 1.10.0
 Project Readme

CloudInfo

Summary

Assumes you're using engineyard's amazon could. Allows you to use capistrano deployments to engineyard's amazon cloud without having to update your capistrano deploy.rb every time you add in instances in their gui.

Install

sudo gem install cloud_info --source http://gemcutter.org

Set up your ~/.ey-cloud.yml file. Set up your ~/.ssh/id-rsa-flex-key private key.

Usage

in your deploy.rb

require 'cloud_info'

task :production do
  ey_env_name = "prod1" # this is the environment name in EY's gui interface
  cloud_info = CloudInfo.new(ey_env_name, :private_key => "~/.ssh/id-rsa-flex-key")

  role :db, cloud_info.app_master, :primary => true
  # web and app slices
  cloud_info.apps.each do |info|
    role :web, info[1]
    role :app, info[1], :sphinx => true
  end

  # utility slices
  cloud_info.utils.each do |info|
    role :app, info[1], :sphinx => true
  end

  set :environment_database, Proc.new { production_database }
  set :user,          'deploy'
  set :runner,        'deploy'
  set :rails_env,     'production'
end

To look at what the hosts contain use script/console. cloud_info.apps, cloud_info.utils just holds a hash of keys and dns_names.

./script/console

require "cloud_info"
cloud_info = CloudInfo.new("prod1")
pp cloud_info.apps
{
  "prod1_app0" => '123.456.789.123',
  "prod1_app1" => 'ec-123.456.789.123.whatever'
}

pp cloud_info.hosts # shows all hosts
{
  "prod1_app0" => '123.456.789.123', # app_master
  "prod1_app1" => 'ec-123.456.789.123.whatever', # app
  "prod1_db0" => 'ec-123.456.789.123.whatever', # db_master
  "prod1_db1" => 'ec-123.456.789.123.whatever', # db_slave
  "prod1_util0" => 'ec-123.456.789.123.whatever', # util instance, name util0
}

Compatibility

Tested with Ruby 1.8.6.

Thanks