[Mongrel] Finding out on which port mongrel is running

Philip Hallstrom mongrel at philip.pjkh.com
Fri Aug 4 12:33:25 EDT 2006

>>> Yes, this would be an option. Unfortunately I would loose the
>>> possibility
>>> to use the nice mongrel_cluster gem to manage my cluster (maybe
>>> this would
>>> be a useful addition to mongrel_cluster).
>> The port is included in the name of the pid file. Could you just
>> parse it from the file name?
> yes, that's what I'm in fact doing now :-)
> But I have to open every file matching the mongrel.<portnumber>.pid
> pattern and check if the stored pid matches the current pid.
> ... not the most elegant solution :-/ but it works

We have the exception_notification plugin which emails us when there is a 
rails error... in that email we get the following:

   * URL:

I just checked a couple of them and that :8004 changes to whatever the 
port is that is that mongrel.  Digging through the code for the plugin I 
see this in a view:

* URL: <%= @request.protocol %><%= @host %><%= @request.request_uri %>

and this in a lib:

:exception => exception, :host => request.env["HTTP_HOST"],

We're using apache 2.2 and mongrel 0.3.13....

So it's gettable...

More information about the Mongrel-users mailing list