MongoDB

If you already have a MongoDB instance running consider using that and skip this step and proceed with installing GitLab. See also Pre-Installation Tasks on which configuration values of your MongoDB installation you need to gather for the installation of IBM Industry Solutions Workbench.

Note:

To complete this task, you must be a cluster administrator. To prevent issues with PVCs, a default storage class must be set.

Install MongoDB from OpenShift Developer Catalog

Install the MongoDB database services in the namespace foundation:

  1. Switch in the OpenShift web console to the Developer perspective
  2. Click +Add inside the left navigation of the web console
  3. Select the All services tile to navigate to the Developer Catalog
  4. Filter by keyword: MongoDB
  5. Select the database service: MongoDB provided by Red Hat
  6. Read the information about the service and click Instantiate Template
  7. Modify the following template parameters on the Instantiate Template page:
    • Namespace: foundation
    • Memory Limit: 512Mi
    • Namespace of ImageStream: openshift
    • Database Service Name: mongodb
    • MongoDB Database Name: mongodb
    • Volume Capacity: 1Gi
    • Version of MongoDB Image: 3.6
    • Click Create
  8. Wait a few minutes until the Deployment rollout is complete. The current status is displayed in section Conditions in the Template Instances → Template page

Retrieve Credentials

You can retrieve the credentials and database name for connecting to the MongoDB service by looking for a Kubernetes secret named mongodb:

export MONGODB_DATABASE=$(oc -n foundation get secret mongodb -o jsonpath='{.data.database-name}' | base64 -d)
export MONGODB_USER=$(oc -n foundation get secret mongodb -o jsonpath='{.data.database-user}' | base64 -d)
export MONGODB_PASSWORD=$(oc -n foundation get secret mongodb -o jsonpath='{.data.database-password}' | base64 -d)
export MONGODB_ADMIN_PASSWORD=$(oc -n foundation get secret mongodb -o jsonpath='{.data.database-admin-password}' | base64 -d)

Verify the MongoDB Installation

After exporting the credentials and database name, first open a remote shell session to the running MongoDB pod:

oc get pod | grep mongodb
oc rsh <pod>

In your terminal, verify that the mongoDB user can login with his credentials:

sh-4.2$ mongo -u $MONGODB_USER -p $MONGODB_PASSWORD $MONGODB_DATABASE --eval "db.version()"

MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:27017/mongodb
MongoDB server version: 3.6.3
3.6.3