Re: Problems with getting started, part 2

Michael Granger <[email protected]> Wed, 19 Mar 2008 11:36:39 -0700
Newsgroups gmane.comp.apache.mod-ruby
Message-ID <[email protected]>
On Feb 18, 2008, at 1:44 PM, Arnold Daniels wrote:

> After the last attempt back in November, I have installed up to date  
> (and compatible) versions of ruby and rails. Ruby on rail now runs  
> as CGI, but I still can't get it to  run with mod_ruby. I've changed  
> the dispatch.rb to include the full path for dispatcher. However I  
> get "Rails application failed to start properly" as output. The  
> apache error log gives the errors pasted below this e-mail. If I  
> would have to guess I would say that there are still some  
> compatibility issues. However, a simple hello world app processed  
> with mod_ruby, works fine.

There are several big roadblocks to using Rails under mod_ruby:

  1. Rails is not designed to run under Ruby's $SAFE system, which  
restricts the
     operations one can do with untrusted data. The error backtrace  
you pasted
     indicates that this is what is happening when you try to run your  
application.

  2. Rails is also not designed to run in tandem with other code in  
the same
     interpreter. It monkeypatches core and standard library classes  
quite
     extensively, and uses the toplevel namespace for many application  
classes.
     Since mod_ruby is a single interpreter embedded inside an Apache  
process,
     classes with the same name will collide if not declared inside a  
module.

  3. It also assumes many things about the runtime environment that  
it's started in,
     which is what the 'apache/rails-dispatcher' library in mod_ruby  
is designed to
     address. I haven't tested it at all (since I don't really use  
Rails anymore),
     and Shugo-san has several times said that it's not really ready  
for production
     use.

In my (albeit limited) experience, it's not worth trying to get a  
Rails application running under mod_ruby when there are alternative  
solutions with similar performance characteristics.

> PS. I don't see that much activity around mod_ruby (mailinglist,  
> releases), nor do I see this being used as a common solution. Is  
> this module not really good and there for abandoned or is there some  
> other reason? Please give me a reassuring word for choosing mod_ruby.


It's not abandoned, or at least I've not heard as much from Shugo. I  
use it every day at my job with a framework a few friends and I wrote  
specifically to run under mod_ruby called Arrow (http://deveiate.org/projects/Arrow/ 
).

As regards it being "not really good": mod_ruby itself is excellent as  
a way to access the Apache API from Ruby, but if that's not what you  
want to do, you should probably investigate something else. If you're  
looking for alternatives to Rails, Camping (http://camping.rubyforge.org/files/README.html 
), Iowa (http://enigo.com/projects/iowa), Merb (http:// 
merbivore.com/), and Ramaze (http://ramaze.rubyforge.org/) are but a  
few to try out.

--
Michael Granger <[email protected]>
Rubymage, Architect, Believer
The FaerieMUD Consortium <http://www.FaerieMUD.org/>