Deploying your Rails app to Heroku from GitHub

Renata Miriuk
3 min readMay 13, 2020


Heroku allows you to have up to 5 projects live on their website for free, and it can run code written in Node, Ruby, PHP, Go, Scala, Python, Java, or Clojure.

Although sometimes it can take a while to load, especially if the app hasn’t been used in some time, it is still a good option for a student that doesn't want to pay to host their side project.

Just be aware that Heroku uses Postgres as its cloud database, so your app needs to be set to use the same.

How to do

Once you have your project ready and running, you need to go to your config/database.yml file and change production from the default to URL, you are most likely to find this by the end of your file.

Before — After

Once this is saved, push the changes to master.

On Heroku, if you don’t have an account you can signup for free and you will be taken to your dashboard:

On the top right corner click on the button “New” > “Create New App”

Give it a unique name and choose your region, you don’t need to worry about the pipeline, choose the deployment method by GitHub and connect to your account

Once it is done, find the repo of your project and connect, once it is done, you can choose the branch you want to deploy, and it is also a good idea to “Enable Automatic Deploys”, once it is also set, you can “Deploy Branch”.

Once it is finished you will be able to see that it has been deployed, and if it’s a simple app you can “Open App” and see how it looks.

If you are using a database, you will have one extra step, on the top right corner click on “More” > “Run Console”.

This console will work as your computer console, you can even execute commands like Rails C to open the console for your app, or on our case, we will migrate our database, and if you have it, you can also seed it:

The console should say if there was an error when migrating, but if not, you can also check on “More” > “View Logs” to know if there was any issue when running your app.

Now your app is ready to be shared with the world.

Ruby on Rails as an API

If you are using ruby on rails as your backend for your app, once everything is finished and you try to open your app you can be surprised with this screen:

This happens, because different form Rails server, Heroku won’t default automatically to the rails welcome page, but if you access the right URL path, you should be able to see your db data.



Renata Miriuk

Interested in everything, writing about tech