[Backgroundrb-devel] Capistrano Hanging on Deployment

Ben Reubenstein benr at x-cr.com
Fri Mar 16 12:33:28 EDT 2007


Hi Philip ~

I am having this issue too and have been meaning to post.  I am using the
init script on Gentoo, and it works perfectly if I am in the machine but
when running from capistrano it will report a successful start/stop but the
process is nowhere to be found.  I have to login to the machine and start it
manually.  I am running on the latest version so I don't think it is a
backgroundrb version issue.

~ Ben

On 3/15/07, Philip Lipu Tsai <tsailipu at gmail.com> wrote:
>
> Erza,
>
> I am on Centos and bash, Rails 1.2.2, Ruby 1.8.4, BackgrounDrb old version
> (the 0.1.x version right before 0.2...  Is the depend() section peculiar
> only to Gentoo?  If not, anything one needs to do for this?
>
> I wrote a script just similar to this (w/o paying attention to the
> depend() section) and have capistrano before_restart task invoke the
> "/etc/init.d/backgroundrbd restart" (which is just stop and then start).
> However, this problem of backgroundrb's exiting after cap task's successful
> completion occurs (yes, no hanging in cap's process, but backgroundrb quits
> even though it is started in -d mode; the pid log file is there, but the
> process is no longer).  Prepending with "nohup" in start seems to work, but
> I thought by using init.d style, one needn't worry about the nohup
> problem, either.  Any insight?  (Or is this a 0.1.x problem?)
>
> Thanks,
> Philip
>
> On 3/12/07, Ezra Zygmuntowicz <ezmobius at gmail.com> wrote:
> >
> >
> >         Yeah there are some weird interactions between capistrano and
> > some
> > daemons, the old version of backgroundrb exibits this behavior. That
> > way I get around it is by creating an init.d script, then letting
> > capuse that to restart bdrb. Works like a charm. Here is an init.d
> > script for Gentoo systems, it should be easy to adapt to any other
> > unixy system.:
> >
> > #!/sbin/runscript
> > # Copyright 1999-2004 Gentoo Foundation
> > # Distributed under the terms of the GNU General Public License v2
> > # $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx-r1,v
> > 1.1 2006/07/04 16:58:38 voxus Exp $
> >
> >
> > depend() {
> >          need net
> >          use dns
> >          after gfs
> > }
> > start() {
> >          ebegin "Starting bdrb2"
> >            RAILS_ENV=demo /data/toolbox/current/script/backgroundrb/
> > start -d
> >          eend $? "Failed to start bdrb2"
> > }
> >
> > stop() {
> >          ebegin "Stopping bdrb2"
> >               kill -9 `cat /data/toolbox/current/log/
> > backgroundrb.pid` 2>/dev/null; true
> >          eend $? "Failed to stop bdrb2"
> > }
> >
> >
> >
> > Cheers-
> > -Ezra
> >
> >
> > On Mar 12, 2007, at 10:47 AM, Ben Reubenstein wrote:
> >
> > > Hello ~
> > >
> > > I am using the Capistrano recipe outlined in this post to restart
> > > my backgroundrb server:
> > >
> > > http://rubyforge.org/pipermail/backgroundrb-devel/2007-February/
> > > 000718.html
> > >
> > > My Version:
> > > ~~~~~~~~~~~~
> > > task :before_restart, :roles => :app do
> > >    restart_backgroundrb
> > > end
> > >
> > > task :start_backgroundrb, :roles => :app do
> > >    sudo "nohup /var/www/rails/#{application}/current/script/
> > > backgroundrb/start "
> > > end
> > >
> > > task :stop_backgroundrb, :roles => :app do
> > >    sudo "kill -9 `cat /var/www/rails/#{application}/current/log/
> > > backgroundrb.pid` 2>/dev/null; true"
> > > end
> > >
> > > task :restart_backgroundrb, :roles => :app do
> > >    stop_backgroundrb
> > >    start_backgroundrb
> > > end
> > > ~~~~~~~~~~~~
> > >
> > > The backgroundrb server is stopped and started but hangs at the
> > > start_backgroundrb task.  Capistrano shows:
> > >
> > >   * executing task start_backgroundrb
> > >   * executing "sudo  nohup /var/www/rails/*************/current/
> > > script/backgroundrb/start"
> > >     servers: ["host"]
> > >     [host] executing command
> > >  ** [out :: host] nohup: ignoring input and appending output to
> > > `nohup.out'
> > >
> > > It will hang there and not restart the main web app process.  I
> > > updated my gems to see if this was a version issue, but am
> > > experiencing the same problem.  I also tried running this
> > > task :after_restart, the web app is successfully restarted, but it
> > > still hangs.
> > >
> > > Thanks in advance for any ideas on how to fix this.
> > >
> > > ~ Ben
> > >
> > > --
> > > Ben Reubenstein
> > > 303-947-0446
> > > http://www.benr75.com
> > > _______________________________________________
> > > Backgroundrb-devel mailing list
> > > Backgroundrb-devel at rubyforge.org
> > > http://rubyforge.org/mailman/listinfo/backgroundrb-devel
> >
> > -- Ezra Zygmuntowicz
> > -- Lead Rails Evangelist
> > -- ez at engineyard.com
> > -- Engine Yard, Serious Rails Hosting
> > -- (866) 518-YARD (9273)
> >
> >
> > _______________________________________________
> > Backgroundrb-devel mailing list
> > Backgroundrb-devel at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/backgroundrb-devel
> >
>
>
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>



-- 
Ben Reubenstein
303-947-0446
http://www.benr75.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20070316/e7ad6bf3/attachment.html 


More information about the Backgroundrb-devel mailing list