Re: Can't get mod_ruby to work
David Heinemeier Hansson <[email protected]> Thu, 15 Nov 2007 14:11:46 -0600
| Newsgroups | gmane.comp.apache.mod-ruby |
|---|---|
| Message-ID | <[email protected]> |
Hi Arnold, Rails won't work by default in a mod_ruby environment where multiple applications are sharing the same setup. mod_ruby shares the Ruby instance across all the applications and Rails use essentially global variables that are not compatible with having that information shared across multiple applications. I don't know of any other hosts that takes Rails hosting serious that are using mod_ruby. Everyone else are using either FastCGI or Mongrel. Given your constraints, I don't think running Rails is going to be something you can offer. I do know that some experimental support for running Rails under mod_ruby was done a few years back, but I don't think it solved the fundamental issue of having a shared Ruby instance, which is not safe. > To give you a bit of background. I'm setting up a test project to > see if we can support Ruby on Rails for our hosting company. I need > a solution which fits in a 100% automated set-up. Tomcat does not > and I don't know mongrel, but I doubt if it does. Also in our setup > the Apache process switches to the user, for security purposes, so > running another daemon is not an option. Supporting fastcgi is also > not an option for security issues and running it as normal cgi is a > performance killer. In short I want to run it using mod_ruby. I'm > not sure how I gave the impression that using mod_ruby or supporting > Rails was optional, but it's not. Otherwise I would not have posted > in on the mod_ruby mailing list. > > I assume that mod_ruby is working for other people and I'm doing > something wrong. I would like to hear from people who do have it > working, because I can't get it to work at all. I don't see any > errors. Where should I look to find what is wrong or is this a known > issue? > > So please, anybody who doesn't like Ruby, Ruby on Rails, mod_ruby or > Apache, I am not interested in your opinion. > > Best regards, > Arnold Daniels > > --------------------- > > Trying 127.0.0.1... > Connected to localhost. > Escape character is '^]'. > GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1 > > (No response on this) > > -------------------- > > arnold@arnold-laptop:/etc/apache2$ sudo apache2 -M > Loaded Modules: > core_module (static) > log_config_module (static) > logio_module (static) > mpm_itk_module (static) > http_module (static) > so_module (static) > alias_module (shared) > auth_basic_module (shared) > authn_file_module (shared) > authz_default_module (shared) > authz_groupfile_module (shared) > authz_host_module (shared) > authz_user_module (shared) > autoindex_module (shared) > cgi_module (shared) > cgid_module (shared) > dir_module (shared) > env_module (shared) > evasive20_module (shared) > info_module (shared) > macro_module (shared) > mime_module (shared) > negotiation_module (shared) > php5_module (shared) > proxy_module (shared) > proxy_http_module (shared) > rewrite_module (shared) > ruby_module (shared) > setenvif_module (shared) > status_module (shared) > userdir_module (shared) > xsendfile_module (shared) > > > David Heinemeier Hansson wrote: >> Please. Before you throw your arms up in despair and forsake all >> that is good, have a look at what's been a best-practice deployment >> scenario for a long time now: Web server -> proxy -> mongrels. >> >> If you like Apache, you can for example use mod_proxy_balancer (see http://blog.innerewut.de/2006/04/21/scaling-rails-with-apache-2-2-mod_proxy_balancer-and-mongrel >> for detailed instructions). Or you could use HAProxy (see http://rubyworks.rubyforge.org/installation/installation-continued.html >> for more). There are tons of options out there and thousands of >> sites putting them to good use in production. >> >> Abandoning Rails because you haven't looked into deployment >> scenarios is like scrapping your car in favor of a horse because >> you can't figure out how to open the trunk. An overreaction. >> >>> Hello, >>> >>> I can't help you, but I've pass through for almost the same >>> configuration problems. >>> I like very much the way things work in Ruby on Rails but when we >>> need >>> to deploy to production in Apache the problems arise. >>> Why don't you take a look in grails that works like ruby and is very >>> simple to deploy to Apache Tomcat? >>> Here is the link -> http://grails.codehaus.org/ >>> >>> Manuel >>> >>> On Nov 15, 2007 3:10 PM, Arnold Daniels <[email protected]> wrote: >>>> Hi all, >>>> >>>> I'm trying to use mod_ruby to serve a Ruby On Rails application. >>>> The >>>> applications currently works with dispatch.cgi. I'm running >>>> Ubuntu Gutsy >>>> and installed ruby, mod_ruby and rails using apt-get. This >>>> package only >>>> comes with a ruby.load configuration file, which loads mod_ruby, >>>> but >>>> does nothing more. I've created a ruby.conf file, based on the >>>> information on the site. However as soon as I add 'RubyRequire >>>> apache/ruby-run', the server stops responding. It accepts the >>>> connection, but never handles the request. This is not only for >>>> ruby >>>> scripts, but for all requests, even for static content. I do not >>>> get any >>>> report in the error log. >>>> >>>> Does this make sense to someone? I can't retrieve info, so I'm >>>> stuck. >>>> >>>> Any help would be highly appreciated. >>>> >>>> Best regards, >>>> Arnold Daniels >>>> >>>> ------------------- >>>> >>>> root@arnold-laptop:/var/log/apache2# apache2 -v >>>> Server version: Apache/2.2.4 (Ubuntu) >>>> Server built: Oct 7 2007 22:17:24 >>>> >>>> >>>> root@arnold-laptop:/etc/apache2/mods-enabled# cat ruby.load >>>> LoadModule ruby_module /usr/lib/apache2/modules/mod_ruby.so >>>> root@arnold-laptop:/etc/apache2/mods-enabled# cat ruby.conf >>>> <IfModule mod_ruby.c> >>>> RubyRequire apache/ruby-run >>>> >>>> # Execute files under /ruby as Ruby scripts >>>> # <Location /ruby> >>>> # SetHandler ruby-object >>>> # RubyHandler Apache::RubyRun.instance >>>> # </Location> >>>> >>>> # Execute *.rb files as Ruby scripts >>>> <Files *.rb> >>>> SetHandler ruby-object >>>> RubyHandler Apache::RubyRun.instance >>>> </Files> >>>> </IfModule> >>>> >>>> >>> >> >> -- >> David Heinemeier Hansson >> >> > -- David Heinemeier Hansson