sonatype / nxrm3-helm-repository

Helm3 charts for Nexus Repository Manager
Other
33 stars 37 forks source link

HTTP 404 When Using NEXUS_CONTENT env variable and Ingress Path #39

Open pchang388 opened 1 year ago

pchang388 commented 1 year ago

Chart: nexus-repository-manager Chart version: 45.0.0

Problem: When trying to configure nexus behind ingress-nginx with a base path (/nexus), I always get 404 when hitting the UI:

image

I set the NEXUS_CONTENT env variable to:

nexus:
  docker:
    enabled: true
    # registries:
    #   - host: homelab
    #     port: 5000
    #     secretName: registry-secret
  env:
    # minimum recommended memory settings for a small, person instance from
    # https://help.sonatype.com/repomanager3/product-information/system-requirements
    - name: INSTALL4J_ADD_VM_PARAMS
      value: |-
        -Xms2703M -Xmx2703M
        -XX:MaxDirectMemorySize=2703M
        -XX:+UnlockExperimentalVMOptions
        -XX:+UseCGroupMemoryLimitForHeap
        -Djava.util.prefs.userRoot=/nexus-data/javaprefs
    - name: NEXUS_SECURITY_RANDOMPASSWORD
      value: "true"
    - name: NEXUS_CONTEXT
      value: nexus

I also set the liveness and readiness probes to match:

  livenessProbe:
    initialDelaySeconds: 30
    periodSeconds: 30
    failureThreshold: 6
    timeoutSeconds: 10
    path: /nexus
  readinessProbe:
    initialDelaySeconds: 30
    periodSeconds: 30
    failureThreshold: 6
    timeoutSeconds: 10
    path: /nexus

Ingress Rule:

ingress:
  enabled: true
  ingressClassName: nginx
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    cert-manager.io/cluster-issuer: "homelab-selfsigned-issuer"
    # kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/ssl-redirect: "true" 
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
  hostPath: /nexus(/|$)(.*)
  hostRepo: my-domain-name.home

But when accessing the UI, I can only see a 404 response. It appears I am missing some configuration or option, probably something simple I overlooked, does anyone have an idea by chance? This is usually straight forward with other apps and involves similar steps like seteting a ROOT_URL or path and then using ingress rules to add the path.

Any help is appreciated, thanks!

pchang388 commented 1 year ago

just a FYI - I was using chart version: 42.0.1 previously and setting the NEXUS_CONTEXT env variable did nothing:

in the logs I saw:

2023-01-16 05:44:22,645+0000 INFO  [FelixStartLevel] *SYSTEM org.sonatype.nexus.bootstrap.ConfigurationBuilder -   nexus-context-path='/'

When I upgraded to 45.0.0, it worked as expected and I saw:

 *SYSTEM org.sonatype.nexus.bootstrap.ConfigurationBuilder -   nexus-context-path='/nexus'

If you are seeing this same issue and wondering why it won't work, try upgrading. I did not see anyone mention this but at least in my current env/set up, this is what was also causing me issues. The 404 response issue mentioned in the first post still exists though, I haven't found the problem yet