Beagle Bone, Cloud 9, Cloud 9 IDE, Edison, Instructables, Intel Edison, IoT, javascript, python

Cloud 9 IDE on Edison

One of the things I like about the BeagleBone(Black) is that it comes with Cloud 9 IDE off the shelf which means that you do not need to install any kind of software (other than a browser) on your host system to start developing something on the board.

In this post we are going to talk about bringing the cloud 9 IDE experience onto the Edison.

What is Cloud 9 IDE?
Cloud 9 IDE wikipedia enrty reads “Cloud9 IDE is a freeware online integrated development environment. It supports more than 40 programming languages, including PHP, Ruby, Python, JavaScript with Node.js, and Go”. While the online service is freeware, the IDE component used in the service is open source (GPL’ed) and this was wikipedia says of the IDE component “It is written almost entirely in JavaScript, and uses Node.js on the back-end. The editor component uses Ace”.
By following the instructions on this blog, we will have Edison hosting the Cloud 9 IDE using which you will be able to write and execute code from your browser.
This could be useful in cases where you have deployed the Edison and is not easily accessible physically or you are too lazy to connect to the Edison using wires and you want to develop some application on Edison.

The remainder of this post talks about how I went about setting up and preparing the Edison to setup the Cloud 9 IDE.
Cloud 9 IDE runnig on Edison
Cloud 9 IDE running on Edison
Preparing the Edison:
The preparation process involves downloading and compiling certain packages which can easily take up the allocated space for the root file system on eMMC of the Edison so you’ll have to boot from the SD card to complete this process. 
You can refer to this post if you want to boot from SD card.
Installing the Cloud 9 IDE:
First thing to do is update the repo list, if you have not done already. Refer to this link if you want to add the repos.We need to install git once the repos are added:
opkg update 
opkg install git
Then clone the repo onto your directory in Edison:
Install the Cloud 9 with following command:(Warning: Running this script will replace Node v0.10.0 on Edison with version v0.12.0 and also installs a different version of the “ps” program)

sh Setup_Cloud9_On_Edison.sh install

During the process of installation, you’ll be prompted to enter your choice if you want to install “ps” program with full set of options, as opposed to installed busy box version on the Edison. It is strongly recommended that you accept the default and install the suggested “ps” without which the IDE would not identify the spawned process and will not be able to stop it.

The script will take 4-5 hours complete.

Start the server with following command:

sh Setup_Cloud9_On_Edison.sh 

Stop the server by pressing ctrl-c in the console.

Your workspace will be placed in directory “/home/root/c9wks” by default.

What does the script do?
If “install” argument is passed:
The Clod 9 SDK expects node v0.12.0. The node that is shipped with Eidson is v0.10.0 so the first thing it does is, gets the node source, compiles and installs it on Edison.Then libevent and tmux packages are installed. While the default LD path on Edison is /usr/lib, we also need to export the lib path /usr/local/lib where the libevent will be installed and tmux config file for some reason is only able to detect it from this path and passing the libevent location to config din’t work. The Edison already comes with slightly older version of libevent so you will now have two versions of libevent.

If the script is not passed any argument:
Then the server is started with following command:

./server.js -p 8080 -l 0.0.0.0 -a $USR_NAME:$PSWD -w $WKS

Configuring:
There are two things that are configurable in the script:

  • WKS: Workspace path – This is where all the files created will be stored
  • USR_NAME, PSWD : User name and password : When specified, you will be prompted to enter these when the Edison is accessed from the browser

You will find these variables at the very beginning of the script.

What do I do next?
Start up the browser and navigate to your board with 8080 as port:

http::<ip_addr_of_edison>8080

You can use ifconfig to know the IP address of the Edison or read the log message printed out when you started the Cloud 9 server in the previous step.

Here you can type and execute code and also can debug Javascript files and also you get access to the console.

You can start this script every time the Edison boot up using cron.

Why not on Galileo?
If you have been following my blog for some time, you might have noticed the trend that I tend to do same project on both the Galileo and Edison. I started out with Galileo on this one but soon discovered that the node 0.12.0 version required by c9sdk cannot be installed on Galileo since node does not work on non SSE2 and CMOV architectures (on Intel based processors). Need to explore if c9sdk can still be used with older version of node.
Demo:
So now is the time for demo. In video below you can see me running a python script and debugging a javascript file both of which are meant to blink LED connected to port5.

Instructable:
You can find step by step instructions for setting up the Cloud 9 IDE on Edison here.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s