Heroku - Eclipse Integration

Great news for Heroku developers who use Eclipse IDE for their development. We now have an integrated experience that allows you to develop and manage alll your Heroku apps right from Eclipse.

Installation & Setup

Pre-requisites

In order to use this plugin, you will need the following:

  1. Eclipse v 3.7 or higher (Java or JEE edition)
  2. A Heroku account. Click here sign up for an account

Installation

  1. Open Eclipse and navigate to your project workspace.
  2. Go to Help Install new Software
    install heroku plugin
  3. Click Add to add the plugin update site
  4. Give the update site a name (e.g. Heroku) and enter http://eclipse-plugin.herokuapp.com/install for the "Location" and click "Ok". Add update site
  5. Select the newly added update Site, select the checkbox against the "Heroku Eclipse Integration"
  6. Click Next two times
  7. Accept the MIT license and click Finish

API Key setup

  1. Open EclipsePreferences
  2. Select Heroku
  3. Enter Heroku username in Email field
  4. Enter your password in Password field
  5. Click Login. If your login was successful, your Heroku API key would be populated in the API Key field.
    Note: If you know your API key, you can paste your API key directly into the API Key field.
  6. Click Login to validate your API key. You should see a Validation of your API key was successful! message at the top of the preferences window setup api key

Create a SSH Key

Note: If you already have a SSH key that you use with your Heroku account, you can skip this step.

In order to deploy your code to Heroku, the plugin uses Git. The plugin depends on the eGit eclipse plugin for all Git related tasks. A SSH key is required in order for eGit to communicate with Heroku. You will need to setup this the first time you build an app on Heroku. First you will need to generate a new SSH key. Follow the below steps to generate a new key

  1. Go to Eclipse Preferences General Network Connections SSH2
  2. Choose the Key Management tab
  3. Click Generate RSA Key... SSH Eclipse Preferences Window
  4. Click Save Private Key..., accepting the defaults
  5. Click Ok

Adding your SSH Key to Heroku

  1. Open EclipsePreferences
  2. Select Heroku
  3. In the SSH Key section, click Generate if you need to generate a new key. If you have previously generated & saved a SSH key is automatically loaded from the default location. If it is not in the default location, click Load SSH Key
  4. Click on Add to add your SSH Key to Heroku Add SSH Key to Heroku

Creating a new Application

Create from Template

  1. Open FileNewOther and expand the Heroku section Create app from template
  2. Select Create App from Template
  3. Pick a template from the list. Optionally you can also give your new application a name. If you do not give a name, Heroku will generate a unique name for your newly created application. Create app from template
  4. Click Finish to create a new application from the selected template. Once the application is created, the plugin will use eGit and pull down the source code repository as a local Git Repository. Git clone
  5. Click Finish to create a new application from the selected template. Once the application is created, the plugin will use eGit and pull down the source code repository as a local Git Repository. Local Project and Git Repository

Deploying changes to Heroku

  1. Make the code changes and any other changes to your eclipse project.
  2. Once you are ready to deploy these changes, right click on the project, and go to Team Commit. Enter a commit message based on the changes you made. Ensure that any new files that you added to the project are selected. Commit Changes
  3. Click Commit
  4. Right click the ProjectTeam Push to Upstream Git Push
  5. Heroku will now receive your locally committed changes and the perform a build based on the type of app. If the build is successful, Heroku will then deploy the changes to your App on Heroku. You will see the build output from Heroku once the changes have been successfully pushed to Heroku. Git Push - Success

Importing your Heroku App

Importing a Heroku Application

  1. Open FileImport and expand the Heroku section Import App
  2. Select Existing Heroku ApplicationNext
  3. Select the App that you want to import and click Next Create app from template
  4. The plugin will automatically try to detect the type of project (or Eclipse Nature) to apply. If you know the type of project, you can choose "Import as General Project" and apply the relevant nature once the import operation completes.
    Note: If your project is a Java project using Maven, choose "Auto detected project", and it will automatically apply the Maven nature and that will take care of setting up your project and build path etc. correctly. Project Type selection
  5. Click Finish to create a new application from the selected template. Once the application is created, the plugin will use eGit and pull down the source code repository as a local Git Repository. Local Project and Git Repository

Deploying changes to Heroku

Once the application is imported, your project is associated with a Git Repository and you can follow the steps in Deploying your changes on how to deploy changes to your imported application.

Managing your Apps

View all your Heroku Apps

  1. Open WindowShow View Other and expand the Heroku section. View Apps
  2. You will see a new View called "My Heroku Apps" open up that will list all your Apps associated with your Heroku account. You can sort by the application name by clicking on the "Name" header column. View Apps

Viewing your application Info

  1. In the My Heroku Apps view you can either double-click on a specific app or, select App Info from the Right click context menu. Other and expand the Heroku section. View Apps
  2. Your application info will open in a new Eclipse Editor. App Info consist of 4 tabs:
    • Application Info : Provides the name, web URL, git URL for the application
    • Collaborators Manage your collaborators for your App
    • Environment Variables: Manage your App's environment variables
    • Processes: Manage your App's processes (restart, scale etc.)
    App Info

Renaming your App

  1. If you did not provide a name when creating the application, you can rename your application in the Application Info window. Double click on the Application in the My Heroku Apps view.
  2. Go to the Application Info tab
  3. Enter a new name for your App and click Rename.

    Note: The name should beging with a letter and only contain letters, numbers and dashes and have at least two characters. Rename your App

Managing collaborators

  1. You can share your Heroku App with other developers and collaborate with them on your on your application. The current owner of the application is indicated by the App Owner icon next to the collaborator. To add a new Collaborator, double click on the Application in the My Heroku Apps view.
  2. Go to the Collaborators tab
  3. Click on  +  & enter the email of the Collaborator
    Note: To remove a collaborator, click on the collaborator you want to remove, click on  -  and click Yes to remove the collaborator.
  4. Click Ok to add the collaborator. The collaborator will recieve an email notification that they have been added as a collaborator to your application. Add Collaborator

Transferring Ownership

  1. You can transfer ownership of your application to a collaborator. Once you transfer ownership, you will not be able to manage the application when you were the owner. To tranfer ownership, double click on the Application in the My Heroku Apps view.
  2. Go to the Collaborators tab
  3. Click on collaborator that you want to make the new owner
  4. Click on Make Owner Make Owner

Managing environment variables

  1. It is a best practice to make any resources that your application depends on as environment variables. To add a new environment variable, double click on the Application in the My Heroku Apps view.
  2. Go to the Environment Variables tab
  3. Click on  +  & enter the environment variable key and value
  4. Click Ok to add the environment variable.

    Note: Your application will be restared everytime you add a new environment variable. Add Environment Variables
  5. Note: You can also remove environment variables by clicking on  -  & edit an existing environment variable by clicking Edit

Destroying your App

  1. Right click on the Application in the My Heroku Apps view.
  2. Click on DestroyWarning: Once you destroy the app you cannot restore it back without contacting Heroku. Please ensure that you really really want to destroy the App. ) Destroy application

Viewing application processes

  1. Heroku apps can support multiple processes that can be managed under that 1 app. To look at the state of the current processes, Double click on the Application in the My Heroku Apps view.
  2. Go to the Processes tab
  3. This table lists all "running" processeses with the following information
    • Status : If the processes is currently "running" it'll display green, otherwise "red".
    • Process Type : The name of the processes
    • Dynos : The current number of dynos executing the process
    • Command : The command that Heroku uses to start the process
    Application processes

Restarting your App

  1. Right click on the Application in the My Heroku Apps view.
  2. Click on RestartWarning: Restart will restart all processes in your application. If you want to restart a specific process refer to Restarting specific process in your App. ] Restart application

Restarting a specific Process in your App

  1. Double click on the Application in the My Heroku Apps view.
  2. Go to the Processes tab
  3. Click on the Process type that you want to restart
  4. Click on Restart. Restart process

Viewing application logs

  1. Right click on the Application in the My Heroku Apps view.
  2. Click on Logs Viewing Application logs Note: If you want to toggle between logs for different applications,click on icon and pick the application log you want to view.

Viewing logs for specific App process

  1. Double click on the Application in the My Heroku Apps view.
  2. Go to the Processes tab
  3. Click on the Process type that you want to view logs for.
  4. Click on Logs. Restart process

Scaling your App

  1. You can run your application on multiple dynos with a click of a button. Right click on the Application in the My Heroku Apps view.
  2. Click on Scale Scaling your App
  3. Enter the name of the process you want to scale and the number of dynos you want to scale it to. Scaling your App
  4. Click on Ok to scale

Scaling a specific App process

  1. Double click on the Application in the My Heroku Apps view.
  2. Go to the Processes tab
  3. Click on the Process type that you want to scale
  4. Click on Scale. Scaling your process
  5. Select the number of dynos you want to scale this process. Scaling your App
  6. Click on Ok to scale