Lecture: 1 mn

This guide assumes an existing code base with git configuration.

Step 1: Download and Install Heroku CLI

Download link: https://devcenter.heroku.com/articles/heroku-cli#download-and-install

Step 2: Login to Heroku

Make sure you are in the project directory and enter the following command, then enter the username and password when prompted

$ heroku login

Note that if you do not yet have a Heroku account, you will first need to create one here, before you can login

Heroku login page

Step 3: Create the Heroku app

The following command will create a heroku app with a randomly generated name:

$ heroku create

Optionally, you can specify a custom name for app before creating with this command:

$ heroku create [custom name]

Use the following command to confirm that a heroku remote has been added to the project:

$ git remote -v

If a heroku remote is not present, you can easily add one with the following command:

$ heroku git:remote -a [app name]

Step 4: Deploy

Once all the above steps are completed, you can deploy your app by pushing to the heroku remote:

$ git push heroku master

Step 5: Done! Your app is now deployed on Heroku and the url will be provided once the last command is done executing.

N.B:

To view live application logs:

$ heroku logs -t

To access the application console

$ heroku run bash

For more common heroku cli commands https://devhints.io/heroku

Imprimer