[ANN] Mongrel 0.3 -- Runs Ruby On Rails

Hello Folks,

This is the long awaited release of the Mongrel HTTP library that
supports Ruby On Rails. I know tons of people have been waiting
for it, so I’ve got a few things to lay down first before you get all
excited:

  1. It’s very very ALPHA support for Rails. It will run a Rails app,
    and runs my simple apps, but it’s not fast or correct as it needs to be.
  2. It should work for win32 people who can build it, but it won’t
    become a service. Run it in a cmd window.
  3. I did this release late at night so we know how well those hold
    up. :slight_smile:

Otherwise, please punish it like crazy for me.

== Getting The Goods

You can grab Mongrel via:

You can also install using RubyGems with:

sudo gem install mongrel

And of course you need to have a compiler installed for it to build
just like before. No new C code has been included so if you built it
before then you can build it now. If you can’t build it then let me
know and I’ll help you out.

You can also go to the project page’s Files section to grab
source .tgz files if you like to install with setup.rb and source.

== Running Ruby On Rails

The Rails support is done through a small script called
mongrel_rails. This script kicks up all the gear needed for your
application, hooks it into Mongrel, and then goes into daemon mode
(if you install the daemons gem). If you install with RubyGems then
you should get the mongrel_rails command as well. You can then run
it with:

cd myapp
mongrel_rails 0.0.0.0 3000

It will write any errors to log/mongrel.log and put it’s PID into log/
mongrel-3000.pid. You can kill it with:

kill -TERM cat log/mongrel-3000.pid

You should then be able to hit your local web server and see your
Rails application run. If it don’t then send me your mongrel.log.
Another thing to do is if you get a URL giving you the wrong mime
type then let me know. If you get a malformed response then send me
the result of doing:

curl -i http://localhost:3000/the/bad/uri

== Big Changes

  • URIClassifier had an error in the prefix based search such that “/”
    wasn’t getting resolved. Fixed this up and cleaned it.
  • DirHandler now supports many more needed features such as mime type
    mapping, serving index.html if present, getting the paths right on
    “/” mounted directories, and allowing others to ask if a DirHandler
    can serve a file. All of this was so that Mongrel can run a Rails
    app with no external support.
  • Fixed a problem with Error404Handler which caused an explosion.
  • Implemented the mongrel_rails server so people can start working
    with Rails and Mongrel.

== Next Release

I’ll be focusing on making the Rails support tight as hell and
squeezing out every ounce of performance possible. This will include
making my dream caching mechanism.

I’ll also look at the next nail in the CGI library’s coffin: multi-
part mime decoding and handling uploaded files. I’m setting my
sights next on CGI as the library to take down. Anyone interested in
helping on this should contact me.

Enjoy the release and send me your bug reports.

Zed A. Shaw

On my Gentoo Linux with Ruby 1.8.4 it says:

nick app1 # mongrel_rails 192.168.0.40 3000
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require__': no such file to load -- daemons/daemonize (LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
from /usr/lib/ruby/gems/1.8/gems/mongrel-0.3/bin/mongrel_rails:5
from /usr/bin/mongrel_rails:18

Do I need some additional module to run it?

David M.

On 2/10/06, [email protected] [email protected] wrote:

/usr/lib/ruby/gems/1.8/gems/mongrel-0.3/bin/mongrel_rails:5
from /usr/bin/mongrel_rails:18

Do I need some additional module to run it?

gem install daemons

(if you are using gems) maybe will help. See also:
[ http://rubyforge.org/projects/daemons ]

I also tried installing the daemonize library at
http://grub.ath.cx/daemonize/, changing the require call from
‘daemons/daemonize’ to just ‘daemonize’, and it required ok, but for
some reason, still couldn’t find the method…

On 2/10/06, [email protected] [email protected] wrote:

/usr/lib/ruby/gems/1.8/gems/mongrel-0.3/bin/mongrel_rails:5

Same error, OS X Tiger.


Kyle M.
Chief Technologist
E Factor Media // FN Interactive
[email protected]
1-866-263-3261

Looks like it isn’t recovering if you don’t have daemons gem
installed. Do: gem install daemons.

Then it should be fine.

Zed A. Shaw

Hi Zed, nice work, I was just going to attempt setting up Mongrel and
see if I could have a go making it work Rails when I saw your email,
you made my day…

I’ve just tried the release 0.3 on windows with Ruby 1.8.4, compiled
fine and works fine in solo mode.

I’ve then tried it with an existing Rails app. It also works fine
however it doesn’t want to serve any pictures at all, here’s what I
get when I try to access a PNG located in /Image in Firefox

“The image “http://127.0.0.1/images/device-red.png” cannot be
displayed, because it contains errors.”

The source of this is:
â?°PNG

Any idea why that is? Any text files such as javascript sources, css
works fine but images dont, I’ve tried with JPG and all I get is the
name of the image but not the image.

Gael

I’m on Windows XP, ruby 1.8.2 (2004-12-25) [i386-mswin32].
mongrel gem installed
daemons gem installed

Created fresh rails app and tried to run it via mongrel.

C:\rails\test>mongrel_rails 0.0.0.0 3000
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3/bin/mongrel_rails:57:
uninitialized c
onstant Mongrel (NameError)
from c:/ruby/bin/mongrel_rails:18:in `load’
from c:/ruby/bin/mongrel_rails:18

C:\rails\test>

Any ideas?

I’m setting up ror on windows and will be using iis…

does anyone have the “ruby for iis” installer?

the http://rubyforiis.sosukodo.org/ site is down…

if anyone has the installer please email me.

any help would be appreciated.

best regards,

Erwin Q.

If you do find this, please share… I need it too!

Brian

It might be the mime type mapping i just did, but i’ll try this out and
see what is up. What’s weird is the stock “Your on Rails” index.html
has an image which shows up just fine, so maybe it’s a windows thing?
Do you possibly have “device-red.PNG” on the filesystem, but are
referencing it via “device-red.png”? That would mess with the mime-type
mapping.

Zed A. Shaw

On Fri, Feb 10, 2006 at 10:51:18AM -0500, Brian Lauer wrote:

I’m on Windows XP, ruby 1.8.2 (2004-12-25) [i386-mswin32].

C:\rails\test>mongrel_rails 0.0.0.0 3000
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3/bin/mongrel_rails:57:
uninitialized c
onstant Mongrel (NameError)
from c:/ruby/bin/mongrel_rails:18:in `load’
from c:/ruby/bin/mongrel_rails:18

This looks like an older version of mongrel.rb is floating around your
system. Do a scan for mongrel.rb and http11.dll (or is it .so) and
remove them. Additionally, do a gem uninstall mongrel and tell it to
uninstall all versions. Finally, be careful that you don’t have an
unrelated “mongrel.rb” file floating around in your local directory.

Zed A. Shaw

On Fri, Feb 10, 2006 at 10:55:32AM -0500, Wilson B. wrote:

I’m pretty sure you need Ruby 1.8.4 for this, because Mongrel uses
‘readpartial’, which was added in 1.8.3.

Yes, this is true.

Zed A. Shaw

I’m pretty sure you need Ruby 1.8.4 for this, because Mongrel uses
‘readpartial’, which was added in 1.8.3.

No I’ve checked and the file is called device-red.png not PNG, any
images wont display at all, I’ve tried the default rails app and I
dont see the Rails logo, just the “You’re on Rails” text.

GIF display but corrupted, PNG and JPG wont show at all

Using XP and Ruby 1.8.4 (mswin32)

On Feb 9, 2006, at 11:54 PM, Zed S. wrote:

Otherwise, please punish it like crazy for me.

Zed, this is so cool!

Attached is a patch to add getoptlong support for
–help and --daemon.

I had the daemons gem installed, but wanted to
run in the foreground, just like script/server.

Patch applies cleanly via

patch -p0 < mongrel_rails.patch

from within the bin/ directory of the gem.

Does anyone know the performance or scalability of Rails on
Windows/IIS? I really want to know the issues of running Rails on
Windows, since most of my servers are Windows. And as far as I test,
running PHP on Windows/IIS is really slow and crashy compared to
linux. Does Rails share the same characterictic too?

TIA.


Tirta K. Untario

On 10 Feb 2006 17:54:31 -0000, brian ketelsen

Yes you need 1.8.4, wont work with 1.8.2, had the load error too…

On Feb 10, 2006, at 11:45 AM, Tom M. wrote:

On Feb 9, 2006, at 11:54 PM, Zed S. wrote:

Otherwise, please punish it like crazy for me.

Zed, this is so cool!

Attached is a patch to add getoptlong support for
–help and --daemon.

Yikes!

Apparently I made some ‘improvements’ before creating
the patch, thereby making myself look silly in public.

Apologies for the bogus patch.

Attached is the corrected patch.

OK Zed, I’ve fixed it. Under windows you have to specify binary mode
when opening the files.

Replacing:

    open(req, "r") do |f|
      out.write(f.read)
    end

by:
open(req, “rb”) do |f|
out.write(f.read)
end

Sort the images not displaying under windows.