[Mongrel] Mongrel script and config options

Pete pete at kapiti.co.nz
Tue Apr 13 19:39:46 EDT 2010

Hi Luis,

Thanks for your reply.

You're right, it was me who ask the same question in github, but since it
was more related to mongrel_service and my issue has to do with rails boot
strapping it didn't seem the right place.

First up, I'm still using Rails 2.2.2.

I'm sorry, but I don't agree with you that a single code base for multiple
different rails application is a bad idea, quite the opposite actually. If
you're really interested in what we're doing, this thread explains it in
more detail: http://railsforum.com/viewtopic.php?pid=74217.

It shouldn't be too hard to see the many advantages of a single code base
over multiple code bases for serving multiple clients similar applications.

As I said, I played with the --script option but couldn't get it to work.
Here is how I start mongrel from the command line for client FOO:

mongrel_rails start -e production -p 3035 -l "log/FOO/mongrel.log" -S
"config/FOO/myapp_opts.rb" -c "x:/myapp"

But config/FOO/myapp_opts.rb is never loaded (I've also tried specifying the
full path "x:/myapp/config/FOO/myapp_opts.rb" to no avail). If this worked,
it would solve my problem. So what am I doing wrong?


> -----Original Message-----
> From: mongrel-users-bounces at rubyforge.org [mailto:mongrel-users-
> bounces at rubyforge.org] On Behalf Of Luis Lavena
> Sent: Wednesday, 14 April 2010 10:35 a.m.
> To: mongrel-users at rubyforge.org
> Subject: Re: [Mongrel] Mongrel script and config options
> On Tue, Apr 13, 2010 at 7:25 PM, Pete <pete at kapiti.co.nz> wrote:
> > Interesting is also this page http://guides.rails.info/configuring.html
> > which states under "2.Running Code Before Rails": To run some code
> before
> > Rails itself is loaded, simply put it above the call to require
> 'rails/all'
> > in your application.rb.
> >
> > If I log boot strapping of rails, I get this different sequences:
> >
> > when using mongrel via script/server (notice boot.rb appears twice!!!):
> >  boot.rb
> >  environment.rb
> >  boot.rb
> >  application.rb
> >
> > when using mongrel via mongrel_rails:
> >  environment.rb
> >  boot.rb
> >  application.rb
> >
> > Note that while the latter option is the common way to start the
> > application, the former option is what I must use to debug my rails
> > application under Netbeans.
> >
> I would avoid script/server as it loads mongrel incorrectly.
> > So clearly, running code (that fetches custom specific command line
> options)
> > before rails starts doesn't work well with either environment, let alone
> > both.
> >
> Can I know how are you doing it?
> > I've even tried to place such code inside environment.rb which is
> clearly
> > loaded before application.rb and still had no luck.
> >
> Which part? the top? the bottom? Which version of rails?
> If you place the code in config/preinitializer.rb it will be loaded
> before environment.rb fully loads.
> > So far, the only way that worked for me is to modify library code and
> this
> > is something a dread.
> >
> Please be more specific with the examples. Show us code so we can
> replicate and workout solutions.
> You can't supply command line options to mongrel_rails that are not
> supported, however, you can use either environment variables or other
> stuff.
> --
> Luis Lavena
> AREA 17
> -
> Perfection in design is achieved not when there is nothing more to add,
> but rather when there is nothing more to take away.
> Antoine de Saint-Exupéry
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users

More information about the Mongrel-users mailing list