Hosting a Simple Sinatra App on Heroku

Tuesday, Feb 12, 2019 | 2 minute read | Updated at Tuesday, Feb 12, 2019

@
Hosting a Simple Sinatra App on Heroku

NB: This is no longer active or maintained. Heroku is no longer free

https://passg.herokuapp.com is the sinatra app on heroku.

This is how it got there.


  • First Create an account, or sign-in to an already existing account.
  • Create an app.

    • In my scenario, I connected to github from where I deploy my app, whenever there is a push to the master branch of my repo.
  • You will need a Gemfile , Gemfile.lock, Config.ru

  • Using touch Gemfile in your terminal should create a Gemfile for you.

    • In this Gemfile, list out the gems that you will want installed with your app. eg.
    # Gemfile
    
    source "https://rubygems.org"
    gem "sinatra"
    gem "sinatra-contrib"
    
  • Run bundle install in the same directory with the Gemfile and this will create for you, Gemfile.lock. Note: The bundler gem would have to be installed to do this. gem install bundler Note: Heroku requires bundler version 2.

  • In your Config.ru file,

# Config.ru

require './main'
# ./main refers to  "main.rb"

run Sinatra::Application
  • With this, your app is ready to deploy.

  • You might encounter an issue,after you deploy to heroku, especially with Heroku’s bunder version.

  • The defualt buildpack does not come with bundler version 2. To solve this, visit your heroku dashboard, under settings, add this buildpack to your apps settings. https://github.com/bundler/heroku-buildpack-bundler2 Remove the default ruby buildpack, you should be ready to go then

© 2025 Reveries

🌱 Powered by Hugo with theme Dream.

About Me

Self Introduction

Passionate about people & technology. With a plethora of experience managing both people and technology. I am currently a Technical Officer with the Communications Division of CSIR - Institute for Scientific and Technological Information. Here, I am responsible for transforming research outputs into software, tools, equipments and communication systems as tools for national development.

I am BIG about community and have spent the better part of the last decade; growing and managing various tech communities in Ghana. Most recent being the Google Developer Group (GDG). I ASPIRE to INSPIRE.

I like to dabble in a lot of technology related things; from code to Rpi’s.