This clinic walks through the process of deploying a Rails app to Heroku.
We'll start with a sample Rails app that we've cloned from GitHub.
brew install heroku
- Make an account on Heroku if you have not already done so
Deploying a Rails app to Heroku docs
Some notes about your Rails app:
Your Gemfile
should contain this:
group :production do
gem "puma"
gem "rails_12factor"
end
rails_12factor
is a Heroku gem that does 12 different things.
Your database.yml
file should contain a couple lines for production
production:
<<: *default
database: heroku_clinic_production
username: heroku_clinic
password: <%= ENV['HEROKU_CLINIC_DATABASE_PASSWORD'] %>
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
heroku create
Type in git remote -v
to ensure that an endpoint called heroku
has been created.
git push heroku master
heroku run rails db:migrate
heroku run rake db:seed
heroku logs -t
to check out any errors