On Jul 25, 2006, at 9:08 AM, Mayank Thanawala wrote:
> Hi all,
>
> BackgrounDrb was exactly what I needed for a project I''m working
on at
> work. Everyone''s really impressed, and now it''s time to
put the
> system into production.
>
> My question is, how do I avoid having to manually run the startup and
> shutdown scripts (or the rake tasks) for backgroundrb?
>
> I tried putting a system "rake backgroundrb:start" in my
> environment.rb, and it worked, but (a) it won''t handle the
shutdown,
> so if I restart the web server, I''ll have two instances of
> backgroundrb running, which can''t be good; and (b) in production,
> there are multiple dispatch.fcgi instances (using Apache/FastCGI), so
> doesn''t that mean environment.rb will get called twice, once again
> leading me to multiple backgroundrb instances?
>
> Any input on the preferred way to do this would be most helpful.
>
> Thanks again Ezra for a wonderful resource!
>
> Mayank
Hi Mayank-
One way I have done this is to make a wrapper script for starting
and stopping my rails app. I usually use mongrel and mongrel_cluster
for my apps now. So I make a script that checks to see if bgdrb is
already running and either restart or start it and then use system to
start the mongrel cluster. Then I do the same thing for a restart or
shutdown script. This way I create a single point of entry and exit
from my app that I can use to start and stop the drb server. I am
working hard on a new version of the plugin that addresses a bunch of
issues that have shaken out now that a lot of people are using this
plugin. IT will address this issue as well as others and make
deployment with bgdrb even easier.
Cheers-
-Ezra