How to get your rails apps live with Heroku

To get your rails app live on the web you need a service like heroku. Heroku is a cloud platform that accelerates the process of deploying your rails app.

All you have to do are the following steps:

1. Create a free account on


2. Download the heroku command line interface (CLI) here.


3. Login through your command line like this

$ heroku login
Enter your Heroku credentials.


4. Prepare your rails app:

You have to put your sqlite3 gem into the :development group. Heroku uses postgresql as the default database so your sqlite3 database won’t work. To use postgresql create a new group :deployment and put pg and rails_12factor in there.

Your Gemfile should look similar to this:

group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '~> 3.0.5'

  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'

  # Put your sqlite gem here
  gem 'sqlite3'

group :deployment do
  # Create this group and put these gems inside
  gem 'pg'
  gem 'rails_12factor'

Now install the gems through your terminal.

$ bundle install


5. Commit your latest changes

Add your latest changes with

 $ git add . 

then commit them

 $ git commit -m "made app ready for production on heroku" 


6. Deploy your app

First you have to create a fresh heroku app. With your heroku CLI you achieve this by typing

 $ heroku create 

This will create an app with a random name like this: polar-inlet-4930

Now deploy your code with:

 $ git push heroku master 

Now run the database migrations to finish the setup for your app online with

 $ heroku run rails db:migrate 

To give your app a more suited name type

 $ heroku apps:rename your-new-name 


7. Success

You should now be able to open and use your app with

 $ heroku open 

You can now access your app through a domain like


If any of those commands are deprecated visit the following link:

Leave a Reply

Your email address will not be published. Required fields are marked *