Launching Sinatra on Heroku

Become a Subscriber

Sinatra is a great solution for small and nibble ruby web applications. While Heroku is awesome for all things hosting. Today I will show you how to quickly deploy your Sinatra application to Heroku. Deploying a Sinatra App on Heroku is super simple.

Assumptions

I am assuming you already have a Sinatra app you are ready to deploy along with the heroku cli tool belt (https://toolbelt.heroku.com/)

Setup

Go inside your project folder and create two root files:

Gemfile
config.ru

Inside Gemfile let Heroku know you are on Sinatra:

source ‘https://rubygems.org'
gem ‘sinatra’

The Config.ru is a rackup file for running Rack-based apps and should look something like this if your file is called app.rb:

require ‘./app’
run Sinatra::Application

Deployment

heroku create
git add .
git commit -m “Deploy Sinatra to Heroku”
git push heroku master
heroku open

Let us know if you run into any trouble or if this works well for your existing projects.