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
Install: gem install switchtower
SwitchTower 1.0.1, coming hard on the heels of 1.0.0, fixes the
broken rakefile that was generated for rails applications. Nothing
else was changed.
In addition to SwitchTower 1.0.1, I''d also like to announce
SwitchTower Extensions 1.0.0, a collection of SwitchTower tasks and
methods for use in your own SwitchTower recipes. There are two tasks
provided by this library:
* watch_load. Just run "switchtower -r config/deploy -a watch_load"
and you''ll see a display of the current load (1/5/15) for each of
your servers. The display updates every 30 seconds.
* watch_requests. Run "switchtower -r config/deploy -a
watch_requests" and you''ll see a display of the current requests/
second of each of your application servers, as harvested from your
application log, in real-time.
Mostly, this library is provided as an example of how to write
SwitchTower extensions, though some may find the tasks themselves
useful. You can install SwitchTower extensions either by downloading
from http://rubyforge.org/projects/switchtower, or by rubygems (gem
install switchtower-ext). Once installed, you simply need to put
"require ''switchtower/ext/monitor''" in your
deploy.rb and the tasks
will be available to you.
- Jamis
Michael Schoen
2006-Feb-22 07:38 UTC
[Rails] Re: [ANN] SwitchTower 1.0.1, SwitchTower Extensions
> In addition to SwitchTower 1.0.1, I''d also like to announce SwitchTower > Extensions 1.0.0, a collection of SwitchTower tasks and methods for use > in your own SwitchTower recipes. There are two tasks provided by this > library:Ah, very nice. Totally minor, and I know these are just examples, but I found 3 small issues: 1. headers doesn''t properly handle a machine name that is exactly 1 char less than the load width (it doesn''t pad, leaving staggered columns). 2. hostnames are truncated if they contain dashes -- i''m assuming the regex done is meant to grab the hostname from a fully-qualified name. 3. on debian (at least) uptime reports "load average: " and not "averages: " I can give you a patch if you''d like.
Mikkel Bruun
2006-Feb-22 08:27 UTC
[Rails] [ANN] SwitchTower 1.0.1, SwitchTower Extensions
Amazing... Good job Jamis! Mikkel Bruun www.strongside.dk - Football Portal(DK) nflfeed.helenius.org - Football News(DK) ting.minline.dk - Buy Old Stuff!(DK) -- Posted with http://DevLists.com. Sign up and save your time!
Jamis Buck
2006-Feb-22 13:49 UTC
[Rails] Re: [ANN] SwitchTower 1.0.1, SwitchTower Extensions
On Feb 22, 2006, at 12:38 AM, Michael Schoen wrote:>> In addition to SwitchTower 1.0.1, I''d also like to announce >> SwitchTower Extensions 1.0.0, a collection of SwitchTower tasks >> and methods for use in your own SwitchTower recipes. There are two >> tasks provided by this library: > > Ah, very nice. Totally minor, and I know these are just examples, > but I found 3 small issues: > > 1. headers doesn''t properly handle a machine name that is exactly 1 > char less than the load width (it doesn''t pad, leaving staggered > columns). > > 2. hostnames are truncated if they contain dashes -- i''m assuming > the regex done is meant to grab the hostname from a fully-qualified > name. > > 3. on debian (at least) uptime reports "load average: " and not > "averages: " > > I can give you a patch if you''d like.A patch would be wonderful! Thank-you, Michael. - Jamis
Luke Redpath
2006-Feb-22 17:15 UTC
[Rails] Re: [ANN] SwitchTower 1.0.1, SwitchTower Extensions
Hi Jamis
One feature which I think would be nice to be included with
Switchtower, which I currently implement using my own tasks, is
provision for copying a ready to go database.yml file into the config
folder of the new release.
Because you would typically only check in an example database.yml
file, the way I''ve set things up is to create the database.yml file I
need and store it in the shared folder on the remote server. I''ve then
created a task that copies the database.yml file from shared into the
new release once its been checked out.
I''d submit a patch but to be honest I''m still a rake novice
and you
might be able to come up with something more elegant. Here is the code
I''m using if its of any use though:
desc "Copy configured database.yml to new current release"
task :copy_database_settings, :roles => :web do
run "cp #{deploy_to}/shared/database.yml
#{release_path}/config/database.yml"
end
task :after_deploy, :roles => :web do
copy_database_settings
end
The reason why I ask if it could be built in is because its typically
something you need to do with every project and its annoying to have
to copy the above into each new deploy file.
Great work with switchtower though, it truly is excellent.
On 2/22/06, Jamis Buck <jamis@37signals.com>
wrote:> On Feb 22, 2006, at 12:38 AM, Michael Schoen wrote:
>
> >> In addition to SwitchTower 1.0.1, I''d also like to
announce
> >> SwitchTower Extensions 1.0.0, a collection of SwitchTower tasks
> >> and methods for use in your own SwitchTower recipes. There are two
> >> tasks provided by this library:
> >
> > Ah, very nice. Totally minor, and I know these are just examples,
> > but I found 3 small issues:
> >
> > 1. headers doesn''t properly handle a machine name that is
exactly 1
> > char less than the load width (it doesn''t pad, leaving
staggered
> > columns).
> >
> > 2. hostnames are truncated if they contain dashes -- i''m
assuming
> > the regex done is meant to grab the hostname from a fully-qualified
> > name.
> >
> > 3. on debian (at least) uptime reports "load average: " and
not
> > "averages: "
> >
> > I can give you a patch if you''d like.
>
> A patch would be wonderful! Thank-you, Michael.
>
> - Jamis
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
Cheers,
Luke Redpath
www.lukeredpath.co.uk
Jamis Buck
2006-Feb-22 21:58 UTC
[Rails] Re: [ANN] SwitchTower 1.0.1, SwitchTower Extensions
Luke, I''ll definitely consider adding the copy_database_settings task to the standard tasks, but I wouldn''t make it executed by default (mostly because that''s not the way we use SwitchTower, and I suspect there are others that wouldn''t use that feature, either). Another option, though, is to package that up in a task library (http:// manuals.rubyonrails.org/read/chapter/122), such that it can be easily added to any of the projects you use. - Jamis On Feb 22, 2006, at 10:14 AM, Luke Redpath wrote:> Hi Jamis > > One feature which I think would be nice to be included with > Switchtower, which I currently implement using my own tasks, is > provision for copying a ready to go database.yml file into the config > folder of the new release. > > Because you would typically only check in an example database.yml > file, the way I''ve set things up is to create the database.yml file I > need and store it in the shared folder on the remote server. I''ve then > created a task that copies the database.yml file from shared into the > new release once its been checked out. > > I''d submit a patch but to be honest I''m still a rake novice and you > might be able to come up with something more elegant. Here is the code > I''m using if its of any use though: > > desc "Copy configured database.yml to new current release" > task :copy_database_settings, :roles => :web do > run "cp #{deploy_to}/shared/database.yml #{release_path}/config/ > database.yml" > end > > task :after_deploy, :roles => :web do > copy_database_settings > end > > The reason why I ask if it could be built in is because its typically > something you need to do with every project and its annoying to have > to copy the above into each new deploy file. > > Great work with switchtower though, it truly is excellent. > > On 2/22/06, Jamis Buck <jamis@37signals.com> wrote: >> On Feb 22, 2006, at 12:38 AM, Michael Schoen wrote: >> >>>> In addition to SwitchTower 1.0.1, I''d also like to announce >>>> SwitchTower Extensions 1.0.0, a collection of SwitchTower tasks >>>> and methods for use in your own SwitchTower recipes. There are two >>>> tasks provided by this library: >>> >>> Ah, very nice. Totally minor, and I know these are just examples, >>> but I found 3 small issues: >>> >>> 1. headers doesn''t properly handle a machine name that is exactly 1 >>> char less than the load width (it doesn''t pad, leaving staggered >>> columns). >>> >>> 2. hostnames are truncated if they contain dashes -- i''m assuming >>> the regex done is meant to grab the hostname from a fully-qualified >>> name. >>> >>> 3. on debian (at least) uptime reports "load average: " and not >>> "averages: " >>> >>> I can give you a patch if you''d like. >> >> A patch would be wonderful! Thank-you, Michael. >> >> - Jamis >> >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > > -- > Cheers, > Luke Redpath > www.lukeredpath.co.uk > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Michael Schoen
2006-Feb-22 23:38 UTC
[Rails] Re: [ANN] SwitchTower 1.0.1, SwitchTower Extensions
> A patch would be wonderful! Thank-you, Michael.Let me know if the formatting below doesn''t work and I''ll email you an attachment. All changes are to monitor.rb: 39,40c39,41 < padding = size - header.length - 1 < print " ", "-" * padding if padding > 0 --- > padding = size - header.length > print " " if padding > 0 > print "-" * (padding - 1) if padding > 1 50c51 < names = servers.map { |s| s.match(/^(\w+)/)[1] } --- > names = servers.map { |s| s.match(/^([^.]+)/)[1] } 57c58 < parser = Proc.new { |text| text.match(/averages: (.*)$/)[1].split(/, /) } --- > parser = Proc.new { |text| text.match(/average.*: (.*)$/)[1].split(/, /) }
Jamis -- it doesn''t look like this patches made it into the new Capistrano Extensions... Michael Schoen wrote:>> A patch would be wonderful! Thank-you, Michael. > > Let me know if the formatting below doesn''t work and I''ll email you an > attachment. All changes are to monitor.rb: > > 39,40c39,41 > < padding = size - header.length - 1 > < print " ", "-" * padding if padding > 0 > --- > > padding = size - header.length > > print " " if padding > 0 > > print "-" * (padding - 1) if padding > 1 > 50c51 > < names = servers.map { |s| s.match(/^(\w+)/)[1] } > --- > > names = servers.map { |s| s.match(/^([^.]+)/)[1] } > 57c58 > < parser = Proc.new { |text| text.match(/averages: > (.*)$/)[1].split(/, /) } > --- > > parser = Proc.new { |text| text.match(/average.*: > (.*)$/)[1].split(/, /) } > > > >
Jamis Buck
2006-Mar-24 03:14 UTC
[Rails] Re: [ANN] SwitchTower 1.0.1, SwitchTower Extensions
Michael, My apologies for letting this patch languish for so long. It didn''t make it into 1.0.1 because at that point I was just trying to get the SwitchTower/Capistrano debacle taken care of and out of the way. I''ve committed your patch, so it will be part of the next Capistrano Extensions release. Again, my apologies for not acting on this sooner. - Jamis On Feb 22, 2006, at 4:38 PM, Michael Schoen wrote:>> A patch would be wonderful! Thank-you, Michael. > > Let me know if the formatting below doesn''t work and I''ll email you > an attachment. All changes are to monitor.rb: > > 39,40c39,41 > < padding = size - header.length - 1 > < print " ", "-" * padding if padding > 0 > --- > > padding = size - header.length > > print " " if padding > 0 > > print "-" * (padding - 1) if padding > 1 > 50c51 > < names = servers.map { |s| s.match(/^(\w+)/)[1] } > --- > > names = servers.map { |s| s.match(/^([^.]+)/)[1] } > 57c58 > < parser = Proc.new { |text| text.match(/averages: (.*)$/) > [1].split(/, /) } > --- > > parser = Proc.new { |text| text.match(/average.*: (.*)$/) > [1].split(/, /) } > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Robert MannI
2006-Mar-24 11:25 UTC
[Rails] Re: [ANN] SwitchTower 1.0.1, SwitchTower Extensions
Luke, this is what I do to "copy" the current database to the current
release:
task :after_deploy do
# create a link to database.yml
run <<-CMD
rm -rf #{current_path}/config/database.yml &&
ln -nfs #{shared_path}/config/database.yml
#{current_path}/config/database.yml
CMD
restart
end
On 3/24/06, Jamis Buck <jamis@37signals.com>
wrote:> Michael,
>
> My apologies for letting this patch languish for so long. It
didn''t
> make it into 1.0.1 because at that point I was just trying to get the
> SwitchTower/Capistrano debacle taken care of and out of the way.
>
> I''ve committed your patch, so it will be part of the next
Capistrano
> Extensions release. Again, my apologies for not acting on this sooner.
>
> - Jamis
>
> On Feb 22, 2006, at 4:38 PM, Michael Schoen wrote:
>
> >> A patch would be wonderful! Thank-you, Michael.
> >
> > Let me know if the formatting below doesn''t work and
I''ll email you
> > an attachment. All changes are to monitor.rb:
> >
> > 39,40c39,41
> > < padding = size - header.length - 1
> > < print " ", "-" * padding if padding
> 0
> > ---
> > > padding = size - header.length
> > > print " " if padding > 0
> > > print "-" * (padding - 1) if padding > 1
> > 50c51
> > < names = servers.map { |s| s.match(/^(\w+)/)[1] }
> > ---
> > > names = servers.map { |s| s.match(/^([^.]+)/)[1] }
> > 57c58
> > < parser = Proc.new { |text| text.match(/averages: (.*)$/)
> > [1].split(/, /) }
> > ---
> > > parser = Proc.new { |text| text.match(/average.*: (.*)$/)
> > [1].split(/, /) }
> >
> >
> >
> > _______________________________________________
> > Rails mailing list
> > Rails@lists.rubyonrails.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>