Skip to content

Installation on Heroku

Antti Leppä edited this page Apr 8, 2014 · 1 revision

Installing on Heroku

This is a quick tutorial how to get your own coops-demo instance running on Heroku.

Prerequisites

Before you start make sure you have Heroku account (https://signup.heroku.com/signup/dc) and have installed Toolbelt (https://toolbelt.heroku.com/)

Steps

  1. Go into your Heroku Dashboard (https://dashboard.heroku.com/apps)

  2. Click on the “Create a new app” -link.

  3. Choose name and region for the application

    in example we use coops-demo as application name

  4. Clone the git repository on your local computer

     git clone git@heroku.com:coops-demo.git -o heroku
    
  5. Navigate into the cloned Git -repository

     cd coops-demo
    
  6. Login to heroku

     heroku login
    
  7. Add mongodb addon (mongosoup, mongohq or mongolab)

      heroku addons:add mongosoup:test 
    
  8. Enable WebSockets (see https://devcenter.heroku.com/articles/heroku-labs-websockets for details)

      heroku labs:enable websockets
    
  9. Fix canvas build on Heroku (see https://github.com/LearnBoost/node-canvas/wiki/Installation-on-Heroku for details)

     heroku config:add BUILDPACK_URL=https://github.com/mojodna/heroku-buildpack-multi.git#build-env
    
     cat << EOF > .buildpacks
     https://github.com/mojodna/heroku-buildpack-cairo.git
     https://github.com/heroku/heroku-buildpack-nodejs.git
     EOF
    
     git add .buildpacks
     git commit -m "node-canvas on Heroku"
    
  10. Add CoOps Demo code

     git remote add coops-demo git@github.com:foyt/coops-demo.git 
     git pull git@github.com:foyt/coops-demo.git
    
  11. Check mongo url

     heroku config
    
  12. Register Application into GitHub, Google and Facebook for OAuth (https://github.com/settings/applications/new, https://code.google.com/apis/console/, https://developers.facebook.com/)

    Callback urls must be in following format: http://myapp.herokuapp.com/auth/github/callback (replace myapp.herokuapp.com with your own urlname)

  13. Add settings.json into git folder with following content (replace mongo url, ws host and auth clientIds and clientSecrets with your own):

    {
      "mongo": {
        "url": "mongodb://replace:mongo/url"
      },
      "http": {
        "host": "0.0.0.0",
        "port": "$ENV"
      },
      "ws": {
        "host": "coops-demo.herokuapp.com",
        "port": "80"
      },
      "auth": {
        "facebook": {
          "clientId": "[facebook client id]",
          "clientSecret": "[facebook client secet]"
        },
        "google": {
          "clientId": "[google client id]",
          "clientSecret": "[google client secet]"
        },
        "github": {
          "clientId": "[github client id]",
          "clientSecret": "[github client secet]"
        }
      },
      "sessionSecret": "keyboard cat"
    }
    
  14. Add settings.json into git

    git add -f settings.json
    git commit -m "Added settings.json"
    
  15. Push code into Heroku

    git push
    
  16. Navigate into your application and you should see the CoOps demo.

    e.g. http://coops-demo.herokuapp.com

Clone this wiki locally