Heroku Notes

Quick Heroku Reference

Heroku Notes

by John Vincent


Posted on April 4, 2017


Put in one place those pesky Heroku notes.

This stuff ends up sprayed everywhere, so let's create a reference document.

Heroku

Heroku is a platform-as-a-service (PaaS) that allows you to deploy web applications to virtual machines known as dynos.

Account

Sign up for an account.

Heroku CLI

see Heroku CLI

Install Heroku CLI

Download and run the OSX installer (heroku-osx.pkg)

Uninstall Heroku CLI

rm -rf /usr/local/heroku
rm -rf ~/.local/share/heroku ~/.config/heroku ~/.cache/heroku

Getting Started

See Getting Started

Log in:

heroku login
email:
password:

Clone sample application

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

Deploy the App

Create an app

heroku create

Note can set the app name

heroku create jv-very-simple-heroku-node

Note the git repository and app URL, for example:

https://tranquil-island-77730.herokuapp.com/
https://git.heroku.com/tranquil-island-77730.git

Deploy the code

git push heroku master

After it's done, you make sure you have a dyno running to serve the app:

heroku ps:scale web=1

Open the website with the URL above or:

heroku open

Dashboard

See Dashboard

  • Select app
  • More, View Logs

Heroku Commands

CLI Usage

Run current Heroku app

heroku open
List apps:
heroku apps

Delete app:
heroku apps:destroy --app jv-very-simple-heroku-node --confirm jv-very-simple-heroku-node

View the logs:
heroku logs

Set environment variables:
heroku config:set VAR_NAME=value

Manage dynos:
heroku ps

Heroku bash

Cloned instance, all changes to file system will be dropped

heroku run bash
ls
ps

Now have access to the shell.

Heroku Error

If get application error accessing the application in a browser

heroku logs --tail

Other

package.json

nodemon server.js fails at Heroku. Use node server.js

Continuous Integration with Travis CIChrome Bookmarks