[ANN] Mongrel 0.3.1 -- New Site/Runs Right

Hello All,

Yet another release of Mongrel proudly pushed out for everyone to review
and
comment on. This time though, I’ve done up a little website that’s
way
better than the plan Rdoc that used to stand in for the site like a
one-legged leper.

As you should already know, Mongrel is a fast HTTP server and library
for
Ruby partially written in C. It supports running Ruby on Rails,
Camping,
and Og+Nitro applications as well as featuring a simple API for others
to
use in their own frameworks. Performance is usually much higher than
WEBrick while the features are kept much lower.

== 0.3.1 Changes

  • This release fixes a huge bug in the Rails support where the
    Content-length was very very wrong. People who had weird problems
    downloading images should try this release and let me know the results.

  • It features a new command and plugin system (thanks to pluginfactory)
    with
    an initial start and stop command for Ruby on Rails.

  • New site that was basically stolen from all sorts of Creative Commons
    licensed sources. Please read the attributions page (
    http://mongrel.rubyforge.org/attributions.html) so they get credit.

  • Dependency problems with daemons gem solved.

== The New Rails Runner

This release features a mongrel_rails script that has start and stop
commands as well as full options for dictating it’s configuration.
Simply
do the following:

$ sudo gem install mongrel
$ cd myrailsapp
$ mongrel_rails start -d

Which runs Mongrel in the background. You can stop it with:

$ mongrel_rails stop

And you¹re all set. You can pass the start and stop commands the -h
option
to find out all the possible options.

=== Win32 Folks

The only thing you people need to do right now is avoid the -d option to
start. Win32 doesn¹t support POSIX fork so it won¹t go into the
background.
I¹ll be adding support for making Mongrel a service in a few releases.

== The Next Release

I’ll be grabbing all the various Rails applications I can and begin
testing
Mongrel against them. If anyone is building an application and is
interested in testing Mongrel with their gear then shoot me an e-mail.
There is one outstanding bug with the Rails support which I have to fix,
but
otherwise it’s working reasonably well.

Any suggestions for documentation people want are more than welcome.

Finally, I’m looking at a caching mechanism that would involve
dyanmically
storing gzip and regular versions of all returned conent into a
memcached.
I have a small prototype kind of working that does this, but I’m
interested
in people’s ideas for what they’d like in a caching system that’s
between
Rails page caching and fully dynamic content.

= Love Your Dog?

I’m looking for people who want their buddy featured on the Mongrel
site.
Just post a photo via some photo posting site and let me know where it
is.
I’ll make a page for all the “mongrels” out there. 'Cause dogs rule.

Zed A. Shaw

I see your design abilities are as impressive as your coding abilities.
Bravo!

Looking forward to watching Mongrel mature and turn the webapp world on
its ear.

:smiley:

b

Sweet! This is coming along nicely. A few comments…

  1. Why restrict mongrel_rails to only allow “development” and
    “production” as environments? Some folks (like me ;-)) have adding
    additional environments, including “qa” and “sandbox”.

  2. In a similar vein, what do you think about defaulting to
    ENV[‘RAILS_ENV’] if that’s set?

  3. Are you planning on exposing the num_processors argument to
    mongrel_rails, to allow a command-line option for setting it either
    higher or lower?

  4. Lastly, any plans to allow for a graceful restart?

Thanks again!

Awesome work!

Don’t know if this is related to mongrel at all, but for some weird
reason
when I run my rails app under mongrel, it thinks it’s in production mode
instead of development mode, even though my environment.rb settings have
not
changed.

Carl

Hello Zed. I’m under Windows and when I try installing the mongrel
gem, and I’m also requested to install the daemons dependence. At this
point it seems the system tries to build daemons locally (compiling)
but since I don’t have a compiler properly installed it doesn’t work.
Is there a binary distribution available for daemons on Windows?
Thanks.

Carl Y. wrote:

Don’t know if this is related to mongrel at all, but for some weird
reason when I run my rails app under mongrel, it thinks it’s in
production mode instead of development mode, even though my
environment.rb settings have not changed.

That’s because mongrel_rails defaults to production mode, which can be
changed using the -e command line option.

A less surprising default would be to use

ENV['RAILS_ENV'] || "development"

and let that be overridden w/ -e on the command line.

On 2/12/06 4:19 PM, “Michael Schoen” [email protected] wrote:

Sweet! This is coming along nicely. A few comments…

  1. Why restrict mongrel_rails to only allow “development” and
    “production” as environments? Some folks (like me ;-)) have adding
    additional environments, including “qa” and “sandbox”.

Ah, didn’t know people did that. Alrighty, I’ll remove that check.

  1. In a similar vein, what do you think about defaulting to
    ENV[‘RAILS_ENV’] if that’s set?

Good point. Next release.

  1. Are you planning on exposing the num_processors argument to
    mongrel_rails, to allow a command-line option for setting it either
    higher or lower?

Hey, you read code! Bastard! Yeah, I can add that.

  1. Lastly, any plans to allow for a graceful restart?

Yes, that’s coming once I get a few more needed things written.

Zed A. Shaw

Hey Luigi,

Yeah, I’m planning to figure out how to automate building win32 builds
for
people to download. I didn’t know that daemons requires a compiler, but
mongrel does for sure.

If you’re in a hurry I believe you can grab the MS visual studio for
free
these days.

Zed A. Shaw

Not good at design at all, just good at stealing designs people
graciously
give out for others to use.

Of course I think design is the bane of all information existence. I
just
got done telling someone, “You could wrap a turd in a good design and
people
would eat it like a snickers bar.”

Thanks for the compliment though! I do appreciate it.

Zed A. Shaw

On 2/12/06 4:21 PM, “Ben M.” [email protected] wrote:

I see your design abilities are as impressive as your coding abilities. Bravo!

Looking forward to watching Mongrel mature and turn the webapp world on its
ear.

Well, Zed, since you’re in the “I’ll do that” mode, how about
having mongrel_rails display the Rails environment on startup?

That would eliminate all confusion on the issue.


– Tom M.

Zed S. wrote:

Not good at design at all, just good at stealing designs people graciously
give out for others to use.

Of course I think design is the bane of all information existence. I just
got done telling someone, “You could wrap a turd in a good design and people
would eat it like a snickers bar.”

ROTFL… so true… so true…

b

On 2/12/06 4:30 PM, “Michael Schoen” [email protected] wrote:

ENV[‘RAILS_ENV’] || “development”

and let that be overridden w/ -e on the command line.

As for surprising defaults, I actually went with production since the
idea
is that most people will run WEBrick in dev and Mongrel in production,
but I
guess I could just make it behave like WEBrick if people think that’s
better.

Zed A. Shaw

As for surprising defaults, I actually went with production since the idea
is that most people will run WEBrick in dev and Mongrel in production, but I
guess I could just make it behave like WEBrick if people think that’s
better.

Ah, didn’t think about that – I like to run the exact same setup in
both dev and production to avoid any unexpected differences. Defaulting
to dev does some “safer” though (for some definition of “safer”).

Zed

Is Mongrel appropriate for apps running on - heavily - shared accounts?
Would there be any benefit, over lighttpd or Apache?

Alain

Tom M. wrote:

Well, Zed, since you’re in the “I’ll do that” mode, how about
having mongrel_rails display the Rails environment on startup?

That would eliminate all confusion on the issue.

+1

On 2/12/06 5:55 PM, “Alain R.” [email protected] wrote:

Is Mongrel appropriate for apps running on - heavily - shared accounts?
Would there be any benefit, over lighttpd or Apache?

Well, Mongrel is still being worked on so putting it into production
probably isn’t the smartest move right now.

In the future I can see people going one of several ways with shared
accounts:

  1. lighttpd or apache acting as a simple mod_proxy front end talking to
    a
    Mongrel backend for anything Rails.
  2. A smart load balancer like BalanceNG or a Cisco which routes
    requests
    for you based on content. Again, static content served with apache or
    lighttpd and dynamic with Mongrel.
  3. Simply serve the whole mess with Mongrel directly. This might work
    great for people hosting lots of tiny little applications.

The main thing with large shared hosting systems is port management.
Usually people rely on something like VPS as well.

Zed A. Shaw

Zed, I am getting an error, see below:

On 2/12/06, Zed S. [email protected] wrote:

$ sudo gem install mongrel
$ cd myrailsapp
$ mongrel_rails start -d

Installed the gem (and demons) with no problem, but:

mongrel_rails start -p 3333
Running at 0.0.0.0:3333
calling Dispatcher.dispatch undefined method index' for nil:NilClass /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.1/bin/mongrel_rails:32:in status’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.1/bin/mongrel_rails:74:in
process' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.1/lib/mongrel.rb:363:in process_client’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.1/lib/mongrel.rb:328:in
initialize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.1/lib/mongrel.rb:326:in initialize’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.1/lib/mongrel.rb:326:in
initialize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.1/bin/mongrel_rails:125:in run’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.1/lib/mongrel/command.rb:183:in
`run’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.1/bin/mongrel_rails:171
/usr/local/bin/mongrel_rails:18

The same request works with webrick. Using:

edu> uname -a;ruby -v
Darwin copito.local 8.4.0 Darwin Kernel Version 8.4.0: Tue Jan 3
18:22:10 PST 2006; root:xnu-792.6.56.obj~1/RELEASE_PPC Power Macintosh
powerpc
ruby 1.8.4 (2005-12-24) [powerpc-darwin8.3.0]

Am I doing something wrong? Thanks.

Eduardo Fernández Corrales