paint-brush
Getting Your Ruby on Rails Application Live On The Internet With Heroku [A How-To Guide]by@Habibu
157 reads

Getting Your Ruby on Rails Application Live On The Internet With Heroku [A How-To Guide]

by SalumJune 21st, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Getting Your Ruby on rails Application Live On The Internet With Heroku [A How-To Guide] Getting your ruby on rails app live on the internet with Heroku is a guide to deploying it to Heroku. The guide is a step-by-step guide to deploy your app on Heroku and update it every time you make changes to your code. After reading this article your will be able to deploy. your. ruby on. rails app to Herku and push it to GitHub for GitHub users and Heroku users.

Company Mentioned

Mention Thumbnail
featured image - Getting Your Ruby on Rails Application Live On The Internet With Heroku [A How-To Guide]
Salum HackerNoon profile picture

As a back-end developer, the happy moment is to show your client that the work is now is live on the internet, everyone on the world can access the website. In this article, I will share my experience step by step to deploy your ruby on rails application on Heroku.

After reading this article your will be able to deploy your ruby on rails app to Heroku and make an update every time you make changes to your code.

 Here are the steps.

1. Create your app initially with the PostgreSQL as the default database, this will make the work simple because rails use sqlite3 as default database so you need to make changes in the gem file. Where sqlite3 is placed inside the group development and PostgreSQL is placed inside group production.

Development group

group :development, :test do
   gem 'sqlite3'
end

Production group

group :production do
  gem 'pg'
end

After that run bundle install.

Alternatively, the simple way is to create your app initially with PostgreSQL as the default database.

rails new wordapp -d postgresql

easy and no need to touch the gem file.

2. Create the GitHub repository and push your app to GitHub for GitHub users.

git init
git add .
git commit -m"final commit of ready project"
git push origin master

3. Create a Heroku account on https://signup.heroku.com/
4. Install Heroku CLI. Visit this link to install Heroku CLI https://devcenter.heroku.com/articles/heroku-cli

5. Login to Heroku, type the command below it will ask your email and password.

heroku login -i

6.Create the app on Heroku using the below command.

    heroku create name-of-the-app
    

7. Push your code to Heroku use master branch.

git push heroku master

8. Migrate the Heroku database.

heroku run rake db:migrate

9. Heroku open.

heroku open

this will redirect to your app web page or it will give the URL copy it and paste to the address bar, your good to go.

10. Now your app is live on Heroku , every time you make changes to your code you will be updating by pushing to GitHub and Heroku by repeating the command in step no 8.

For any feedback don't hesitate to contact me.

Thank you for reading.