Forums/Using Cloud9 IDE/How To

Deploy your application to Heroku

Detmar ter Huurne
posted this on November 23, 2011 17:10

This article will explain to you how to deploy your applications to Heroku. Heroku is cloud based application platform for easy deployment of your applications. The integration with Cloud9 IDE makes your development process even more agile. Please, continue to read this article if you already have an account. Otherwise go to the Heroku Homepage to create one for free.

Also, you can watch a demo of the feature when it was released here.

Heroku Deployment

To get started we use a simple NodeJS application, which is explained in this article.

IMPORTANT: Before you attempt to deploy your application, please make sure that you have committed all your changes to version control. Cloud9 will deply for you whatever has been committed to version control. For example, with git on the command line you would type:

git add .
git commit -m "Committing the latest version of my app"

Once your latest changes have been committed, you can continue to deploy your application.

The deployment option is placed at the bottom of the project bar, which is located on the left.

Screen_Shot_2011-12-12_at_17.30.40.png

From there you can press the plus sign (+) next to Deploy to add another deploy target. When you choose Heroku as the type of deployment an option to sign in to Heroku appears (see images below). After you have signed in to your Heroku account you can create a new deploy target or choose an existing one from your account.

Note: Heroku only allows you to create names for your apps that contain uppercase, lowercase and dashes.

   Screen_Shot_2011-12-12_at_17.36.34.png   Screen_Shot_2011-12-12_at_17.44.37.png   Screen_Shot_2011-12-12_at_16.51.59.png

Now you have added a deploy target, which you can use to deploy your application to. Next, you can press Deploy to continue the process and the following window will pop-up.

Screen_Shot_2011-12-12_at_16.53.01.png

We can generate a package.json file for you, which contains the metadata that contains information to share with Heroku. The following lines are added to the file:

{
  "name": "cloud9-heroku-example",
  "version": "0.0.1"
}

Screen_Shot_2011-12-12_at_16.53.19.png

The Procfile is needed to start the application in Heroku. You can just create a new file, add the line below, and save it as 'Procfile'. (do not add any file extensions)

web: node server.js

Try the deploy button again. The console will directly output the following when the deployment is completed:

Screen_Shot_2011-12-12_at_16.59.21.png

In only view simple steps your application has been deployed to Heroku!

 

Comments

User photo
Tom Krause

Hello,

I was trying to deploy a very simple app to Heroku today but something seems broken.

Everytime I press deploy, the IDE signals that it goes offline and the process runs forever only printing "*master" to the console.

When clicking on the Heroku deployment target in the IDE, it show that the Heroku URL is empty.

DO you have an idea what the problem is?

 

Thanks and best,

Tom

May 13, 2012 13:45
User photo
Tomás Agustín González

It happens exactly the same to me!

Thanks

Tomás

May 15, 2012 19:05
User photo
Brian Brown

I was following this tutorial and tried to deploy a HelloWorld server to Heroku. I got to the point where I was adding a new Heroku deploy target. When I hit Add on the "Add a deploy target" dialog I get the following error:

 Create deploy error

An error occurred while creating a new deploy target

422: Unprocessable Entity | [object Object]


(image attached)

Brian 

May 16, 2012 23:49
User photo
Tom Krause

Hi,

I got it working though not via the deploy button.

Create your server so that a deploy target exists at Heroku. Look up the github repository in your Heroku account and add it as a remote origin.

Then, just push your code via git hub  to that origin and it is running on heroku.

 

Best,

Tom

May 20, 2012 15:50
User photo
Daniela Gavidia
Cloud9 IDE, Inc

Our Heroku feature is not working properly at the moment. We will release a fix for it this week. In the meantime, Tom is right, you can still deploy your app using git. I've posted instructions on how to do it here:

http://support.cloud9ide.com/entries/21468947-deploy-your-app-to-he...

Kind regards,

Daniela

Cloud9 IDE Support

May 21, 2012 15:03
User photo
ibrahim

Hi,

 

We have a static web page app that we are trying to deploy on heroku, since the post says the heroku feature is not working properly we tried to simulate the command line steps, it pushes succesfully but we get an application error when we try to open it via the heroku url, any ideas?

 

Ibrahim

June 22, 2012 21:52
User photo
Daniela Gavidia
Cloud9 IDE, Inc

Hello Ibrahim,

We had some issues with the Heroku deployment feature in May, but it was fixed back then. If you are using the command-line steps in 

http://support.cloud9ide.com/entries/21468947-deploy-your-app-to-he...

and you are able to push successfully, I'm afraid that the error you are seeing is either an error in your app or you are missing some needed file. Is this a node.js application? If so, please make sure you have pushed a package.json and a Procfile. Maybe try deploying a simple "hello world" app first to make sure you are going through the deploy flow properly. If that doesn't work, contact us at support@c9.io and we'll try to help.

June 25, 2012 12:29
User photo
Li Ouyang

Can't deploy to Heroku.  This is the error I get.

git status failed 127 chdir(): No such file or directory

May 22, 2013 23:34
User photo
vasiliy shmyrev

Hello all,

 

I (already) have a rails app running on heroku. How can I edit the source code online using Cloud9?

Thanks!

November 05, 2013 15:34