Capistrano 1.1

Posted by jamis March 06, 2006 @ 07:11 PM

Capistrano is a utility for executing tasks in parallel across multiple remote hosts. It was formerly known as SwitchTower.

Installation:

gem install capistrano

Version 1.1 introduces a few changes:

  • The generated capistrano.rake file is simpler now than it used to be. You can easily append custom options to individual tasks now. For instance, if you want the deploy to be silent, instead of verbose, just add “-q” to the parameter list for that task.
  • The generated capistrano.rake file uses the “remote” namespace, so you’ll need to have at least Rake 0.7.0. You can still do “rake deploy” and “rake rollback”, but the other tasks must be prefixed with the namespace (“rake remote:exec”, “rake remote:show_tasks”, etc.)
  • The ‘switchtower’ command is replaced by the ‘cap’ command.
  • The cap utility is verbose by default. If you want it to be silent, use the -q option. If you want it to be less verbose, you can specify the -v or -vv flags explicitly.
  • The cap utility uses more rake-like command-line semantics. Instead of needing to do “cap -r config/deploy -a deploy”, you can just do “cap deploy”. It will look for config/deploy.rb, capfile, or Capfile automatically, and will treat raw parameters as action names.

Upgrading/switching from SwitchTower to Capistrano is a little inconvenient. Here’s what you’ll need to do:

  • gem uninstall switchtower (remove all versions)
  • gem install capistrano
  • For each of your Rails projects, do “cap -A .”, keeping your deploy.rb
  • For each of your Rails projects, remove lib/tasks/switchtower.rake

Enjoy!

Posted in Tools | 24 comments

Comments

  1. Duarte Carrilho da Graça on 06 Mar 19:27:

    I assume the answer to «Remove executables and scripts for ‘switchtower’ in addition to the gem?» should be yes, because cap includes the same “executables and scripts”, right?

  2. grant on 06 Mar 19:31:

    Right. It removes the ‘switchtower’ executable.

  3. ilya Devèrs on 06 Mar 21:29:

    Lol, for a moment i thought it was called Capitano.

    Centuries ago i made a small website for a starving artist in St. Maarten. His name was Capitano Albert. And he made quit psychedelic paintings.

    At a very respectable age he enjoyed himself sketching out paintings, scanning them and modifying them in Paint, yes you read that right. Paint…

    If you like one of his paintings for maybe a logo or the Capistrano website i can try to figure out who owns the rights to his imagery that can be found on this site:

    http://perso.wanadoo.fr/trifan.art/

    Although i am a bit ashamed of the site design now: but it is simple, i made it in 2 days, and i did ship It! Oh, and it has big ass buttons :)

  4. ilya Devèrs on 06 Mar 21:31:

    oh, this brings directly to his gallery: http://perso.wanadoo.fr/trifan.art/albert_1.html

  5. Bugsy on 06 Mar 21:47:

    Capitano…Capistrano…two different things.

  6. ilya on 06 Mar 21:48:

    Bugsy, yes obviously so, but phonetically they look alike… It just made me smile, but maybe that is my personal humor kicking in…

  7. Brian on 06 Mar 22:17:

    SwitchTower is dead. Long live Capistrano!

    I’m still looking forward to the day when the limitation “The password for all servers is the same” is no longer there.

  8. BillSaysThis on 07 Mar 02:59:

    Running cap -A from the top level of the application (/railsapps/appname directory) I get this error:

    c:/ruby/lib/ruby/1.8/optparse.rb:446:in `parse’: missing argument: -A (OptionParser::MissingArgument)

    Any helpful ideas?

  9. Brad Daily on 07 Mar 05:02:

    Bill – You are missing the ’.’ at the end of the line that sets the target directory.

    cap -A .

  10. BillSaysThis on 07 Mar 05:12:

    That’s really funny. Thanks Brad.

  11. tim on 07 Mar 05:19:

    I’m still looking forward to the day when the limitation “The password for all servers is the same� is no longer there.

    what, no support for RSA keys in this SwitchTower thingy? you people are going to taunt me into writing some Ruby code afterall, aren’t you… ;-)

  12. tim on 07 Mar 05:20:

    I’m still looking forward to the day when the limitation “The password for all servers is the same� is no longer there.

    what, no support for RSA keys in this SwitchTower thingy? you people are going to taunt me into writing some Ruby code afterall, aren’t you… ;-)

  13. tim on 07 Mar 05:21:

    goddamnit! firefox defaults to re-submitting the form when I press space. infuriating. what software does this blog thingy run on, anyways? and where is the SVN repo for it :-)

  14. Brian Takita on 07 Mar 06:08:

    So here’s the million dollar question; Why did you rename Switchtower to Capistrano?

  15. Brian Takita on 07 Mar 06:10:

    Ooh, duh… http://weblog.rubyonrails.com/articles/2006/03/06/switchtower-is-now-capistrano

  16. Mitchell Hashimoto on 07 Mar 06:44:

    I am also looking forward to when multiple passwords for multiple servers may be set…

  17. Tracey on 07 Mar 07:30:

    Switchtower: Brilliant name

    Capistrano: WTF? Sounds like a new special offering at Olive Garden

    j/k ;-)

  18. Pascal on 07 Mar 08:36:

    I believe that to be more complete, the upgrade instructions should include:

    svn rm lib/tasks/switchtower.rake svn add lib/tasks/capistrano.rake

    so everything ends up in svn!

  19. Pascal on 07 Mar 08:38:

    I believe that to be more complete, the upgrade instructions should include:

    svn rm lib/tasks/switchtower.rake svn add lib/tasks/capistrano.rake

    so everything ends up in svn!

  20. Pascal on 07 Mar 08:39:

    Sorry for the dup, guys. My browser didn’t refresh :(

  21. John Topley on 07 Mar 10:43:

    You might want to check this blog in IE 6.0 because the layout is seriously broken. BTW I’m at work, so can’t switch to a better browser.

  22. RJ on 07 Mar 18:47:

    You may want to update the main documentation page link text, to change the name from ‘SwitchTower’ to ‘Capistrano’.

  23. John Topley on 08 Mar 09:31:

    “BTW I’m at work, so can’t switch to a better browser.”

  24. Philippe LACHAISE on 09 Mar 10:09:

    If you can buy a lawyer you can charge people for the very air they breathe :(

    Windows, Mandrake have been in the dictionnary for centuries but are now privately held. Now Switchtower !

    Where will that legal plundering stop ?