[ANN] Mongrel 0.3.9 -- GemPlugin Based

Hello everyone,

Mongrel now has plugins that are based entirely on RubyGems. This
feature
was so slick that I decided to bust it out into a separate project
called
GemPlugin (more on that later). What the new plugin system does is
makes it
so that people can distribute Mongrel plugins as just plain gems, and
mongrel will load them on the fly if people install them. There’s no
configuration necessary to get this working, and you can already write
your
own mongrel_rails commands.

== What’s Mongrel

Mongrel is a fast HTTP library and server for Ruby that is intended for
hosting Ruby web applications of any kind using plain HTTP rather than
FastCGI or SCGI. It is framework agnostic and already supports Ruby On
Rails, Og+Nitro, and Camping frameworks.

== Win32 Warning

I’m holding back win32 people for a day while I test this stuff out more
completely. It has some slightly specific things that I still need to
tweak
on win32 to get everything working quite right. Super cool people with
build tools can give this a shot and let me know how it goes. Everyone
else
needs to wait, sorry.

== Plugins In Action

The plugin system is actually pretty easy for people to use. Let’s say
you
do your update:

$ gem update

Which should update mongrel to 0.3.9 and also install a gem_plugin 0.1.
People who haven’t used Mongrel before should do this:

$ gem install mongrel

Which will again install gem_plugin as a dependency.

To see how the demo works, just run mongrel_rails and see what commands
are
available.

Now for the cool part. Find a Rails application and run it in daemon
mode:

$ cd myapp
$ mongrel_rails start -d

Ok, now lets install the new mongrel_status plugin and use it to get the
PID:

$ sudo gem install mongrel_status
$ mongrel_rails status

If everything worked it should spit out the PID of whatever is running.
If
you now do mongrel_rails you’ll see that there’s this new “status”
command.
Feel free to do this too:

$ mongrel_rails status -h

Big deal right? Ok, remove it and watch the status command go away:

$ sudo gem uninstall mongrel_status
$ mongrel_rails

See, no more status command.

== How It Works

I’m still wrestling with the explanation of how GemPlugin works, but go
ahead and read:

http://mongrel.rubyforge.org/gem_plugin_rdoc/

To get an idea. It’s weird but works fantastic.

== Next Steps

In the push to 0.4 I’ll be implementing handlers and filters as plugins
and
setting up the “grand config system” so that you can attach them to
URIs.
This should be point at which people can literally write their own
plugins
and extensions to Mongrel without much extra effort.

Enjoy! And please post the bugs.

Zed A. Shaw

On Mar 5, 2006, at 10:36 PM, Zed S. wrote:

$ gem update

~: sudo gem update mongrel
Password:
Upgrading installed gems…
Updating Gem source index for: http://gems.rubyforge.org
Attempting remote upgrade of mongrel
Attempting remote installation of ‘mongrel’
Select which gem to install for your platform (powerpc-darwin8.3.0)

  1. mongrel 0.3.9 (ruby)

snip…

  1. Cancel installation

1
Install required dependency gem_plugin? [Yn] Y
ERROR: While executing gem … (OpenURI::HTTPError)
404 Not Found


– Tom M.

Minor nitpick, but I would love it if someone could figure out why the
win32
version of mongrel won’t respond to ctrl-C.
Thanks,
Carl

On Mon, Mar 06, 2006 at 07:58:34AM -0800, Carl Y. wrote:

Minor nitpick, but I would love it if someone could figure out why the win32
version of mongrel won’t respond to ctrl-C.
Thanks,
Carl

Use CTRL-Pause Break instead. CTRL-C doesn’t quite work because of the
way threading is going. I’ll look at printing out a little message for
win32 folks when they start mongrel_rails up.

Zed A. Shaw