Heroku CLI Deployment of Ruby on Rails APIs powered by PostgreSQL with MacOS

For project, my other three teammates and I, decided to create a finding volunteers application for children, called Help@Home, which connects children who need help with their homework and mental health with adult volunteers. I was responsible for implementing a RoR API. To make database accessible for my teammates from all over the world, I chose to deploy it using .

Before getting into the deploying part, the brief introduction of how the Help@Home backend was designed is needed. It was created with Ruby on Rails powered by PostgreSQL using self referential relationship (for more information about self referential association check out my blog ), one table for users (client & volunteer) and one join table for appointments, from which the client and the volunteer are connected. For security management, , and are applied.

Now let’s talk about how to deploy.

  1. A free Heroku account ()
  2. MacOS homebrew installation in command shell

( )

brew install heroku/brew/heroku

3. Once installed, we can use Heroku CLI to login to our account

heroku login

4. Open the api backend folder and create Heroku repository

heroku create

5. Create Procfile, which is needed for setting up the environment for Heroku (Procfile should be in the main folder, in the same folder with Gemfile)

touch Procfile

6. Paste the following line into Procfile

web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}

7. Now we need to commit and push the changes to the repository

git add .
git commit -m "init"
git push heroku master

At this point, Heroku starts deploying the app.

8. Add token signing key/value pair in ‘.env’ file into Heroku app → settings → Config Vars

Heroku account related repo settings
Add Token secret key/value pair in config vars

9. Run the migration

heroku run rake db:migrate

10. Now open the url to check it out (the app might take a few minutes to open. )

Ta-da! 🤩

Help@Home backend data

I hope this will help you! ;)





Multi-human-lingual and multi-programming-lingual | https://www.gaierken.com/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How I Built an Unscalable Slack Bot (and How I Fixed it with R̵̵̵e̵̵̵l̵̵̵a̵̵̵x̵̵̵ Async Events)

Cookbook — Oracle RDS migration to Redshift using AWS Data Migration Service (DMS)

Wrapping Your Head Around Docker

How to Choose a Payment Gateway for Your Ecommerce Project

Repository Pattern

Clutch Recognizes Ingenious Among Uruguay’s Top Software Developers For 2022

How to use Zoom virtual background for Linux Ubuntu?

How to Use ngrok

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gulgina Arkin

Gulgina Arkin

Multi-human-lingual and multi-programming-lingual |

More from Medium

Solve Permission Denied error while using a dockerized PHP environment

Multi docker Nodejs app setup

How to install Ruby with rbenv in Windows 11 WSL-Ubuntu 20.04 distro

An Ubuntu Environment with Node.js