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
4. Install Heroku CLI. Visit this link to install Heroku CLI
5. Login to Heroku, type the command below it will ask your email and password.
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.
8. Migrate the Heroku database.
heroku run rake db:migrate
9. 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.