Using an external database for Managed services

You can configure Managed services to use an external MongoDB. This configuration is optional.

External MongoDB connection

The supported version for external MongoDB is 4.2.x.

Steps to connect an external MongoDB connection:

  1. Back up cam_cr.yaml.

     oc get manageservice cam -o yaml > cam_cr.yaml
    
  2. Open the cam_cr.yaml and edit the following properties.

       global:
         externalDb: <true | false >
         externalDbConfig: < external DB config in base 64 >
         externalMongoDBCertificate: <CA certificate  in  base 64 >
         mongoDbUrl: <mongodburl in  base 64  >
    
    • externalDb: Set this value to true.

    • externalDbConfig: Add base64 encode for extra configuration. This is added as an object and contain all the options that require to connect the mongo connection.

    • Sample configuration:

       {
         "ssl":true,
         "sslValidate":false,
         "cert":"/usr/src/app/dbcerts/external_db_ca.crt"
       }
    

    Note: Add certificate key along with the path of certificate."cert":"/usr/src/app/dbcerts/external_db_ca.crt" is a required key value pair in the configuration object.

    • externalMongoDBCertificate: base64 encode of the certificate.

    • mongoDbUrl: External database url.

    Note: Some of the mongo instance may use only url and need not require any certificate. In such case, update externalDb and mongoDbUrl.

  3. Save your changes.

  4. After the above changes in cam_cr.yaml, delete the cam_cr.

     oc delete manageservices cam
    
  5. Open new terminal and run the following command to delete the finalizer.

     oc edit manageservices cam
    
     finalizers:
         - helm.sdk.operatorframework.io/uninstall-release
    
  6. Once the finalizer is deleted, your cam_cr.yaml will also be deleted. To recreate with edited cam_cr.yaml file, follow the below command.

     oc apply -f cam_cr.yaml
    
  7. All the pods are deleted and newly created pods points to the external MongoDB connection.

Disconnection of external MongoDB and reconnect to the cam-mongo pods

Steps to disconnect from an external MongoDB connection and reconnect to the cam-mongo pods:

  1. Back up cam_cr.yaml.

  2. Open the cam_cr.yaml and set the externalDb to false.

     global:
          externalDb:  false
    
  3. Save your changes.

  4. After the above changes in cam_cr.yaml, delete the cam_cr.yaml.

     oc delete manageservices cam
    
  5. Open new terminal and run the following command to delete the finalizer.

     oc edit manageservices cam
    
     finalizers:
         - helm.sdk.operatorframework.io/uninstall-release
    
  6. All the pods are deleted and newly created pods points to the cam-mongo pods.