Got Sinatra running on Dreamhost, after much fun

4 Mar

There were various tutorials, but none quite worked, as they were out of date or short on details. I’m making a (very) little tribute to the old Rampage game at, as a History API demo, and History API stuff needs Cool URIs, so Sinatra will make life easy.

Create a new Passenger domain
 Create domain called ““, directory ~/rampage/public, check the “Passenger” option.

gem install sinatra    # Yes, you can do this and it will automatically download into ~/.gems
cd rampage
mkdir public tmp

Create ~/rampage/

ENV[‘GEM_PATH’] = ‘/home/USER/.gems:/usr/lib/ruby/gems/1.8’
require ‘rubygems’
require ‘sinatra’

require ‘rampage.rb’
run Sinatra::Application

Create ~/rampage/rampage.rb:
get ‘/’ do
  “Worked on dreamhost”

get ‘/foo/:bar’ do
  “You asked for foo/#{params[:bar]}”

Now point to and we have Sinatra running on a regular Dreamhost account.

One more thing: Forcing reload
touch tmp/restart.txt whenever you change your app (rampage.rb). I guess I could integrate shotgun to not do this, but I haven’t got that far.

Best sources

2 Responses to “Got Sinatra running on Dreamhost, after much fun”

  1. Anonymous March 6, 2011 at 4:32 pm #

    Thank you very much for this – I’ve been pulling my hair out trying to get Sinatra working on Dreamhost (it seems there are so many conflicting blog posts out there on the topic)!:-)

  2. mloco April 13, 2011 at 12:58 am #

    thank you, this was incredibly helpful, got it up and running instantly!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: