DEV Community

BoTree Technologies
BoTree Technologies

Posted on • Originally published at botreetechnologies.com on

Deploy Rails App to Heroku in 5 Minutes

Deploy Rails App to Heroku

Heroku is a platform that enables developers to build, run, and operate applications entirely on the cloud with multi-language support for Ruby, Go, Scala, PHP, etc.

Ruby on Rails is a popular web framework written in Ruby. This guide covers how to deploy Rails 6 apps to Heroku.

Prerequisites for Deployment of Rails API To Heroku

  • Basic familiarity with Ruby/Rails and Git.
  • A locally installed version of Ruby 2.2.0+, Rubygems, Bundler, and Rails 5+.
  • Signup on Heroku.

Local Setup:

  • Install the Heroku CLI on your development machine.

sudo snap install --classic heroku

Note: Your application should be uploaded to GitHub.

Steps to deploy the application to Heroku:

  1. Create an application on Heroku

heroku create "app-name"

This will create a Rails application on Heroku like app-name.herokuapp.com.

If you don’t provide an app-name then Heroku will automatically generate a subdomain.

  1. Verify remote origins were added to your projects.

git config --list --local | grep heroku

  1. Deploy your code.

git push heroku branch_name

Note: If you want to deploy a specific branch then you need to specify the branch name:parent_branch.

For Eg:

If you created a branch ‘feature/bulk_upload’ from a master then you need to specify the branch_name as below for deployment:

git push heroku feature/bulk_upload:master

Logs Check

Sometimes there arises a need to view the logs of the application then we can view the logs on Heroku using the below command:

heroku logs --tail

The post How to Deploy Rails App to Heroku in 5 Minutes appeared first on BoTree Technologies.

Top comments (0)