Note that Heroku Config is found in /.git/config
** Make sure you have setup your git properly before pushing to Heroku **
- Database must be Postgres:
gem 'pg'
- Heroku uses unicorn, so you need:
gem 'unicorn'
- Heroku needs this gem too:
gem 'rails_12factor', group: :production
- Add
ruby '2.0.0'
to the top of your Gemfile - Remove
gem 'sqlite3'
from your Gemfile - Setup
Procfile
as per https://devcenter.heroku.com/articles/getting-started-with-rails4#webserver
This is a better way than to create it via heroku.com as it automatically set ./.git/config
Note: Make sure you are in your project folder.
heroku apps:create <app name> # creates an app with the name
- Do this step if you create your Heroku account online
- Log on to your heroku account
- Go to your app and change your app name
- Change your app name in
/.git/config
[remote "heroku"]
[remote "heroku"]
url = [email protected]:<YOUR_NEW_APP_NAME>.git
fetch = +refs/heads/*:refs/remotes/heroku/*
- Commit master branch to heroku
- Make sure you have already setup your git
git push heroku master
heroku run rake db:migrate
heroku run rake db:seed # if you need to seed the database
That's it for pushing to Heroku!!
To manages your postgres db on heroku, just go to http://postgres.heroku.com
heroku logs -t # shows heroku server logs (-t for tail)
heroku run rake db:migrate # this is how you send rake cmd to heroku
heroku config # see db config of heroku (to get DB URL)
heroku ps # see processes running
heroku releases # see all releases
heroku pg:reset DATABASE_URL # Drops and creates heroku DB. Note that DATABASE_URL is auto-mapped to your postgres db.
heroku run console # Heroku rails c
heroku restart # Restarts your Heroku dyno
# Puts your app on maintenance
heroku maintenance:on
heroku maintenance:off