Off the mod_rails...

Posted by andrew Tue, 27 May 2008 16:36:00 GMT

mod_rails promises to be the holy grail for RoR hosting – seamless integration with apache (no more mongrel, lighttpd or proxies) and a simple setup process. Well, one out of two isn’t bad…

The docs say that you just neex to run
gem install passenger
passenger-install-apache2-module

The latter runs rake which compiles the apache library from source using (what appears to be an incomplete) version of the excellent boost templates/libraries.

It might be straightforward installing on a modern package managed distro (ubuntu, centos, etc_ but I had a fair bit of trouble convincing it to play nice. Here’s what I had to do to get it working on a fairly typical, but old, install of RedHat, with Apache2 compiled from source installed in /usr/local/apache2

  1. passenger-install-apache2-module didn’t believe apxs existed, so creating the environment variable APXS2 and adjusting the path was required:
    export APXS2=/usr/local/apache2/bin/apxs
    export PATH=$PATH:/usr/local/apache2/bin
    
  2. Next, the compilation of the apache module failed – the absence of non_type.hpp meant the compiler spewed out this error many times:
    ../../boost/config/suffix.hpp:490:32: boost/non_type.hpp: No such file or directory
    
    I’ve done a bit of work with the boost libraries before – they’re fairly lightweight and self-conained. In this case the fix was just to copy a single file from http://www.boost.org/doc/libs/1_34_1/boost/non_type.hpp to /usr/local/lib/ruby/gems/1.8/gems/passenger-1.0.5/ext/boost
  3. So far, so good – compilation works, but woah! RED FLASHING LIGHTS on linking…
    /usr/bin/ld: mod_passenger.so: undefined versioned symbol name std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::~basic_stringbuf [in-charge]()@@GLIBCPP_3.2
    /usr/bin/ld: failed to set dynamic section sizes: Bad value
    collect2: ld returned 1 exit status
    
    Uh, for some reason my default libstdc++ was only to be found in /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/ and this wasn’t getting picked up by the linker, even when it was added to LD_LIBRARY_PATH. The only thing left to do was hack the Rakefile to ensure that the correct shared libraries were being picked up by replacing
     linkflags << " -lstdc++ -lpthread ../boost/src/libboost_thread.a #{APR_LIBS}" 
    
    with
    linkflags << " -Xlinker -rpath /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/libstdc++.so -lpthre
    ad ../boost/src/libboost_thread.a #{APR_LIBS}" 
    

After those changes passenger-install-apache2-module played nice and compiled the module. And after reconfiguring a virtual host as per the mod_rails docs and restarting apache here we are, running on mod_rails.

Impressions? The very first time an http request to an application is made there seems to be quite a long delay – I guess this is because it practices some sort of lazy initialization. After that it seems to zip along pretty speedily, outperforming the classic Apache+mod_proxy+Mongrel setup.

Trackbacks

Use the following link to trackback from your own site:
http://blog.andrewl.net/trackbacks?article_id=off-the-mod_rails&day=27&month=05&year=2008

  1. Amateur gay porn uploads video. Looking for trouble video clip porn gay enrique.
    Free gay porn trailers video.
Comments

Leave a comment

Comments