Deploy Express(node) app on heroku

Sep 11, 2013


Process (Command)

1. login by using heroku command

heroku login

Input email address and password of heroku account.

Enter your Heroku credentials. Email: XXXXXX Password (typing will be hidden):

2. create public key

ssh-keygen -t rsa -C "mail address"
heroku keys:add ~/.ssh/

3. clone Express app

$ git clone XXXXXXXXXXXXX ${appname} $ cd ${appname}

4. edit .gitignore

vi .gitignore

Add follows text in .gitignore.


5. edit package.json

You have to add follows settings to deploy your app on heroku in package.json.

vi .gitignore
vi package.json
"engines": {
    "node": "XXX",
    "npm": "XXX"

6. create web server process setting config

On hreoku, You have to create Procfile. It is process configuration file you will start your app.

vi Procfile

Write follows text.

web: node app.js

8. create app on heroku

heroku create ${appname}

Creating ${appname}… done, stack is cedar http://${appname} | [email protected]:${appname}.git Git remote heroku added

9. push Express app code to heroku git repository

When you push code to heroku git repository. All npm dependency resources are installed.

git push heroku master


Other heroku command

start app on local

foreman start

check web server process

heroku ps:scale web=1

check heroku logs

Including access log.

heroku logs

run command on heroku

heroku run ${command}