Skip to content

Latest commit

 

History

History
84 lines (61 loc) · 5.66 KB

File metadata and controls

84 lines (61 loc) · 5.66 KB

Mongo DB Enterprise backing service

This is an example of the Nuxeo Operator integrating Nuxeo with Mongo DB Enterprise. This test was performed on Code Ready Containers (CRC) v13.

This stack is not integrated into the backing service testing Makefile because with Mongo Operator version 1.7 it is not possible to bring up a Mongo cluster fully declaratively. So the stack testing cannot be completely automated. The steps to run this test are as follows:

First: kustomize build test/backing-services/operator-mongodb.com-enterprise-1.7 | kubectl apply -f -

This creates the CRDs, the Mongo Operator, and the Mongo Ops Manager. The Ops Manager is necessary because it's how you generate an API key which is required for the Mongo Operator to interact with the Mongo Ops Manager. From the Mongo docs: For the Kubernetes Operator to create or update objects in your Cloud Manager or Ops Manager Project, you need to store your Programmatic API Key as a Kubernetes secret.

After running kustomize build as described, verify the Mongo Operator and Mongo Ops Manager deployed correctly:

$ kubectl get po
NAME                                           READY   STATUS    RESTARTS   AGE
mongodb-enterprise-operator-846557b8f9-gc7fk   1/1     Running   0          3h45m
ops-manager-0                                  1/1     Running   0          133m
ops-manager-db-0                               1/1     Running   0          125m
ops-manager-db-1                               1/1     Running   0          126m
ops-manager-db-2                               1/1     Running   0          127m

$ kubectl get opsmanager
NAME        REPLICAS VERSION STATE (OPSMANAGER) STATE (APPDB) STATE (BACKUP)  ...
ops-manager 1        4.4.1   Running            Running                       ...

Next, port-forward to the Ops Manager service:

$ kubectl port-forward service/ops-manager-svc 8080

Log in to the Ops Manager from a browser using the Username and Password in test/backing-services/operator-mongodb.com-enterprise-1.7/ops-manager-admin-secret.yaml. Navigate to the automatically-created ops-manager-db project, and create a Project-level API key as described here: https://docs.opsmanager.mongodb.com/rapid/tutorial/manage-programmatic-api-keys/#create-org-app-api-key under the heading Manage Programmatic Access to a Project.

After generating the API key, you will have to hand-edit test/backing-services/stacks/mongodb.com-enterprise-standalone/kustomization.yaml to patch in the API key values and the Org ID generated by the Operator for the Ops Manager organization. The Org ID is available in the Ops Manager UI.

With this manual intervention complete, you can now declaratively deploy the Mongo Database, the Nuxeo cluster, and connect Nuxeo to the Mongo backing service. First, review test/backing-services/stacks/mongodb.com-enterprise-standalone/nuxeo.yaml and potentially modify spec.access.hostname to generate the Route or Ingress that is suitable for your Kubernetes cluster. The example provided supports CRC. Then:

$ kustomize build test/backing-services/stacks/mongodb.com-enterprise-standalone | kubectl apply -f -

This is a very simple stack with just Nuxeo and a stand-alone instance of MongoDB configured with no authentication. Verify:

$ kubectl get po
NAME                                           READY     STATUS    RESTARTS   AGE
mongodb-enterprise-operator-846557b8f9-gc7fk   1/1       Running   0          3h55m
my-standalone-0                                1/1       Running   0          26m
nuxeo-cluster-f8bdfc4f9-hgp7n                  1/1       Running   1          24m
ops-manager-0                                  1/1       Running   0          142m
ops-manager-db-0                               1/1       Running   0          135m
ops-manager-db-1                               1/1       Running   0          135m
ops-manager-db-2                               1/1       Running   0          136m

$ kubectl get nuxeo,mdb
NAME                      VERSION   HEALTH    AVAILABLE   DESIRED
nuxeo.appzygy.net/nuxeo   10.10     healthy   1           1

NAME                                TYPE         STATE     VERSION     AGE
mongodb.mongodb.com/my-standalone   Standalone   Running   4.2.1-ent   81m

$ kubectl logs nuxeo-cluster-f8bdfc4f9-hgp7n
<deleted for brevity>
======================================================================
= Component Loading Status: Pending: 0 / Missing: 0 / Unstarted: 0 / Total: 502
======================================================================
2020-09-24 20:07:31.455 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [24,651] milliseconds

Now you can access Nuxeo using the route generated by the Nuxeo Operator from the nuxeo manifest hostname field. As defaulted for CRC: http://nuxeo-server.apps-crc.testing

And, if you navigate to the my-standalone-0 Deployment in the the Ops Manager UI and click on the Data tab, you can see the nuxeo-generated MongoDB collections and documents, providing additional verification of successful integration of Nuxeo and Mongo by the Nuxeo Operator.

The current version of the Nuxeo Operator supports a minimal pre-configured backing service integration for Mongo with a stand-alone instance and no authentication. There is an example in the test/backing-services/stacks/mongodb.com-enterprise-standalone directory named nuxeo-preconfig.yaml. The Mongo pre-configured backing service stanza looks like:

spec:
  ...
  backingServices:
  - preConfigured:
      type: MongoEnterprise
      resource: my-standalone

A future version of the Nuxeo Operator will support the various Mongo topologies as well as channel encryption and TLS/SCRAM authentication.