Tuesday, December 31, 2013

CapeDwarf, GAE and the Raspberry Pi

This Christmas I decided to take a look at turning my collection of Raspberry Pi's into a private Cloud. I had two options: OpenShift Origins or CapeDwarf. I decided to go with CapeDwarf since it runs on OpenShift as well.

I started with the latest v1 of CapeDwarf which requires JBossAS 7.2, with the intention to build everything from scratch. However, there were some issues due to the migration of AS7 to WildFly as well as with that version of CapeDwarf, so after talking with the team I decided to wait until they released the 2.0.0.Beta1 version just after Christmas.

I may still try and build everything from scratch at some point, but to save time I decided to go with the pre-build binary distribution and verify that it worked on the Pi. Before we start, make sure you have the right version of maven installed (3 onwards):

This isn't right, so let's update maven (sudo apt-get install maven git). And obviously ensure you've got a version of JDK 7 installed (this is the page I refer to when updating). Next download the pre-built Beta 6. Try running that (don't forget to set JBOSS_HOME):

And eventually 

It's always nice to see WildFly start, unmodified, on a Raspberry Pi :-) You can test this WildFly deployment by going to the management console (port 9990). I installed the Lynx browser on my Pi so I could test locally (it's a headless instance). Lynx takes a bit of getting used to, but:

Validating your CapeDwarf installation isn't as simple as it could be at the moment, but I know the team are going to look into this along with a worked example. So for now we'll follow the instructions on the github repo and check out capedwarf-shared and capedwarf-blue. Build -shared first. Initially ...

mvn clean install -Dmaven.repo.local=~/mavenrepo

However, it turns out that using ~ causes problems, so let's redo using an absolute path this time:

mvn clean install -Dmaven.repo.local=/home/pi/mavenrepo

Next, we build -blue using the same local maven repo:

mvn -U clean install -Dmaven.repo.local=/home/pi/mavenrepo

Now initially this kept failing after 30 minutes or so …

After some investigation it turns out this is due to name resolution within the Pi itself. Either ensure your Pi is registered in a DNS somewhere or edit /etc/hosts to set to the name of the Pi. Then rebuild.

And after an hour or so (the Pi isn't fast!):

And that's about it for now. We've got GAE (via CapeDwarf) up and running on a Pi, as well as verifying the installation. Next steps would be to build and deploy some applications, but that'll have to wait for now.