Look Ma, No Hands! Developing for the Cloud, in the Cloud with Cloud9 IDE

Call me old fashioned, but I swore that I would never use a web based, cloud hosted integrated development environment.  I wanted to code locally as I wanted the perceived speed of a native IDE while developing my big ideas. 

Disclaimer:  Several years ago, I laughed at all the young kids and their text messaging.  I was famous for saying that if I had something to tell you, I would give you a quick call.  Fast forward a few years and I have an unlimited messaging account for my mobile phone and send hundreds of text messages a week.

I finally decided to give Cloud9 IDE a go and I have to admit, this is where the future of integrated development environments is headed.  The speed is great and the convenience of having my code and IDE available to me on any device or computer is very enticing.

If I am developing web applications in the cloud, I probably want to deploy them in the cloud as well.  Enter OpenShift.  OpenShift is Red Hat’s free, auto-scaling Platform as a Service (PaaS) for applications. As an application platform in the cloud, OpenShift manages the stack so you can focus on your code.

What is Cloud9?

Cloud9 IDE is an online development environment for Javascript and Node.js applications as well as HTML, CSS, PHP, Java, Ruby and 23 other languages.  The source code is freely available over at github and is licensed under version 3 of the GPL.

 

Why use it?

You’re programming for the web, on the web. Teams can collaborate on projects and run them within the browser. When you’re finished, deploy it—and you’re done!

 

Who is it for?

Anyone looking for a modern and secure IDE. With your code online and accessible from anywhere, you can work more efficiently than before.

Let’s look at how to integrate OpenShift deployments from inside of the Cloud9 IDE.  In this blog post, I will be using Cloud9 as hosted by c9.io.

 

Step 1:  Sign up for an OpenShift account

Head on over to www.openshift.com and sign up for an account.  It’s quick, easy, and free.  The only thing required is an email address and password.

Step 2: Sign up for a c9.io account

Point your browser over to c9.io and click sign up in the upper right hand corner.  Choose the Free account type by clicking on the Sign Up For Free button.

Once you have entered in your email address, username, and selected a password, you will receive an activation email to enable your account.

Step 3:Add your C9.io ssh public key to OpenShift

Once you are logged into c9.io, click on show your SSH key on the right hand side of the screen.

Copy the ssh key to your clipboard and then head over to www.openshift.com and login.  Once you are logged in, click on My Account in the top right hand corner to display all of your current ssh keys.  Click add a new key and paste the contents from your clipboard.

Step 4: Create a new project in Cloud9

Create a new project inside of Cloud9 by clicking the plus sign under my projects on the left hand side of the screen.  Give your project a name and select Git as the project type.

Step 5: Create an application on OpenShift to deploy your code

Head back over to www.openshift.com and click on create a new application.  Select your application type, give your application a name, and click on create.

Step 6:  Add your OpenShift git repository to your C9 project

Now that your application has been created, you will be presented with a git repository URL that we need to add as a remote on your Cloud9 project.

In this example, my git repository URL is:

ssh://2b3c09bc001b499bbe4938490b0d44eb@c9node-onpaas.rhcloud.com/~/git/c9node.git/

 

In order to add this remote repository to my Cloud9 project, I open up the console while editing my project and type:

git remote add openshift -m master ssh://2b3c09bc001b499bbe4938490b0d44eb@c9node-onpaas.rhcloud.com/~/git/c9node.git/

 

Now that I have my OpenShift git repository added, I simply need to pull down the source files provided by OpenShift.

git pull -s recursive -X theirs openshift master

 

This will pull down any existing source code that I have deployed on my OpenShift application and overwrite any files that I have in my Cloud9 project.

Step 7: Code (This is what you love to do)

Make any changes that want to your application / project files and develop that next hot app.  Once you are ready for deployment on OpenShift, all you need to do is issue the following command:

git push openshift

 

Once you have pushed your changes up to OpenShift, you can view your application live on the OpenShift Platform as a Service.

Categories
News
Tags
Comments are closed.