How to deploy Rails 6.0 App to Heroku

Photo by Chris Ried on Unsplash

I was trying to deploy the Rails 6.0 app to Heroku with the developer guidelines in Heroku itself. But I faced a lot of problems in Heroku not being deployed properly. If anyone is facing the same problem, this might help you in solving them!!

Let’s discuss how I solved them!!

First, log in to Heroku

heroku login

Create a Heroku app with default buildpacks ruby.

heroku create <app-name> --buildpacks heroku/ruby

Add buildpacks for node.

heroku buildpacks:add heroku/nodejs

Create a Procfile

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

Add database addons. In my case, I was using PostgreSQL.

heroku addons:create heroku-postgresql:hobby-dev

Now that the application is set up, you can push your code to the Heroku server. Make sure that your webpacker.yml is pushed to the server.

git push heroku main || git push heroku master

If you want to deploy a branch other than master, you can push it like below:

git push heroku <branch_name>:master

Run database migration

heroku run rake db:migrate

Checking dyno

heroku ps:scale web=1

Check your Heroku app logs

heroku logs --tail

Launch rails console

heroku run rails console

For the Rails assets pipeline, you will need to enable this in your environment file. Make sure that your assets are required without extensions.

config.public_file_server.enabled = true





Your Journey Begins when You Believe in Yourself…

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

Recommended from Medium


How to Install & Set up Flutter on Mac

Functional Programming Asks For a Mutable Developer

Hey git, please .keep those folders

Introductory bullshit detection for non-technical managers

Build a User Feedback App in Flutter using Firestore

Platform Events vs REST API: A Pigeon vs Horse story

Per App Mojave Dark Mode

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
Kelina Shrestha

Kelina Shrestha

Your Journey Begins when You Believe in Yourself…

More from Medium

Google Speech-to-Text Api with MediaRecorder Api and Rails


Association and Foreign Keys For Beginners

Important Tips to Considering For Ruby On Rails Performance

Active Record Associations Make Linking Stored Data Easy!