The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Deploying to Staging and Production with Capistrano

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Guy Naor

Posts: 104
Nickname: familyguy
Registered: Mar, 2006

Guy Naor is one of the founders of famundo.com and a long time developer
Deploying to Staging and Production with Capistrano Posted: Sep 28, 2006 2:31 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Guy Naor.
Original Post: Deploying to Staging and Production with Capistrano
Feed Title: Famundo - The Dev Blog
Feed URL: http://devblog.famundo.com/xml/rss/feed.xml
Feed Description: A blog describing the development and related technologies involved in creating famundo.com - a family management sytem written using Ruby On Rails and postgres
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Guy Naor
Latest Posts From Famundo - The Dev Blog

Advertisement

After an application is released, deployment should be in stages. To a test server, a staging server and a production one. I hope you have a staging server...

But capistrano has no knowledge of the difference between a staging and a production server. To make it easy to deploy using capistrano, a small change is needed to deploy.rb.

We add an if statement based off of an environment variable, and with it select the servers to deploy to. I also use this same variable to protect my production servers from accidental data changes, by adding an if to all data altering recipies I use only in staging (like reloading the DB and such). This way there's no way to run those commands on the production server.

Now, to deploy on staging: env DEPLOY='STAGING' cap deploy

And on production: env DEPLOY='PRODUCTION' cap deploy

Here's a small snippet of code with the change:

if ENV['DEPLOY'] == 'PRODUCTION'
   puts "*** Deploying to the \033[1;41m  PRODUCTION  \033[0m servers!"
   role :web, "www.your.domain.com"
   role :app, "app.your.domain.com
   role :db,  "db.your.domain.com", :primary => true
else
   puts "*** Deploying to the \033[1;42m  STAGING  \033[0m server!"
   role :web, "www.staging.domain.com"
   role :app, "app.staging.domain.com
   role :db,  "db.staging.domain.com", :primary => true
end

Read: Deploying to Staging and Production with Capistrano

Topic: Eurogamers, heh Previous Topic   Next Topic Topic: Two Down

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use