Nexus deployment in OpenShift Enterprise 3.0

For testing, prototyping, sometimes you just want to host a local nexus in your OpenShift environment.  This also helps for some offline scenarios as well.  Your environment and enterprise may need to address other requirements, but here is a quick way to deploy it.

As an openshift user:

oc new-project infra-tools
oc new-app sonatype/nexus:oss

This will give you external access to your nexus repository. (i.e. nexus.infra-tools.cloudapps.example.com)

oc expose service nexus

Nexus settings:
Add the Red Hat's hosted maven repository[1] if you have JBoss Middleware in your enterprise. These will be of the type "Proxy Repository".  Provide a repository name/id, such as jbossga and jbossea.  The remote storage location will be the URLs referenced on the site.  Once they've been added, under "Public Repositories" configuration, add your two new repo's to the ordered group repositories list.

OpenShift settings:
Likely the reason you have a nexus repo in openshift is you may be doing some S2I builds.  Ideally your nexus will be referenced using the dns name, based on the commands above the openshift resolvable dns will be "nexus.infra-tools.svc.cluster.local".  This entry should be used in your maven settings.xml when referencing your nexus repository.

As of OpenShift Enterprise 3.0.1, the openshift dns is not resolvable in an S2I builder container[2][3]. Thus you will need to add your openshift master IP as the first nameserver (where the SkyDNS is running) to the master and each nodes /etc/resolv.conf.

A sample github kitchensink[4] project is available to test with once your nexus is setup.




[1] https://access.redhat.com/maven-repository
[2] https://github.com/openshift/origin/issues/4303
[3] https://trello.com/c/f3azg2K1/685-builder-containers-don-t-have-openshift-cluster-dns
[4] https://github.com/kenthua/kitchensink-local
comments powered by Disqus