Sunday, 26 August 2012

Running Jenkins CI on a Raspberry Pi

I've had this idea for some time of running my own Jenkins CI (continuous integration) server for building my mobile apps.  That was exactly what I intended to run on my Raspberry Pi when it arrived.  Now it has arrived, I thought I would share an issue I had so that others with the same problem can also solve it

My Raspberry Pi

My Pi is running Raspbian, which is Debian based, so theoretically installing Jenkins is as simple as running apt-get:
sudo apt-get install jenkins
This certainly installed it ok, but for some reason, it wouldn't start up.  Searching google revealed on possible issue regarding Java versions - specifically that Sun Java currently doesn't run on the Raspberry Pi.  A summary of how to fix that issue is:
sudo update-alternatives --config java
 
then chose OpenJDK followed by a reboot of the Pi.
Jenkins starts up as expected after boot.
However, my installation had already installed OpenJDK, so that wasn't my issue

As it turns out, the issue is a bug in Jenkins which leads Jenkins to attempt to extract itself into a full directory, resulting in a
java.io.IOException: No space left on device
in the logs (/var/log/jenkins/jenkins.log)

This issue was supposedly fixed in Jenkins version 1.443.  However my installation was 1.447, so it is still an issue (I have re-raised the bug as JENKINS-14934).  In the meantime the original bug JENKINS-11366 has a workaround which solved it for me:

Edit /etc/default/jenkins and change the line starting JENKINS_ARGS so that it references JENKINS_HOME instead of /var/run
JENKINS_ARGS="--webroot=$JENKINS_HOME/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT"
Jenkins on my Raspberry Pi

12 comments:

  1. As you already started running the jenkins on a raspberry - do you have any idea which build monitor to choose for running on raspberry? I tried the walldisplay plugin (and the raspberry is running nothing except the walldisplay page and chromium) but the raspberry always freezes after several hours (~4-5h). I think it is due to the "heavy" javascript on this html page. When hard-resetting by pulling the plug the whole image is broken and the card has to be re-imaged. Rather annoying.

    Do you have any other idea how to use the raspberry as build monitor e.g. with another more lightweight page?

    ReplyDelete
  2. Hmmm, you mean to display a dashboard type display? Otherwise presumably the standard Jenkins build page is enough.

    I'm just using the Jenkins main page to show me the status of my builds, but I do like the idea of a wall display

    ReplyDelete
  3. Hey,

    Could you perhaps write something about performance? How much CPU and memory does Jenkins use?

    Thanks,
    Ralf

    ReplyDelete
  4. Hi !
    I just receive my raspberry pi yesterday. I've tried to install raspbian + Jenkins. It is working, but really slowly.
    The Jenkins process is using more than 97% of the CPU when trying to access to the setting page, and impossible to do something after that. Did someone can use jenkins on raspberry, not just running it ?
    Do you have specific settings for that ?
    Regards

    ReplyDelete
  5. Hi

    I've not had any significant performance issues, sure it's slow but then it's a raspberry pi. I'll get some stats at the weekend and post them

    Antony

    ReplyDelete
  6. Hi again

    Sorry for the delay. So when Jenkins is idle, but running, it uses about 30% CPU. When it is actually doing something (running a build, loading a page etc) it varies between 70% and 92%, which makes it slow but usable

    That said I have overclocked my RasPi which probably helps

    Antony

    ReplyDelete
  7. I just had this as a great idea too. Thank you.

    ReplyDelete
  8. Hi,

    does anybody solved the performance issues? I got my RasberryPI today and just installed Jenkins. Unfortunately Jenkins runs incredibly slow. I can't even navigate to the settings page. The java process hangs with 98,7% CPU usage. I already overclocked the CPU to 800MHz but it does not work out better say it does not change anything. Anybody any ideas how to get it running a bit better?

    Sascha

    ReplyDelete
  9. Hi Antony,

    Which version of java are you running on your RPi?
    I am trying to do the same but getting an error:
    hudson.util.HudsonFailedToLoad: java.lang.StringIndexOutOfBoundsException: String index out of range: 18
    at hudson.WebAppMain$3.run(WebAppMain.java:234)

    Best regards,
    Yuri

    ReplyDelete
  10. Hi Yuri

    It was just the standard one that came with Raspian. Are you definitely using the OpenJDK and not Sun Java?

    Antony

    ReplyDelete
  11. Hi Antony,

    I got it working with jdk8, not in tomcat, but using apt-get install jenkins and service jenkins start... but it is slooow ;-) I'm setting up a beaglebone atm, hopefully that will be a bit faster... the RPi had only 256MB (an old one...)

    Thx for the reply!
    Regards,
    Yuri

    ReplyDelete