DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Building A Simple AI Application in 2023 for Fun and Profit
  • Configuring SSO Using WSO2 Identity Server
  • What Developers Need to Know About the Price Checker App
  • Auto-Scaling a Spring Boot Native App With Nomad

Trending

  • Teradata Performance and Skew Prevention Tips
  • Microsoft Azure Synapse Analytics: Scaling Hurdles and Limitations
  • Solid Testing Strategies for Salesforce Releases
  • The Role of Retrieval Augmented Generation (RAG) in Development of AI-Infused Enterprise Applications

How to Deploy Rails App to Heroku in 5 Minutes

Deploy Ruby on Rails API on Heroku

By 
Hunny Jummani user avatar
Hunny Jummani
·
Updated Feb. 18, 21 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
8.7K Views

Join the DZone community and get the full member experience.

Join For Free

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+.
  • Sign up 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

Run Rails commands

If we want to migrate our database on Heroku, then use the below command:

heroku run rails db:migrate

Let’s ensure that your one dyno is up by the following command:

heroku ps:scale web=1

If we want use Heroku run rails console in our local machine, use the following:

heroku run rails c

Visit the Rails application

This will open the application on the domain created in the browser.

heroku open

Congratulations! You have deployed your first Ruby on Rails application on Heroku.

app application

Opinions expressed by DZone contributors are their own.

Related

  • Building A Simple AI Application in 2023 for Fun and Profit
  • Configuring SSO Using WSO2 Identity Server
  • What Developers Need to Know About the Price Checker App
  • Auto-Scaling a Spring Boot Native App With Nomad

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!