fabric8io / fabric8

fabric8 is an open source microservices platform based on Docker, Kubernetes and Jenkins
http://fabric8.io/
1.76k stars 504 forks source link

upgrade to nexus 3 #6317

Open rawlingsj opened 8 years ago

rawlingsj commented 8 years ago

After upgrading to the nexus 3 image locally + switch to using the new REST API server to configure the initial repos and groups I started some testing.

The nexus pod now take 7 mins compared with 1 min for the nexus 2 image to start. I've also not got a jenkins build to pass as dependencies keep failing to be found, I restart the build and it will get further but fail on another dependency. I've raise an issue with the sonatype org https://github.com/sonatype/docker-nexus3/issues/25 but for now I'm not going to continue looking to upgrade.

I've pushed the changes to a branch https://github.com/fabric8io/nexus-docker/tree/nexus3

An update to the jenkins maven settings secret is also needed to point to the new style nexus repos.

iscra commented 8 years ago

We noticed that Nexus 2 does not support scoped NPM packages (and will not https://issues.sonatype.org/browse/NEXUS-6857 ). Since scoped packages are used for example by Angular 2, this makes this upgrade even more desired.

rawlingsj commented 8 years ago

We can perhaps offer nexus 3 as an optional app but there seems to be many issues around performance. If we add it in along with an indication that its not recommended yet would that help? That might at least help others test it with their own workflows and raise issues with the sonartype community?

jstrachan commented 8 years ago

sounds like a good idea! Then folks can stop the nexus and install nexus3 - hopefully things should still work

rawlingsj commented 8 years ago

@iscra as discussed on IRC these are the nexus 3 branches I made

https://github.com/rawlingsj/fabric8-devops/tree/nexus3 and the image itself which can be build using https://github.com/fabric8io/nexus-docker/tree/nexus3

iscra commented 8 years ago

Status for now. Created docker images and deployed with changed resources without issues. Pod starts rather fast, about 1 minute, no problems here noticed.

Issues found:

2016-09-15 13:33:28,001+0000 ERROR [qtp351169551-147] admin org.sonatype.nexus.script.plugin.internal.rest.ScriptResource - Exception in script execution for script named: public
javax.script.ScriptException: javax.script.ScriptException: java.lang.IllegalStateException: One or more of the specified group memberNames does not actually exist
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:130) [na:na]
    at org.sonatype.nexus.internal.script.ScriptServiceImpl.eval(ScriptServiceImpl.java:153) [na:na]
    (...)
Caused by: javax.script.ScriptException: java.lang.IllegalStateException: One or more of the specified group memberNames does not actually exist
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:326) [na:na]
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:124) [na:na]
    ... 95 common frames omitted
Caused by: java.lang.IllegalStateException: One or more of the specified group memberNames does not actually exist
rawlingsj commented 8 years ago

Just to check, are you using the readiness check that was in the yaml too?

        readinessProbe:
          httpGet:
            path: "/content/repositories/"
            path: "/"
            port: 8081
          initialDelaySeconds: 60
          timeoutSeconds: 10

I just wanted to make sure that nexus had finished loading.

There's also post start script

          lifecycle:
          postStart:
            exec:
              command:
              - "/opt/sonatype/nexus/postStart.sh"

That should run once nexus has started, this creates the repos. You could try and kubectl exec -ti nexus-xxx bash and run the /opt/sonatype/nexus/postStart.sh directly to see the output of that? If that runs successfully then I suspect if was never run to start with and therefore didn't create the repos.

iscra commented 8 years ago

Readiness checks works. The pod takes about a minute to start in our cluster.

Post script fails to create public repo, because it need to be created last, as it includes others. Quick fix for this in PR fabric8io/nexus-docker#1

Still the big issue remains with all the proxy repositories staying empty...

rawlingsj commented 8 years ago

Strange as I did see the proxy repos populated.

I'm not likely to get a chance today but hopefully early next week I can try to recreate it and help out.

rawlingsj commented 8 years ago

thanks for the PR btw

iscra commented 8 years ago

You are welcome.

After resetting everything again, Nexus download started somewhat working and the repos get filled with downloaded artifacts.

I am getting now probably the same issue with downloading dependencies with differen poms, eg:

[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to nexus (http://nexus/repository/public/): /root/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom.part (No such file or directory) -> [Help 1]

Restarting build gets stuck again on different download...

Maybe some timeout issue?

rawlingsj commented 8 years ago

yep that's the same issue I hit. yeah I think you're right, timeouts is probably the most likely. wonder if that's configurable?

iscra commented 8 years ago

Well, the issue is very much related to the config of the local maven repository.

Changed it to use project workspace (to be persistent)

.mvnrepository

and now there are no download timeouts.

The build succeeds now, although is makes it very slow (first time). The dependency download is extremely slow 2-20 kb/s, not sure why (Nexus 3 / cluster config issues?).

The succeeding builds are faster using the persistent local maven repository then.

iscra commented 8 years ago

The performance issues were partly due to cluster setup and partly to maven not using local cache.

This should be fixed by https://github.com/rawlingsj/fabric8-devops/pull/1

We have now Nexus3 in our cluster deliver both maven and npm artifacts, no more performance issues.

rawlingsj commented 8 years ago

This sounds great @iscra!

I'll pull in the changes and run some tests on different setups, i.e. local minikube, minishift, openshift / kubernetes cluster. I'll try and get to this today and if all is good we should have a new release with it by the end of the week.