I am working on an application to help ease some of the command line stuff for ruby on rails while i learn it. I have the app starting and stopping apache as well as MySql. What i am having trouble with is starting mongrel. I would like to start this with the push of a button similar to how instantrails does, but i want it to start silently so the cmd prompt isn't seen. I want this as i don't want to have to run my app along with instantrails. i would like to do it with one app. I would really appreciate any help anyone can offer on this as i don't know much about mongrel at this point and do not see an exe file like i do with apache and mysql. Here is the link to the mongrel website http://mongrel.rubyforge.org/ and instantrails is here http://instantrails.rubyforge.org/wiki/wiki.pl

Recommended Answers

All 5 Replies

Are you trying to start it as a service ?
Have you tried using a shell command "net start mongrel_service" or use a ServiceController component to launch it ?

// Jerry

servicecontroller sounds like the right way to go. Is mongrel_service the file i need to use, and how do i associate it with the rails app when i start it?

I have no experience with Mongrel, however I write Windows Service programs in C#.

When a Windows service is installed, it registers a Service Name (as declared in the installed service application). From that point on, you call upon the service using its registered name. In this case, the mongrel website states that you use mongrel_service as the service name when starting stopping, etc.

It states that if you want to change the registered service name you can use the Mongrel_Rails program with the -D parameter to change it.

I think that the actual service file is GemPlugin, and you can use the mongrel_rails application to communicate with the windows service.

You have probably already seen this site, but http://mongrel.rubyforge.org/wiki/Win32 does explain it fairly well. I think the answer to your "how to associate" is in there too.

// Jerry

Ok i have been reading up on ServiceController and have created an instance of it. On my local machine i have this directory path C:\\ruby\ruby\bin\ and in this directory i have these files along with others of course ( mongrel_rails, mongrel_rails.bat, mongrel_rails.cmd, mongrel_rails_service.cmd) From what i see on the mongrel website it says to use mongrel_rails

excerpt from website

$ mongrel_rails service::install -N myapp \ 
      -c c:\my\path\to\myapp -p 4000 -e production
  $ mongrel_rails service::start -N myapp

So i assume, the correct file i need is the mongrel_rails file, but how do i tell ServiceController the path to that file, and then send the commands?

ClarkKent,
Sorry I can not be of more help. Maybe you can get some help from the mongrel user group.
It appears that the Mongrel_Rail program has the built in service information that it passes on to the actual server via the comand line parameters. If you can get it to work manually, then automating it from C# should be possible.

Good luck on your adventure,
Jerry

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.