Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ready to go

  • Loading branch information...
commit 7a6768ebe45654cdc0deabc6129389fc2ce36ae6 1 parent 8d509dc
@bmizerany authored
Showing with 103 additions and 0 deletions.
  1. +38 −0 README.markdown
  2. +30 −0 config/rackup.ru
  3. +35 −0 heroku-sinatra-app.rb
View
38 README.markdown
@@ -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
View
30 config/rackup.ru
@@ -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
View
35 heroku-sinatra-app.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.