Puppet-eering the Nexus Repository Manager

Puppet and Nexus - Featured Image

Puppet and Nexus

The popular configuration management tool Puppet is widely used to provision and manage myriads of servers. It can be used to install software initially, configure it and update it. Doing all that is easy since you can describe the configuration in a Ruby-based domain specific language and track any changes in your version control system of choice.

Puppet can then farm the configuration out to as many servers as you like. This makes the process highly scalable and repeatable.

And talking about scaling, a lot of Puppet users like Atlassian or HubSpot use the Nexus Repository Manager as their warehouse for all binary components in their development and IT infrastructure. Let’s have a closer look on what can be done…

Nexus Repository Manager

The Nexus Repository Manager is designed to receive, host and provide components. These binaries can come from external repositories or repository managers or from your own build processes or even manual uploads. The repository manager in turn makes them all available at a one central location.

Puppet

With all this in mind, it should come as no surprise that Puppet and the Nexus Repository Manager can work hand in hand beautifully. In fact, the typical use cases are

  • Install a Nexus Repository Manager
  • Configure a Nexus Repository Manager
  • Use Nexus Repository Manager as a component source

Let’s have a look at these in a bit more detail.

Install and Configure

The advantage of using Puppet for installing and configuring your repository manager compared to manual processes are scalability and repeatability. You can write one Puppet script and reuse it for as many servers as you like. Or you can build up a library of scripts that allow you create a base installation of the repository manager and then apply specific configurations to different servers.

For example, you could create scripts that simply configure read-only repository managers that you deploy in your network on a whim whenever you notice performance bottlenecks with regards to downloading components in your builds or by other systems. You automatically configure them to proxy your master Nexus Repository Manager that receives all the deployments. By doing so, you immediately take a lot of load of that server allowing you to grow further.

You could also combine this with puppet scripts to install a reverse proxy, maybe using nginx, together with each repository manager. Or maybe, if you maintain multiple continuous integration server clusters, you could automate the installation of Nexus Repository Manager into each of these cluster.

Getting Things Done

Sounds easy and full of promise, right? Well, thanks to the tireless efforts of the Puppet community you have a choice of ready-made puppet modules available on the Puppet Forge that really do make it easy.

They achieve their automation via clever Ruby scripting and rely on the REST API of the Nexus Repository Manager.

A good example module for installing and configuring the Nexus Repository Manager is available from HubSpot. Another well-tested module is maintained by Atlassian. It features a rich set of commands to that allow you to configure things such as repositories or security settings.

If you want to perform further configurations beyond could use the Ruby-based Nexus CLI commands from RiotGames or create your own using the REST API.

And Then?

Once you got all those Nexus Repository Managers installed and humming away you are all done with using Puppet, right? Nope – wrong. The repository manager can now act as a source of binary files that it provides to other puppet scripts that download components and use them in their scripts.

For example, imagine a setup where a build script runs on your CI server and creates a release component in the form of a Java web application archive (WAR file). The final step of this build process is to upload the file to the Nexus Repository Manager. Now it is available for a puppet script to download it and deploy it on numerous servers effortlessly.

Downloading files from the repository manager is basically a simple HTTP request, but even there the Puppet community created some nice little helper modules to simplify the task. You can for example check out this project from CEH, but there are other choices.

Conclusion

Puppet is a great tool to manage and provision your infrastructure and the Nexus Repository Manager acts as a central warehouse for your binary components. Together they will make your maintenance much easier than you thought possible and you won’t want to provision or configure a server manually ever again. Especially not if you know that there are 20 more servers that need the same config…

The following two tabs change content below.

Manfred Moser

Manfred Moser is trainer, author and community advocate at Sonatype working on efforts around the Nexus Repository Manager, the Nexus IQ Server and the Central Repository. He is a regular speaker at conference such as JavaOne, AnDevCon, OSCON and others.. Fluent in both German and English, he also speaks and writes Java and a bunch of other programming languages and uses these skills as committer and project lead on a number of open source projects such as the Android Maven Plugin. The open source community and open source software has been a passion of his for well over a decade and he is sure it will be for a few more decades. Manfred can be found on most social channels, including Twitter, LinkedIn and Google+.
Authors

Related posts

One Comment;

  1. Pingback: Sonatype and CloudBees Launch DevOps Express Initiative | EuropaWire.eu

*

Top