Deploying Heroku - NikitaDouglas/acebook-Kindred GitHub Wiki
This page details the process we took to deploy Kindred using Heroku. It follows the steps we took in response to this GitHub Issue.
We worked through the Getting Started on Heroku with Rails 6.x guide; we were updating an existing Rails app, and many of the necessary setup steps had already been completed in the repo that we forked to begin the project.
We did add a Procfile with the line web: bundle exec rails server -p $PORT
to ensure Heroku knows about our web server - Puma.
However, we ran into an error when trying to open our app in the browser using the heroku open
command; this was the error message:
We used the heroku logs
command to view our logs and try to ascertain what went wrong - we saw this entry in our logs:
- ActionController::RoutingError (No route matches [GET] “/about”)
Initially, we thought that something may have gone wrong with the root page we put into the routes.rb
folder, but on further investigation, we realised that the problem came because we had created a branch to experiment with Heroku - using the git push heroku master
command will by default push the master branch to Heroku, which we had not changed.
To remedy this we followed the advice on this Stack Overflow thread and pushed our feature branch to Heroku using git push heroku <feature_branch_name>:master
and success, we were able to see our landing page with heroku open
. We then ran git push -f heroku master:master
to revert that change, so we could merge our branch on Github and then deploy the new master branch to Heroku.
Things we learnt:
heroku open
will only ever open the master branch.- When you
git push heroku master
it will only push your master branch - you have to specify a local one if that's what you want to use; however, it is probably not best practice to push local branches - everything on Heroku is deployable, so we should runrails server
in our testing environment to see our feature branch changes.