Categories
Eclipse IoT

Running Eclipse Che on a Raspberry Pi

Eclipse Che is a very cool Eclipse technology that provides you with a browser-based IDE that can be extended with plug-ins for virtually any language, framework, or tool that you may want to use in your day-to-day development.

This means that, right from your browser, you can do Java development and have Maven automatically build your stuff, or do Javascript development and still be able to easily integrate with e.g grunt to build your website.

As you may have guessed, most of the magic of Che is in its server. While in many cases you will run the Che server on your own laptop or private server, it’s also pretty cool to run it on an embedded/IoT device such as Raspberry Pi so as not only you have an “IDE-in-a-box” setup, but you can also actually develop code targeting the Pi itself. And yes, that means blinking LEDs… and more ! 😉

Install Docker

Assuming you are running an up-to-date Jessie distribution, it should be fairly straightforward to install the armhf version of docker provided by the Hypriot team.

cd ~/Downloads
wget https://downloads.hypriot.com/docker-hypriot_1.10.3-1_armhf.deb
sudo dpkg -i docker-hypriot_1.10.3-1_armhf.deb
sudo usermod -aG docker pi

At this point, you want to quickly logout and login again, in order for the addition of the user pi to the docker group to be properly applied. Then, we can test that docker is indeed running:

docker ps

This should grant you with an empty list of running docker containers. How surprising!? But at least it means you have Docker setup taken care of!

FWIW, the Hypriot folks have a Debian repo for making things easier. I have had problems with it though so you may want to stay away from it until they fix it?

Downloading Che

wget https://install.codenvycorp.com/che/eclipse-che-latest.zip
unzip eclipse-che-latest.zip
cd eclipse-che*

Updating Che’s built-in stacks to be ARM-compatible

When Che creates your development environment, it instantiates a Docker container that has the tools you need. That is to say, if you are to do Node development, Che can provision a so-called “stack” that contains npm, grunt, etc. The stacks configured by default in Che are based on x86 Docker images, so you will need to replace them with armfh-compatible ones.

sed -i 's/codenvy\/ubuntu_jdk8/kartben\/armhf-che-jdk8/g' stacks/predefined-stacks.json
sed -i 's/codenvy\/node/kartben\/armhf-che-node/g' stacks/predefined-stacks.json

I’ve built an image for Java and Node development, which means you’ll be able to use the “Java”, “Node”, and “Blank” ready-to-go stacks. Should you want to have a look at the Dockerfiles for those, see here.

Note that you don’t have to use the built-in stacks, and you can also create your on-the-fly, using a custom recipe. There as well, the base Docker image you’re building from will need to be ARMHF. You may want to use images from hypriot or armv7 on DockerHub.

Update other default settings

The Raspberry Pi 3 is quad-core, which means you actually get some very decent performances out of it. However, it’s still an embedded sort of device, and SD cards are typically not fast either. It’s a good idea to increase the timeout Che uses to detect a workspace is properly provisioned.

sed -i 's/machine.ws_agent.max_start_time_ms=60000/machine.ws_agent.max_start_time_ms=240000/g' conf/che.properties

Launch Che!

You’re good to go! All that is left is to launch Che. As you will likely be accessing it from e.g your Desktop computer, you need to make sure to use the -r:<external-IP> command-line argument to make sure it works properly from “non-localhost”:

./bin/che.sh run -r:192.168.2.26

Note that depending on your setup, the JAVA_HOME environment variable may not be set, in which case Che will complain, and you will have to first set the said environment variable:

export JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt

You can actually add this to your ~/.bashrc to make sure JAVA_HOME is always set.

That’s it! You can now use the Java and Node stacks, and start using your web browser to develop right on your Pi, with *all* the features you would expect from a “real” IDE. Enjoy, and stay tuned for a video tutorial soon.

Categories
Eclipse IoT

3 hardware platforms of choice to get started with Eclipse IoT

When you prototype IoT solutions, it becomes necessary very early in your development phase to use an actual embedded platform to run your software, and to test it in an environment that is as close as possible of what you expect your production environment to be.

As I’m sure you know, there are lots of hardware prototyping platforms out there. In this article you will learn about three very popular options (from the cheapest/tiniest to the most capable) that can help you get started with Eclipse IoT projects in no time, and get pointers to useful docs and tutorials to make the initial setup as simple as possible!