Bringing Java and Linux together on the way to Continuous Live Deployment

November 29, 2011 By Sebastian Herold

2 minute read time

Today we have a guest post from Sebastian Herold, a software architect at ImmobilienScout24, the largest German online marketplace for real estate. Sebastian and his team created a YUM plugin for Nexus to better interface between the Java and Linux worlds.

 

In 2010 we switched our build infrastructure to Apache Maven, Sonatype Nexus and JetBrains TeamCity. We then focused on the other side of our delivery pipeline, deployment. Linux package managers, like RPM, bring everything you need: compression, cleanup, unique file ownership, install/post-install scripts and fine-grained dependency management. We thought, why not deploy Java applications via RPM to our Linux-based data centers?

We knew that the RPM Maven Plugin made it easy to build an RPM in Maven’s package phase and to register it as a project artifact. Development Infrastructure using Linux and NexusWith the help of Maven it would be automatically deployed to Nexus. The only question we had was how to transform Nexus Maven repositories into YUM repositories. In case you didn’t know, YUM is an automatic updater and package installer/remover for RPM systems.

Nexus is open source, so we decided to build a plugin. The design was quite easy. We just listen to RepositoryItemEventStore and every time we detect that an RPM package gets stored, we execute the Linux command createrepo to generate the YUM repository. This works out very well for us. Nexus repository URLs like http://nexus:8081/nexus/content/repositories/releases also become YUM repository urls in your /etc/yum.repos.d/*.repo files. In combination with TeamCity and a cronjob doing YUM upgrades every minute on the production servers, Continuous Live Deployment (CLD) becomes a simple task of configuring the right URLs. Of course, it’s not quite that simple as I’ve skipped the details. If you want to learn more about our architecture, you can check out this presentation from one of my colleagues.


 

Tags: Nexus Repo Reel, Sonatype Says, Guest, Community

Written by Sebastian Herold