The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Conditional SwitchTower Configuration

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
Jamis Buck

Posts: 184
Nickname: minam
Registered: Oct, 2004

Jamis Buck is a C/Java software developer for BYU, and hacks in Ruby for fun.
Conditional SwitchTower Configuration Posted: Aug 27, 2005 1:22 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Jamis Buck.
Original Post: Conditional SwitchTower Configuration
Feed Title: the buckblogs here
Feed URL: http://weblog.jamisbuck.org/blog.cgi/programming/index.rss
Feed Description: Jamis Buck's corner of the blogging universe. Mostly about ruby, but includes ramblings on a variety of topics.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Jamis Buck
Latest Posts From the buckblogs here

Advertisement

The SwitchTower configuration language does not, by itself, support multiple configurations in the same recipe file. That is to say, SwitchTower does not provide a way to say “in this circumstance, this machine is an app server, and in this other circumstance, this other machine is an app server.”

However, because the recipe files are simply Ruby scripts, you can take advantage of Ruby’s control structures to differentiate between multiple configurations based on (for instance) an environment variable:

  if ENV["STAGE"] == "production" 
    set :deploy_to, "/var/www/prod" 
    role :app, "prod.example.com" 
  else
    set :deploy_to, "/var/www/dev" 
    role :app, "dev.example.com" 
  end

Then, you could just do:

  STAGE=production switchtower -r config/deploy -a deploy

Coming soon, SwitchTower will support setting variables directly from the command line, so you could set the variable via some -s switch, and then query the variable in the recipe file.

Read: Conditional SwitchTower Configuration

Topic: Hoodwink'd, Day Three: Clearness of Vision Previous Topic   Next Topic Topic: Driver Wants In on Rails Action

Sponsored Links



Google
  Web Artima.com   

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