Puppet and Selenium

So I’m doing a full day workshop on Continuous Delivery on Monday (ACK!) and one part of that deals with Puppet for managing machines. And it dawned on me at like 130 AM that I didn’t actually know how to get the Selenium Server onto a machine through Puppet. “Someone has to have done this” I says to myself and head off to Google only to discover I’m already the top hit for it.

Damn my SEO skills.

Which of course means I now had to implement it myself. Again, its 130 AM. Turns out that it is both simple, and maddeningly complicated to do this, but I’ll explain the steps so that you don’t have to figure things out. (And so I have something I can reference in a month when I’ll likely need it again I’m sure.)

Oh, and I’m going to write this in the order you will encounter problems, but if you are looking to implement this yourself you will want to go from the bottom to the top.

Selenium Server

Through Puppet, the goal will be to make sure that the Selenium Server jar is in a known location and is running. The easiest thing would be to try and get it through an OS package, except that we just ship a jar that you download from either Google Code or Se-HQ. In order for Puppet to be able to deploy a file it needs to be part of a module, so off we went down the learn-to-create-puppet-modules rabbit hole. Turns out it was rather easy.

Too easy in fact, since it copied as planned, but threw an error while starting. Ends up that Ubuntu doesn’t ship with Java.

JRE (part one)

No problem, I’ll just create a simple Puppet class to check that the sun-java6-jre package is present and at a specific version. (I don’t like the idea of ‘installed’ as that puts control of what is on a machine in the hands of the OS vendor and not me.)

What?! No such package? Oh. Fantastic. Seems that you have to change how apt-get locates files before it can even locate the package.


The file that needs to be changed is /etc/apt/sources.list and the two ‘partner’ lines need to uncommented. But one of the reasons why we use Puppet is that we should never have to login to a machine to configure anything so that is yet another module that needs to be written (since our custom sources.list file will need to be copied).

With that in place we are now able to tell Puppet to install the package.

But it would be far too simple if that would work.

JRE (part two)

Good old Sun/Oracle. They can’t just let you install something useful onto your machine. No, they present you with this license that no one actually reads and press keys at the appropriate places. Puppet isn’t really good at that. Google was [actually] helpful for this problem and gave me the trick which got quickly ported over to Java 6.

Then after fighting horrible hotel wireless while the internet was downloaded I finally had Java on my machine. Which mean my Selenium Server could start.

Seems like this was much more involved than it should have been, but at the same time is also goes to show exactly why you do automated configuration management in the first place. And illustrates why you don’t just roll this out to your production machines willy-nilly.

Oh, and all this stuff is no available on github ‘cus I’m nice like that.

Comments 1

  1. Marco Pivetta wrote:

    Thank you for these hints! You just saved me hours of terrible aches, especially the JRE part… :)

    Posted 25 Mar 2012 at 4:29 pm

Post a Comment

Your email is never published nor shared. Required fields are marked *