Posts Tagged ‘sinatra’
6
Mar
Mar
Deploying Sinatra on Passenger
by joe in tech
4 Comments
We often make use of the great Ruby micro-framework Sinatra in our daily work. It’s a great way to Ruby-ify a site when you don’t need all the bells and whistles that come with Rails. To deploy a site with it though, I had to do a little bit of research, and finally came up with this small Rack recipe that I hope might help out someone trying to do the same.
require 'rubygems'
require 'path/to/sintra' # I often vendor it inside the app folder with a path like 'vendor/sinatra/lib/sinatra.rb'
set :public, File.expand_path(File.dirname(__FILE__) + '/public') #Include your public folder
set :views, File.expand_path(File.dirname(__FILE__) + '/views') #Include the views
set :environment, :production
disable :run, :reload
log = File.new("/path/to/log/files/sinatra.log", "a") # This will make a nice sinatra log along side your apache access and error logs
STDOUT.reopen(log)
STDERR.reopen(log)
require 'app_name'
run Sinatra::Application
Thanks to John Nunemaker and Chris Schneider for the reference!