[Mongrel] Finding out on which port mongrel is running

Maximilian Schoefmann schoefma at cip.ifi.lmu.de
Fri Aug 4 05:48:48 EDT 2006


> On Fri, Aug 04, 2006 at 10:42:26AM +0200, Maximilian Schoefmann wrote:
>> > On 03/08/06, Maximilian Schoefmann <schoefma at cip.ifi.lmu.de> wrote:
>> >> What's the best way to find out on which port mongrel is running from
>> >> within Rails?
>> >
>> > Why would you want to do this? If you set it up, you should know which
>> > ports you've configured...
>>
>> I want to invoke a maintenance method on all instances through a
>> webinterface. To do this I do a local http call to the other mongrels
>> from
>> the current mongrel.
>> The problem is of course, that the current mongrel gets a timeout when
>> it
>> tries to call itself (thus I need to know the port to be able to skip
>> it).
>>
>> I'm of course open for better ideas how to accomplish this
>
> Maybe storing the port in an environment variable in the call to
> mongrel_rails would work ?

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).
I just thought that it should be possibile to find it out without using
such tricks, as mongrel _has_ to know the port it is running on. But I
couldn't find something in the API docs of mongrel either.



More information about the Mongrel-users mailing list