In this lab we will learn to use Heroku, a cloud hosting platform that supports Ruby on Rails.
This application has been pre-built for you and there is no need to change anything with the application itself.
The application is a simple CRUD app built around Posts
- Install Heroku Toolbelt and setup a Heroku account
- Deploy to Heroku using Git
- Learn to reference the Heroku documentation
The project is pre-made for you, and there is no need for you to change any of the Rails code. Do not change any of the Rails code until you have successfully deployed the application to Heroku.
- Fork and clone this project from Github to your laptop.
- Create a free Heroku account on the Heroku website. You will need to confirm your email address, and then provide Heroku with a password which you should remember.
- Download and install the Heroku Toolbelt for your operating system.
- Change into the directory for this
heroku_deploy_lab
Rails project in the bash prompt - From this bash prompt, run
heroku login
. Provide Heroku with the email and password that you set in step 2. - Run
heroku create
. This will setup a new application remote for you. This does not automatically deploy the application. You only need do this once per application. - Look at the
Gemfile
and note that I have included thepg
gem for the production environment (Heroku is our production environment) on line 11. I have moved thesqlite3
gem into the test and development environment groups on line 14. You do not have to change any files for the application to deploy. - Run
git push heroku master
. This will take around 2 minutes to fully run. - Run
heroku run rake db:migrate
to run our database migrations on Heroku. - Run
heroku open
to view your newly deployed site in the browser. - If you would like to run it locally, run
rake db:migrate
and thenrails s
. - Any changes you make to the code will not show up on Heroku until you have created a new commit and pushed them to the heroku remote on the master branch.