MongoDB Ops Manager change URL root path

7/31/2020

I installed MongoDB Ops Manager in our on-prem kubernetes cluster following these steps: https://docs.mongodb.com/kubernetes-operator/stable/tutorial/deploy-om-container/.

It seems to work and it is accessible (at http://localhost:8080/) when doing: kubectl -n mongodb port-forward service/ops-manager-svc 8080:8080

The problem is that I'd like to access the service it provides via our HAProxy ingress, not by port forwarding.

If I configure the ingress as follows:

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: mongo-ops-manager-ingress
  namespace: mongodb
spec:
  rules:
  - http:
      paths:
      - path: /mongodb
        backend:
          serviceName: ops-manager-svc
          servicePort: 8080

I have to access the service at the http://<public ip>/mongodb URL, which confuses the Ops Manager since it looks in the root for its resources, not in /mongodb in order for haproxy to pick up the requests and route them accordingly.

I have two other applications set up this way (our application and Grafana) and both work fine. Now to the question: Is there a configuration directive (apart from mms.centralUrl which doesn't seem to work) that allows us to modify the root path of the Ops Manager application?

I'm looking for something similar to the root_url property of Grafana: https://grafana.com/tutorials/run-grafana-behind-a-proxy/#1

-- Paul
kubernetes
mongodb

1 Answer

9/15/2020

I do not use Ops Manager myself but looking at the source I see some asset references like this:

<img src="{{centralUrl}}/static/images/icon-alert.png" width="30"

And some references like this:

<img class="not-found-image" src="/static/images/sadface.gif" />

... suggesting that centralUrl is the right parameter to set but perhaps it is not respected everywhere, specifically for /static assets.

I suggest taking a closer look at your running installation to see if the path specified in centralUrl is respected anywhere at all, if it is then that would be consistent with it being partially respected.

You can try setting up aliasing/URL rewriting in your web server to alias /static to /mongodb/static.

Then, regardless of outcome, this entire issue seems appropriate to escalate to MongoDB via the official support channels if you are a paying customer, otherwise I would inquire at https://developer.mongodb.com/community/forums/.

-- D. SM
Source: StackOverflow