Skip to content
Geremia Taglialatela edited this page Jan 6, 2015 · 38 revisions

A fast guide on how to deploy icare on heroku

The Easy Way™

Deploy

Note: you will probably need to edit source code in order to customize icare according to your needs

The Hard Way™

Prerequisites

  1. *nix based OS (we don't support Microsoft Windows in any way)
  2. git: http://git-scm.com/
  3. Heroku Toolbelt: https://toolbelt.heroku.com/
  4. A working Facebook Application: Setup-Facebook-App

Instructions for a new application

Replace appname with a name of your choice.

  1. Setup a new application
heroku create appname --remote production
  1. Enable branch tracking
git config push.default tracking
  1. Add add-ons
heroku addons:add mongolab:sandbox # Database
heroku addons:add redistogo:nano # Background jobs
heroku addons:add newrelic:stark # App monitoring
heroku addons:add papertrail # Log monitoring
  1. Setup environment variables
heroku config:add APP_BASE_URL=CHANGEME_WITH_YOUR_APPNAME.herokuapp.com
heroku config:add FACEBOOK_NAMESPACE=CHANGEME_WITH_YOUR_FACEBOOK_NAMESPACE
heroku config:add FACEBOOK_APP_ID=CHANGEME_WITH_YOUR_FACEBOOK_APP_ID
heroku config:add FACEBOOK_SECRET=CHANGEME_WITH_YOUR_FACEBOOK_SECRET
heroku config:add SECRET_KEY_BASE="$(bundle exec rake secret)" DEVISE_SECRET_KEY="$(bundle exec rake secret)" DEVISE_PEPPER="$(bundle exec rake secret)"
  1. Setup Google Analytics, Airbrake and New Relic (optional)
heroku config:add GOOGLE_ANALYTICS_ID=UA-XXXXXXXX-X

heroku config:add AIRBRAKE_API_KEY=xxx
heroku config:add AIRBRAKE_HOST=xxx

heroku config:add NEW_RELIC_LICENSE_KEY=xxx
heroku config:add NEW_RELIC_APP_NAME=xxx
  1. Push!
git checkout master
git push production master
  1. Create db indexes and populate db with some default objects
heroku run rake db:mongoid:create_indexes db:seed
  1. Set up to track remote branch production/master from master. In this way you can simply launch git push from master branch instead of git push production master to deploy on heroku
git branch master --set-upstream-to production/master

Instructions for an existing application

Replace appname with the name of the existing application. We suppose you already have forked this repository.

  1. Add the heroku remote
heroku git:remote -a appname -r production
  1. Enable branch tracking
git config push.default tracking
  1. After pushing for the first time to production master, set up to track remote branch production/master from master
git branch master --set-upstream-to production/master

Notes

On free Heroku hosting, the "Share on Facebook Timeline" will use a background worker inside the web dyno, by using defunkt/unicorn and the following instructions from Diaspora

References

https://devcenter.heroku.com/articles/multiple-environments