Code Monkey home page Code Monkey logo

capistrano-scalr's Introduction

capistrano-scalr

The capistrano-scalr gem conveniently packages modified versions of Donovan Bray's Scalr capistrano recipes.

Installation and Usage

First, install the gem:

gem install capistrano-scalr

After gem installation, add the following to your deploy.rb:

set :gateway, "<gateway_host>"
role :gw, gateway, :no_release => true
set :gateway_type, "<centos|ubuntu>"
require 'capistrano-scalr'

The above will automatically connect to your scalr farm using the gateway you specify (the primary database server is a logical choice, since it usually stays pretty static), enumerate the instances in your farm, and populate the scalr_hosts array with the instances. You can then define roles based on scalr_hosts:

role :lb, :no_release => true do
  scalr_hosts['loadbalancer']
end
role :web, :no_release => true do 
  scalr_hosts['www'] 
end 
role :app do 
 scalr_hosts['app'] 
end 
role :db, :no_release => true do 
 scalr_hosts['mysql'] 
end
role :memcached, :no_release => true do 
  scalr_hosts['memcached'] 
end

I also recommend that you use ssh-agent on your development workstation, enable agent forwarding on your scalr hosts, and set this in deploy.rb:

set :ssh_options, { :forward_agent => true }

Once you have completed the above, you can test for proper operation by running the scalr:enum cap task:

$ cap scalr:enum
  * executing `scalr:enum'
 ** SCALR Hosts:
  * executing "find /etc/aws/hosts | cut -d\"/\" -f5,6 | grep \"/\""
    servers: ["scalrgw.domain.net"]
  * establishing connection to gateway `scalrgw.domain.net'
  * Creating gateway using scalrgw.domain.net
  * establishing connection to `scalrgw.domain.net' via gateway
    [scalrgw.domain.net] executing command
 ** app/10.0.0.1
 ** app/10.0.0.2
 ** www/10.0.0.3
 ** www/10.0.0.4
 ** mysql/10.0.0.5
 ** mysql/10.0.0.6
 ** mysql-slave/10.0.0.5
 ** mysql-master/10.0.0.6
    command finished

You should now be able to deploy to your scalr farm via capistrano, and not have to worry about having to adjust your deploy.rb when instances change.

TODO

  • Auto-detect gateway platform

Credits

  • Thanks to Donovan Bray, the original author of the Scalr capistrano recipes on which this gem's recipes are based
  • Thanks to Jamis Buck for the fantastic Capistrano

capistrano-scalr's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

donnoman mandg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.