RFID Enabled Fish Tracking

Documentation of the HI-Tag Web Database Interface

Back Index Accounts Heroku MongoDB Node.js

Setting up Heroku to host your website

This Guide is based on the official heroku guide.

  1. Create Heroku Account.

  2. Install Heroku Toolbelt:

    wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh
    
  3. Log in to heroku:

    heroku login
    #Enter your Heroku credentials...
    
  4. Preparing the app:

    Assuming you have a fully functional web application already, here are the steps to prepare it for heroku.

    If you don’t, simply run:

    git clone https://github.com/heroku/node-js-getting-started.git
    cd node-js-getting-started
    

    Otherwise, follow the instructions below.

    1. You need a local package.json file to define your application’s dependencies.

      If you have been using a global one, simply copy it over to your application’s directory.

      cd ${APP_DIRECTORY}
      cp ${HOME}/package.json .
      

      You can also run:

      npm init --yes
      
    2. Then, you must define a Procfile :

      If your main app starts with server.js,

      web: node server.js
      

      If no Procfile is defined, the app will default to the start script in your package.json:

      "start": "node server.js"
      

      If there is no start script, then the default is server.js.

    3. In your application, make sure it listens to a port Heroku supplies:

      var port = process.env.PORT || 8000;
      server.listen(port);
      
  5. Deploying the app:

    1. Create the app on heroku:

      heroku create
      
    2. Deploy the code:

      git push heroku master
      
  6. Ensure that the app instance is running:

    heroku ps:scale web=1
    
  7. Check that the app is running with:

    heroku open
    
  8. [Tip] if you need to configure environmental variables:

    heroku config:set VAR1_NAME=VAR1_VALUE VAR2_NAME=VAR2_VALUE
    

Running Heroku Locally

If you have to test new features that aren’t yet stable, you wouldn’t want to experiment in your running instance.

That is what local instances are for.

bash heroku local