[Mongrel] setting enviroment variable

ufuk kocolu ufuk at pilli.com
Tue Feb 6 08:57:51 EST 2007


Luis Lavena wrote:
> On 2/6/07, ufuk kocolu <ufuk at pilli.com> wrote:
> <snip>
>   
>> I have one rails application which runs severals sites according to that
>> enviroment variable.
>>
>> http://article.gmane.org/gmane.comp.lang.ruby.rails/14513
>>
>> The problem is, I can do what you suggest but I want to use mongrel as
>> an NT service  (I can create multiple NT services for multiple sites)
>> for that, I have to set this enviroment variable elsewhere.
>>
>>     
>
> OK, you forgot to include in your post THAT IMPORTANT part.
>
> NT services cannot set environment variables *per-service*, unless you
> ran your application for every instance in one specific user account
>
> (ex. site1 using user1, site2 => user2, etc).
>
> That will require set environment for each user account, also making
> your application code vulnerable to _all_ these accounts (NT security
> and permissions).
>
>   
>> If there is an option to run system commands before mongrel service
>> initializes, that would work for me.
>>
>>     
>
> There isn't. Mongrel execute the config script after loading rails environment.
>
> Could I question your decision base your application/system design in
> a mail that dates 1 year, 29 weeks, 5 days, 12 hours and 26 minutes
> old?
>
> I got better functionality and less code duplication implementing
> "instances" versions of my application:
>
> All your instances share the same codebase of your application, which
> is bundled inside a gem.
>
> Each instance could be run like a normal rails application, having its
> own database.yml, but without duplicated models and controllers
> between instances.
>
> That is Fossilize, the base on what Radiant based their gemification
> distribution.
>
> Maybe that approach will suite better your needs.
>
>   

Thank you for your answer. The fact is, my application is  a year old. 
So that solution was appropriatte back then. I'll check your suggestion 
but I won't be able to change a whole application to that method.

Then, I'm stuck here.  I doubt i will find a way out of this.

Thanks again.

Ufuk.









More information about the Mongrel-users mailing list