Phusion Passenger & RJB

I have a Rails app using RJB that works find in WEBrick/Mongrel; however, when I deploy the app on Phusion Passenger, it either gets stuck loading or spits out the following error:

/app/vendor/plugins/pdf-stamper/lib/pdf/stamper.rb:41: [BUG] Segmentation fault
ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux]
[Tue Mar 30 16:05:54 2010] [error] [client 67.205.3.31] Premature end of script headers: fillpdf
[ pid=5007 file=ext/apache2/Hooks.cpp:684 time=2010-03-30 16:05:54.678 ]:
  The backend application (process 5015) did not send a valid HTTP response; instead, it sent nothing at all. It is possible that it has crashed; please check whether there are crashing bugs in this application.

It appears that Passenger is incompatible with RJB, unless I'm mistaken. (There was some discussion of setting "RailsSpawnMethod conservative" in your httpd.conf which doesn't appear to work anymore).

Anyway, I've tossed in the towel. The simple approach is to go back to the old Mongrel + mod_proxy approach. Here's how to get that setup in Ubuntu:

sudo a2enmod proxy

Then edit your /etc/apache2/httpd.conf file to contain the following:

<VirtualHost *:80>
   ServerName yourdomain.com
   ProxyPreserveHost On
   ProxyPass / http://localhost:3000/
   ProxyPassReverse / http://localhost:3000/
   <Proxy *>
    Order deny,allow
    Allow from all
   </Proxy>
</VirtualHost>

Restart Apache:

sudo /etc/init.d/apache2 restart

And finally, run your rails app:

screen
cd /your/rails/app
script/server -e production
[ctrl+a D]

1 Comments

Phusion Passenger & RJB

Great post.Will visit again.