Skip to content

Heroku Deployment Guide

skyhit edited this page Feb 25, 2014 · 1 revision
  1. Create a Heroku account at https://api.heroku.com/signup/devcenter with your email address.

  2. Download the Heroku Toolbelt from https://toolbelt.heroku.com, and make sure the Heroku CLI is working in your environment by typing > heroku help

  3. Login into your Heroku account
    > heroku login

This requires you to input your email and password, and then finally it will upload your public SSH key to the server so that you don’t have to provide your credential during the subsequent commands. If you have a “Permission denied (publickey)” error during deployment, you can use heroku keys:add to add the public key to the remote repo as described here.

  1. Assign execution permission for Heroku deploy script
    > chmod +x deploy/heroku.sh

  2. Install the dependencies
    > npm install

  3. The Heroku deploy script has the following command line switches:

Switch Description
clean It cleans the current repository information by simply removing the .git folder.
commit It initializes the local repository and commits all the current project files, if the current directory is not a GIT repo yet; or commit all the changes to the local repository, if the current directory is already a GIT repo.
create It creates a Heroku app for the current logged-in Heroku account. This app will only be used if it is created when the current local GIT repo has not yet setup the remote repo of name “heroku”. If your local repo has already setup “heroku” remote for an existing app, this app will not be picked as the target app for other Heroku commands. If you want to create an new Heroku app and use it as the target app in this case, you can clean and re-initialize the current local repo first, or you explicitly rebase it to the new Heroku app.
config It exports all the configured environment variables to the target Heroku app.
push It pushes the current committed version to the “heroku” remote.
launch It launches one Heroku dyno to run the target app.
all It will execute all other steps in the order: “clean”, “commit”, “create”, “config”, “push”, and then “launch”.
deploy It only executes the steps to deploy the projects to the Heroku cloud: “config”, “push”, and then “launch”. It assumes the code has been committed to the local repo, and the local repo has setup the “heroku” remote for the target app.

When first deploying the application to Heroku run . deploy/heroku.sh all

After running the script, you can use git remote -v to see the “heroku” remote repo. The remote repo will be like [email protected]:<app-name>.git, you can find out the name of the newly created app here.

Use . deploy/heroku.sh deploy for the subsequent deploys.