-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |