Tuesday 16 August 2011

Passenger with multiple ruby versions

Hey guys, been investigating a little, and I think this article is a summary of why its a problem http://robaldred.co.uk/2011/06/running-passenger-with-multiple-different-ruby-versions-apache-nginx-rvm/.

Passenger does not support this yet. So unfortunately we will have to wait for a future passenger until we start using rvm in prod and hopefully until then we will only need REE and wont need things like better unicode support ☃ Anyway I have been playing around with the set up of rvm, rails, nginx and passenger and have it working nicely locally.

On a mac we can start services at boot by creating a plist file. Here is my /System/Library/LaunchDaemons/nginx.plist


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>nginx</string>
<key>Program</key>
<string>/opt/nginx/sbin/nginx</string>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>/opt/nginx/logs/error.log</string>
<key>LaunchOnlyOnce</key>
<true/>
</dict>
</plist>




sudo launchctl load -w /System/Library/LaunchDaemons/nginx.plist
and unload respectively. I may create an alias for this.


We can set default rvm with rvm ree --default
and use --passenger flag

rvm use ree
gem install passenger

passenger-install-nginx-module


here is the config with ree and rvm.

/opt/nginx/conf/nginx.conf

passenger_root /Users/crawford/.rvm/gems/ree-1.8.7-2011.03/gems/passenger-3.0.7;
passenger_ruby /Users/crawford/.rvm/wrappers/ree-1.8.7-2011.03/ruby;

This just says use the passenger installed with my ree ruby (as the memory benefits go hand in hand)

There was a little trouble with dependencies and gpg so may revisit this later.

Here is some information on Apache Nginx showdown: http://www.joeandmotorboat.com/2008/02/28/apache-vs-nginx-web-server-performance-deathmatch/.

Maybe we load balance an nginx for slow clients in the future? Will investigate more

No comments:

Post a Comment