[ANN] SwitchTower 1.0.0

SwitchTower is a utility that can execute commands in parallel on
multiple servers. It allows you to define tasks, which can include
commands that are executed on the servers. You can also define roles
for your servers, and then specify that certain tasks apply only to
certain roles.

Manual: http://manuals.rubyonrails.org/read/book/17
Project: http://rubyforge.org/projects/switchtower
Download: http://rubyforge.org/frs/?group_id=1014
Install: gem install switchtower

SwitchTower 1.0 fixes several bugs and adds many new features. Here’s
a quick run-down of some of the more notable recent changes (in no
particular order):

  • Added a :rails_env variable (which defaults to “production”), so
    that tasks that employ the RAILS_ENV environment variable can change
    its value, if necessary.

  • Make UPPERCASE variables work.

  • Only chmod the revisions.log file when it is first created, to
    avoid problems on some unices where a chmod is not allowed unless you
    are the creator of the file.

  • Changed the :restart_via variable to a boolean :use_sudo variable.
    (Note, this will break your recipes if you are using :restart_via–
    please change that to :use_sudo!) Any task that previously used sudo
    will now respect the value of this variable.

  • Added spinner, cold_deploy, and invoke tasks. The spinner task is
    used for starting the application spinner process. The cold_deploy
    task is used for deploying your application when a spinner is not
    running, and the invoke task is used for executing arbitrary command-
    lines on your servers without needing to write a task for it.

  • Fixed the strftime format string that was used in the CVS module,
    to make it Windows compatible.

  • Added three new SCM modules: perforce (submitted by Richard
    McMahon), bazaar (submitted by Edd Dumbill), and bazaar-ng (submitted
    by Damien M.).

  • Proc-valued variables can be set much more conveniently now. Just
    do “set(:variable) { ‘foo’ }”.

  • Added optional :svn_username and :svn_password variables, for
    people who’s svn credentials differ from their login credentials.

  • Added branch support to the CVS module (courtesy of Jeremy
    Hinegardner).

  • Fixed bug where using “put” to replace a file with a shorter file
    would only overwrite the first part of the file.

  • Added an extension mechanism so that recipe files may easily import
    third-party tasks and methods. (See http://manuals.rubyonrails.org/
    read/chapter/122)

SwitchTower depends on Net::SSH 1.0.8 (which was also released
tonight, quietly), so when installing SwitchTower be sure to install
that as a dependency. (Note that installing via gems takes care of
this for you, automatically.)

The manual has been updated with the latest changes (though I’m sure
I may have missed some places). Be sure to check out the complete
release notes (http://rubyforge.org/frs/shownotes.php?
release_id=4327) for all of the juicy details.

Enjoy!

  • Jamis

Three cheers for Jamis!

Thanks
-Ezra

On Feb 18, 2006, at 9:01 PM, Jamis B. wrote:

  • Only chmod the revisions.log file when it is first created, to
    task is used for deploying your application when a spinner is not
  • Proc-valued variables can be set much more conveniently now. Just

sure I may have missed some places). Be sure to check out the

-Ezra Z.
WebMaster
Yakima Herald-Republic Newspaper
[email protected]
509-577-7732

Jamis B. [email protected] writes:

SwitchTower is a utility that can execute commands in parallel on
multiple servers. It allows you to define tasks, which can include
commands that are executed on the servers. You can also define roles
for your servers, and then specify that certain tasks apply only to
certain roles.

Manual: http://manuals.rubyonrails.org/read/book/17
Project: http://rubyforge.org/projects/switchtower
Download: http://rubyforge.org/frs/?group_id=1014
Install: gem install switchtower

What is the prefered place for reports/requests?

[~pr]0% switchtower -vvv -r config/deploy.rb -a update_code
loading configuration
/local/ruby-1.8.4/lib/ruby/gems/1.8/gems/switchtower-1.0.1/lib/switchtower/recipes/standard.rb
loading configuration ./config/deploy.rb

  • executing task update_code
  • determining current_branch…
    /local/ruby-1.8.4/lib/ruby/gems/1.8/gems/switchtower-1.0.1/lib/switchtower/configuration.rb:239:in
    method_missing': undefined method local’ for
    #SwitchTower::Configuration:0x1005ee0c8 (NoMethodError)
    from
    /local/ruby-1.8.4/lib/ruby/gems/1.8/gems/switchtower-1.0.1/lib/switchtower/scm/cvs.rb:119:in
    cvs_local' from /local/ruby-1.8.4/lib/ruby/gems/1.8/gems/switchtower-1.0.1/lib/switchtower/scm/cvs.rb:62:in current_branch’
    from
    /local/ruby-1.8.4/lib/ruby/gems/1.8/gems/switchtower-1.0.1/lib/switchtower/scm/cvs.rb:37:in
    initialize' from /local/ruby-1.8.4/lib/ruby/gems/1.8/gems/switchtower-1.0.1/lib/switchtower/configuration.rb:88:in []’
    from
    /local/ruby-1.8.4/lib/ruby/gems/1.8/gems/switchtower-1.0.1/lib/switchtower/configuration.rb:237:in
    method_missing' from /local/ruby-1.8.4/lib/ruby/gems/1.8/gems/switchtower-1.0.1/lib/switchtower/scm/cvs.rb:72:in checkout’
    from
    /local/ruby-1.8.4/lib/ruby/gems/1.8/gems/switchtower-1.0.1/lib/switchtower/recipes/standard.rb:72:in
    load' from /local/ruby-1.8.4/lib/ruby/gems/1.8/gems/switchtower-1.0.1/lib/switchtower/actor.rb:125:in update_code’
    from
    /local/ruby-1.8.4/lib/ruby/gems/1.8/gems/switchtower-1.0.1/lib/switchtower/cli.rb:242:in
    execute_recipes!' from /local/ruby-1.8.4/lib/ruby/gems/1.8/gems/switchtower-1.0.1/lib/switchtower/cli.rb:242:in execute_recipes!’
    from
    /local/ruby-1.8.4/lib/ruby/gems/1.8/gems/switchtower-1.0.1/lib/switchtower/cli.rb:217:in
    execute!' from /local/ruby-1.8.4/lib/ruby/gems/1.8/gems/switchtower-1.0.1/lib/switchtower/cli.rb:12:in execute!’
    from
    /local/ruby-1.8.4/lib/ruby/gems/1.8/gems/switchtower-1.0.1/bin/switchtower:11
    from /local/ruby/bin/switchtower:18

(Explicitly setting :local is the workaround.)

Is there any plan to nicely support local execution in the future? We
don’t have major web serving requirements, and it would be a little
more convenient to me to not have to ssh to localhost, while still
providing the nice rollback capability and abstraction for if we ever
do have major web serving requirements.

Steve