IntelliJ IDEA 2019.1 Help

Getting Started with Heroku

IntelliJ IDEA provides the ability to deploy your application to Heroku without using a command-line interface. You can deploy, redeploy and remove cloud applications right inside the IDE.

Prerequisites

The following prerequisites should be met before working with Heroku in IntelliJ IDEA:

Add the Heroku user account to IntelliJ IDEA

First of all, you need to add the existing Heroku account to IntelliJ IDEA:

  1. Open the Settings/Preferences dialog (Ctrl+Alt+S) and select Build, Execution, Deployment | Clouds.

  2. Click the Add button and select Heroku.

  3. Specify the credentials for your Heroku account:

    Heroku credentials
    • Name - Specify the server name. This name will be used later to create the Heroku deployment configuration.

    • Username (email) - Specify the e-mail address.

    • Password - Specify the account password.

    • API key - Specify the API key generated for your account.

  4. Make sure that the Connection successful message is displayed. Then, click OK.

Create the Heroku deployment configuration

Before deploying your application to Heroku, you need to create the Heroku deployment configuration:

  1. Select Run | Edit Configurations from the main menu.

  2. Click the Add button (Alt+Insert) and select Heroku Deployment from the popup.

  3. Specify deployment settings:

    Heroku deployment configuration
    • Name - Specify the deployment configuration name.

    • Server - Make sure that the server created in the previous paragraph is selected.

    • Deployment - Select the project to be deployed.

    • Use custom application name - Specify the name used to access the application.

  4. After you have specified all the required settings, click OK.

Deploy the application

After creating the deployment configuration, we are ready to deploy the application:

  1. Press Ctrl twice and start typing the deployment configuration name.

  2. Select the configuration from the list and press Enter.

    Run configuration
  3. In the Commit and Push dialog, write the commit message and click Push without Commit.

  4. In the Git Login dialog, specify any Username. Copy and paste your Heroku API key to the Password field. Click Log In.

    Git Login
  5. Wait until the application is deployed. You can watch the process in the Application Servers window.

    Deployment output

    After deploying the application, click the link to open it in a browser.

    Application in browser

Redeploy the application

To publish the changed version of your application:

  1. In the Application Servers window, right-click your application and select Redeploy.

    Redeploy
  2. In the Commit and Push dialog, write the commit message and click Commit and Push.

    Commit and Push
  3. (Optional) In the Git Login dialog, specify any Username. In the Password field, enter the Heroku API key. Click Log In.

    Git Login
  4. After deploying an application, switch to the web browser and reload the page to see the changes.

    Redeployed application in browser

Delete the application

To delete your application along with its source code from Heroku, do the following:

  1. In the Application Servers window, right-click your application and select Undeploy.

  2. In the opened dialog, enter your Heroku password and click OK.

    Confirm delete application
  3. Open the web browser, refresh the application’s page and make sure that your application is unavailable.

    Removed application in browser
Last modified: 20 June 2019

See Also