Mongrel and backgroundrb

Hey Daya-

  If you get the latest version of the plugin you will find that there is now win32 service support so you can run the drb server as a win32 service. Look in the script/backgroundrb folder for the windows specific scripts. And about starting the drb server when you start mongrel, here's the thing, you have to start the drb server *before* you can start mongrel or else it won't work correctly. So the easiest thing to do is write yourself a wrapper script that first starts the drb server and then fires up your mongrels.

Cheers-
-Ezra

Hi All

I am wondering how can I start the backgroundrb server when I start a

mongrel server.

My setup (for a demo) is Lighttpd (load balancer) and 4 mongrels (2
mongrels on one machine). All of my machine are Windows.

On windows to start backgroundrb I do

C:\myspace\myapp>ruby script\backgroundrb\start -p 9999
start: invalid option: -p
DRb URI: druby://localhost:22222
Pid: 2336
Autostart…
done

As you can see backgroundrb start script ignores the port (i might

have
to change the code)to use different ports for 2 mongrel instances.

So my question is how do I start backgroundrb when I start mongrel.

thanks
-daya

Hey Daya-

   If you get the latest version of the plugin you will find that there

is now win32 service support so you can run the drb server as a win32
service. Look in the script/backgroundrb folder for the windows

specific scripts. And about starting the drb server when you start
mongrel, here’s the thing, you have to start the drb server before
you can start mongrel or else it won’t work correctly. So the easiest
thing to do is write yourself a wrapper script that first starts the

drb server and then fires up your mongrels.

Cheers-
-Ezra

Ezra

Thanks for the reply.

I can write a wrapper script to start DRb before mongrel but the DRb start script in script\backgroundrb\start doesn’t accept -p (port) argument.

I can’t use service for the same reason and also because I am running multiple mongrels (from same app folder) on the same machine and for each I want to start the DRb at different port.

Any idea on how I can do this…

thanks

-daya

Ezra

Thanks for the reply.

I can write a wrapper script to start DRb before mongrel but the DRb start script in script\backgroundrb\start doesn't accept -p (port) argument.

I can't use service for the same reason and also because I am running multiple mongrels (from same app folder) on the same machine and for each I want to start the DRb at different port.

Any idea on how I can do this..

thanks
-daya

Daya-

  Are you running multiple mongrels for just one app? Or are you running multiple sites of the same codebase? If you are running the same app on multiple mongrels then you do not want to run each drb server on its own port as this will cause all kinds of errors. Because each request that comes into your app will go to a different mongrel backend so you are not gauranteed to get the same MiddleMan that is holding your jobs.

  On the other hand if each drb server you want to run is running for a whole app then you can use the -c option to tell the drb server where to look for a config file. So you would create a separate backgroundrb.yml file for each drb server you want to run, ie: backgroundrb1.yml, backgroundrb2.yml, etc... Then when you start the drb server for each app you use the -c option to tell it where to read its config from:

script/backgroundrb/start -c /path/to/configfile.yml

-Ezra