Forum: Ruby on Rails [ANN] Mongrel 0.3 -- Runs Ruby On Rails

8c43ed7f065406bf171c0f3eb32cf615?d=identicon&s=25 Zed Shaw (Guest)
on 2006-02-10 08:54
(Received via mailing list)
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. :-)

Otherwise, please punish it like crazy for me.


== Getting The Goods

You can grab Mongrel via:

* Project Page -- http://rubyforge.org/projects/mongrel/
* Docs Page -- http://mongrel.rubyforge.org/

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
http://www.zedshaw.com/
A5b8b720efd929c118a4bdf00d2cbfed?d=identicon&s=25 unknown (Guest)
on 2006-02-10 09:07
(Received via mailing list)
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:in
`require'
        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 Marko
076d793369cf7c992cc3984e95cee196?d=identicon&s=25 Stoyan Zhekov (Guest)
on 2006-02-10 09:28
(Received via mailing list)
On 2/10/06, dmarko@tcl-digitrade.com <dmarko@tcl-digitrade.com> 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 ]
4bd34a2216dc8bdbf1f017f64e4d59e8?d=identicon&s=25 Kyle Maxwell (Guest)
on 2006-02-10 09:30
(Received via mailing list)
On 2/10/06, dmarko@tcl-digitrade.com <dmarko@tcl-digitrade.com> wrote:
> /usr/lib/ruby/gems/1.8/gems/mongrel-0.3/bin/mongrel_rails:5
>
>
>

Same error, OS X Tiger.

--
Kyle Maxwell
Chief Technologist
E Factor Media // FN Interactive
kyle@efactormedia.com
1-866-263-3261
4bd34a2216dc8bdbf1f017f64e4d59e8?d=identicon&s=25 Kyle Maxwell (Guest)
on 2006-02-10 09:46
(Received via mailing list)
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...
771d3934c5bd53b76c95b4429c38ae0c?d=identicon&s=25 Erwin Quita (Guest)
on 2006-02-10 09:58
(Received via mailing list)
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 Quita
8c43ed7f065406bf171c0f3eb32cf615?d=identicon&s=25 Zed Shaw (Guest)
on 2006-02-10 14:18
(Received via mailing list)
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
http://www.zedshaw.com/
D810e7436feb302a3e4e6b11895a7f65?d=identicon&s=25 Gael Pourriel (Guest)
on 2006-02-10 15:46
(Received via mailing list)
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
B78beb5e3b3737f1a9f491940684ee38?d=identicon&s=25 Brian Lauer (Guest)
on 2006-02-10 16:51
(Received via mailing list)
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?
25e11a00a89683f7e01e425a1a6e305c?d=identicon&s=25 Wilson Bilkovich (Guest)
on 2006-02-10 16:55
(Received via mailing list)
I'm pretty sure you need Ruby 1.8.4 for this, because Mongrel uses
'readpartial', which was added in 1.8.3.
5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 brian ketelsen (Guest)
on 2006-02-10 18:54
(Received via mailing list)
If you do find this, please share...  I need it too!

Brian
Dcde1758fac67c6b7033d3d8542652bb?d=identicon&s=25 Zed Shaw (Guest)
on 2006-02-10 19:07
(Received via mailing list)
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
http://www.zedshaw.com/
Dcde1758fac67c6b7033d3d8542652bb?d=identicon&s=25 Zed Shaw (Guest)
on 2006-02-10 19:09
(Received via mailing list)
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].
<snip>
>
> 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
http://www.zedshaw.com/
Dcde1758fac67c6b7033d3d8542652bb?d=identicon&s=25 Zed Shaw (Guest)
on 2006-02-10 19:10
(Received via mailing list)
On Fri, Feb 10, 2006 at 10:55:32AM -0500, Wilson Bilkovich 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
http://www.zedshaw.com/
D810e7436feb302a3e4e6b11895a7f65?d=identicon&s=25 Gael Pourriel (Guest)
on 2006-02-10 19:56
(Received via mailing list)
Yes you need 1.8.4, wont work with 1.8.2, had the load error too...
D810e7436feb302a3e4e6b11895a7f65?d=identicon&s=25 Gael Pourriel (Guest)
on 2006-02-10 20:03
(Received via mailing list)
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)
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-02-10 20:45
(Received via mailing list)
On Feb 9, 2006, at 11:54 PM, Zed Shaw 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.
783130010bd0f961daf701904d992d89?d=identicon&s=25 Tirta K. Untario (Guest)
on 2006-02-10 23:21
(Received via mailing list)
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
D810e7436feb302a3e4e6b11895a7f65?d=identicon&s=25 Gael Pourriel (Guest)
on 2006-02-11 00:17
(Received via mailing list)
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.
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-02-11 03:27
(Received via mailing list)
On Feb 10, 2006, at 11:45 AM, Tom Mornini wrote:

> On Feb 9, 2006, at 11:54 PM, Zed Shaw 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.
D10ca8d11301c2f4993ac2279ce4b930?d=identicon&s=25 Adam (Guest)
on 2006-02-11 08:21
Could you describe this caching mechanism in more detail?

Zed Shaw wrote:
>
> == 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
> http://www.zedshaw.com/
A52b0e1c5d982f2512a03c5dbfd033d6?d=identicon&s=25 Dick Davies (Guest)
on 2006-02-13 11:22
(Received via mailing list)
On 10/02/06, Zed Shaw <zedshaw@zedshaw.com> wrote:
> Looks like it isn't recovering if you don't have daemons gem
> installed.  Do:  gem install daemons.
>
> Then it should be fine.

Can you add that as a dependency?

Oh, you did :)


--
Rasputin :: Jack of All Trades - Master of Nuns
http://number9.hellooperator.net/
8c43ed7f065406bf171c0f3eb32cf615?d=identicon&s=25 Zed Shaw (Guest)
on 2006-02-13 21:55
(Received via mailing list)
Hi Gael,

Sorry I missed this, it'll be in the 0.3.2 release shortly.

Zed
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.