No True “mod_ruby” Is Damaging Ruby’s Viability On The Web

By Peter Cooper

Note: This post was drafted before DHH's "The deal with shared hosts" post, but as it covers similar ground, it's worth reading too. DHH's opinion appears to be that shared hosts should put up or shut up, but I disagree and suggest this is something we need to solve as a community.

Most of us in the Ruby community know that deploying Web apps powered by Ruby can be like pulling teeth. Running up simple CGI scripts is easy enough, but once you move on to more robust systems, using things like Rails, Sinatra, Ramaze, Merb, Camping, whatever, it deviates significantly from the well-established "just upload it" route. The reason is that applications built around these frameworks tend to expose themselves directly via HTTP daemons, using libraries such as Mongrel or WEBrick, and then requests from Web servers like Apache need to be proxied through to them, but this feels like a hackish workaround to the fact we lack a proper "mod_ruby."

In the PHP world, things are a lot simpler. Almost universally Apache comes with mod_php built in, and PHP scripts uploaded to any sort of Web space, shared or not, tend to "just work." This is POLS (Principle of Least Surprise) in deployment. With Rails apps, say, you either need to go to a specialized, over priced Web host, rig up Apache with reasonably fragile FastCGI solutions, set up a Mongrel cluster separately to Apache and then do some proxying, or even deploy a whole new stack based around Mongrel clustering, Nginx and the like. This makes deploying a Ruby application offputting to the typical webmaster and is, in my opinion, damaging Ruby's viability as a mass market Web application technology. If I'm going to put up a blog, I'll use WordPress (Ruby Inside actually does). If I want a forum, I'll find one of the many PHP variants. Why? Easy deployment on well established, easy to replicate application stacks.

Since PHP, Python (including Django apps), and even Java apps (via Tomcat) can be deployed reasonably easily on an Apache stack with the relevant modules installed, shouldn't we be able to get mod_ruby doing the same thing? I'm definitely willing to help in whatever way I can on this, as I'd love to see Ruby / Rails / whatever apps as easy to deploy as PHP apps! This is the main reason Ruby powered forum and blog systems aren't beating WordPress and vBulletin. Unfortunately, I'm pretty dumb when it comes to the technicalities of Apache modules and rigging these things up, but if the main impediment is money, publicity, programmers, or whatever, I'm sure we can figure something out as a community.

So some questions arise:

1) Is there / why isn't there a version of mod_ruby that doesn't have the "class sharing" issue? What is the technical impediment?

2) Is there any immutable reason that Ruby apps couldn't, in the future, be deployed in a PHP-esque fashion?

When we have this ease of deployment, imagine how significantly the market for Ruby powered Web sites and applications could grow! But, first, is it even possible? We'll await answers from the technical wizards out there, but if we can take even a single step forward on this, we're getting somewhere.