Skip to content

Commit

Permalink
Ready to go
Browse files Browse the repository at this point in the history
  • Loading branch information
bmizerany committed Jan 31, 2009
1 parent 8d509dc commit 7a6768e
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Here is a sample/template sinatra application ready for deployment to [Heroku](http://heroku.com).

**NOTE** This is for heroku.com and not herokugarden.com

You'll first need a [Heroku account](http://heroku.com/signup). Once you have an account, install
the gem `sudo gem install heroku`. If you do not have an SSH key
you'll need to [generate
one](http://heroku.com/docs/index.html#_setting_up_ssh_public_keys)
and [tell Heroku about
it](http://heroku.com/docs/index.html#_manage_keys_on_heroku)

Now, clone and deploy!

`my_new_app $ git clone git://github.com/sinatra/heroku-sinatra-app`

`my_new_app $ heroku create <optional appname>`

`my_new_app $ git remote add heroku git@heroku.com:<appname>.git`

`my_new_app $ git push heroku master`

Now you may view your site at `http://<appname>.heroku.com`

**NOTES**

The small amount of code is heavily commented. If you have questions
or comments please use [the channels provided](http://www.sinatrarb.com/contributing.html) by the Sinatra community as
we at Heroku are heavily involed in the Sinatra and can help you there
or on our mailing list (http://groups.google.com/group/heroku) if you
have non Sinatra questions.

See [these guidlines](http://www.sinatrarb.com/contributing.html) for
contributing or bugs.

Happy Development and Deploying!

Sincerely,
The Heroku Team
30 changes: 30 additions & 0 deletions config/rackup.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require 'rubygems'

# We will need to require Sinatra to gain
# access to the Sinatra environment for
# bootstrapping before loading the application
require 'sinatra'

# This will soon not be needed on Heroku.
# For now it's important that you set the
# environment before requiring the application
# to allow `configure` to work properly
set :environment, :production

# This is for convenice. The defacto Sinatra standard
# is to name your application file after it's parent
# directory
parent_directory = File.expand_path(File.dirname(__FILE__) + '/..')
application_name = parent_directory.split("/").last
require "#{parent_directory}/#{application_name}.rb"

# You can optionally just say
#
# require File.dirname(__FILE__) + '/../heroku-sample-app'

# This is a must. You will get a 500 if these
# are enabled on Heroku.
disable :run, :reload

# Finally, let's jam!
run Sinatra::Application
35 changes: 35 additions & 0 deletions heroku-sinatra-app.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# You'll need to require these if you
# want to develop while running with ruby.
# The config/rackup.ru requires these as well
# for it's own reasons.
#
# $ ruby heroku-sinatra-app.rb
#
require 'rubygems'
require 'sinatra'

configure :production do
# Configure stuff here you'll want to
# only be run at Heroku

# TIP: You can get you database information
# from ENV['DATABASE_URI'] (see /env route below)

puts "prod"
end

# Quick test
get '/' do
"Congradulations!
You're running a Sinatra application on Heroku!"
end

# Test at <appname>.heroku.com

# You can see all your app specific information this way.
# IMPORTANT! This is a very bad thing to do for a production
# application with sensitive information

# get '/env' do
# ENV.inspect
# end

0 comments on commit 7a6768e

Please sign in to comment.