SameShirtEveryDay.com

Personal blog of the one called Alex Gorbatchev, from Toronto, Canada.

Staging with Capistrano

Posted on June 10th, 2007 by Alex Gorbatchev. In Capistrano. No comments yet...

To configure Capistrano for the most basic staging environment, I modified my deploy.rb like so:

ENV['STAGE'] ||= "staging"

paths = {
  :staging          => "stage01.mydomain.com",
  :production       => "mydomain.com"
}

set :application,   "mydomain.com"
set :dir,           paths[ENV['STAGE'].to_sym]
set :user,          "..."

role :web, application
role :app, application
role :db,  application, :primary => true

set :deploy_to, "/home/#{user}/#{dir}"
set :use_sudo, false

As you can see, it defaults to “staging” so any calls like “cap deploy” or “cap update_code” will be performed in a safe sandbox. To go live, I have a “cap_production.bat” in the root folder:

SET STAGE=production
cap %1 %2 %3 %4 %5
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet, be the first one!

Leave a Reply

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> , rel="nofollow" in use - no link dropping, no keywords or domains as names; do not spam, and do not advertise!

home
Subscribe to this blog Follow me on Twitter My bookmarks on Delicious My photography on Flickr