Sinatra meets Passenger at Site5

In this nice blog entry is some description of how to make rails work with passenger on site5. As I liked to have Sinatra working for myself (and had the sinatra and rack gems installed locally), here is how it works for me:

  • As usual with rails apps, have a symlink point from within $HOME/public_html to the public folder of your sinatra app.
  • Create a .htaccess file in the same public directory, looking like

    PassengerEnabled on
    RackBaseURI /linkname

    which certainly means that you have to put in the name of the symlink

  • Create a file in the app root

    ENV['GEM_PATH'] = "#{ENV['HOME']}/gems:/usr/lib/ruby/gems/1.8"
    ENV['GEM_HOME'] = "#{ENV['HOME']}/gems"
    require 'rubygems'
    require 'sinatra'
    set :env,  :production
    disable :run
    require 'app'

    The only significant change to a plain is the addition of the GEM_PATH at the very top of the file – this way your locally installed gems are being picked up by passenger

One more thing: it turned out to be a good idea to include the ENV['GEM_PATH'] = “#{ENV['HOME']}/gems:/usr/lib/ruby/gems/1.8″ line on top of the rails application file as well. Without that, starting a fresh passenger fork will cause an exception – it will however work on the second attempt. Will have to look into this …

Tags: ,

One Response to Sinatra meets Passenger at Site5

  1. [...] to install a simple Sinatra app on Site5. I didn’t find a lot of documentation, but a post gave some hints in the right [...]