Ruby on Rails App Deployment on Heroku

Alina Karmacharya
March 24, 2023

Ruby on Rails App Deployment on Heroku

Deployment of Ruby on Rails applications can be a smooth process for developers. Before starting the deployment process, we need to have following requirements:

  • Heroku Account
  • Heroku CLI
  • Ruby on Rails application with deployment setup

Steps for Ruby on Rails App deployment on Heroku

1. Create new Heroku application

Using Heroku App

i. Login to Heroku account

ii. Go to Heroku dashboard ’Click “New” button in the top right corner

iii. Select “Create new app” from the dropdown

iv. Enter name for you application

v. Choose the region you want to host your application

vi. Click “Create app” button


Using Heroku CLI, run the following command

heroku create APP_Name

2. Setup Application Configuration

Using Heroku App you can configure various settings such as connecting to GIT repository, resources and many more.

3. Deployment

​Using Heroku App

i. Make sure that your application code is pushed to a Git repository such as GitHub.

ii. Click the “Deploy” tab on the app dashboard

iii. Select the deployment method. Deployment can be performed using Heroku Git, GitHub, or a Heroku container registry.

iv. Follow the deployment instructions on the basis of the deployment method you have selected and enable automatic deploys. For example, if you choose Heroku Git, you will need to use the Heroku CLI to create a new Git remote for your app, and then push your code to the remote. ​​

Using Heroku CLI

With the Heroku application created and the Profile in place, you can deploy your application using the following command to push your application to Heroku:

git push heroku master

This command will deploy your application to Heroku. During the deployment process, Heroku will install your application’s dependencies and start your server.

4. Database Migration

Using Heroku CLI

If the deployment required database migration, run your database migrations on the Heroku server using following command ​

heroku run rake db:migrate

​ ​ This command will connect to your Heroku application and run the database migrations on the server. ​​

Your application is now deployed on Heroku and can be accessed from the app’s URL.