Deploying SonaType's Nexus
• Mark Eschbach
I’ve always been a fan of Sonatype’s Nexus. When I setup my workstation like 5 years ago I shied away from setting up an instance because I was moving away from Java and trying to publish more of my work as open source projects. They probably aren’t useful for anyone except me but before then everything was held on my own machines.
Fast forward to now. Docker is supported both as a runtime environment and Sonatype hosts images. At least that is my
understanding. Internally I need to customize Docker images prior to launch and the default repository provided in
registry
is a bit funky operationally. No real operational data can be gleaned. The whole registry
image feels
like an unfinished product.
The newest image is under sonatype/nexus3
. The image has three layers.
Not bad. Well, it launched. However it failed to bind to the port. After waiting a bit the service came on-line and
was ready to begin serving requests. This took way too long though: like between 4 to 10 minutes.
Reading through the logs much of the delay appears to be the result of building an initial directory structure for the underlying OrientDB. Out of the approximate three minutes starting up this took 1 minute 30 seconds. Before I go crazy and start looking optimizing start time I want to ensure I can actually store Docker images within Nexus.
Logging in as an administrator, under Settings (gear icon), and Repositories you can add more. I dig the default Maven repositories still. I am unsure what the difference between a group or hosted repositories are…so I went with the hosted variety.
405 Method Not Allowed
from the URL I was using. Bummer. Making the assumption the repository would be available via
the HTTP URL given under the URL
field was a bit silly I suppose. Turns out you need to expose additional ports
to be able to access the Docker repository. Sigh, tick-tock, waiting for the program to load. Probably best from a
disaster management philosophy to create a value with a base configuration.
Once it booted up again and was running I was able to create a new hosted repository. Give it a port to bind on, in my test case I used port 8083 & exposed it. Worked like a charm.
So lessons learned for the out of the box base configuration:
- The system is slow to startup, on the order of 3 to 7 minutes. This could probably be optimized away by providing the system with more memory but it would require testing.
- Multiple ports will need to be exposed to support Docker. One for the primary web user interface and a second to communicate over the Docker HTTP protocol.
- Docker Hosted repositories work well but will require user auth of the Docker Daemon with the user name and password of the user attempting ot push the artifact. This has implications for multi-user systems with all users who may utilize Docker.