[Mongrel] setting enviroment variable

Luis Lavena luislavena at gmail.com
Tue Feb 6 08:19:37 EST 2007


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.

-- 
Luis Lavena
Multimedia systems
-
Leaders are made, they are not born. They are made by hard effort,
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi


More information about the Mongrel-users mailing list