To use the Digital Asset Management (DAM) or Machine learning (ML) features of the
Product Master service, you need to install MongoDB by using the Helm chart.
Before you begin
You need to have the following installed:
- Helm
- vCPU - 3
- Memory - 2 Gi RAM
Procedure
-
Log in to your Red Hat®
OpenShift®
cluster as an instance administrator.
oc login OpenShift_URL:port
-
Change to the project (namespace) where Product Master is installed by using the
following command.
-
Assign required privileges for this service by using the following command.
oc adm policy add-scc-to-user privileged system:serviceaccount:<namespace>:mongodb-Kubernetes-operator
oc adm policy add-scc-to-user privileged system:serviceaccount:<namespace>:mongodb-database
-
List all the releases for the namespace by using the following command.
Output
NAME URL
mongodb https://mongodb.github.io/helm-charts
-
Add the
MongoDB helm-charts
repository to Helm by using the following
command.
helm repo add MongoDB https://mongodb.github.io/helm-charts
-
Install MongoDB by using the following command.
helm install community-operator MongoDB/community-operator
-
Create PersistentVolume YAML files by using the following
command.
cat <<EOF| oc apply –f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: productmaster-mongodb-svc
name: logs-volume-productmaster-mongodb-0
namespace: <namespace>
spec:
accessModes:
- ReadWriteOnce
storageClassName: <storage_class>
resources:
requests:
storage: 2G
volumeMode: Filesystem
EOF
cat <<EOF| oc apply –f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: productmaster-mongodb-svc
name: data-volume-productmaster-mongodb-0
namespace: <namespace>
spec:
accessModes:
- ReadWriteOnce
storageClassName: <storage_class>
resources:
requests:
storage: 2G
volumeMode: Filesystem
EOF
-
Create and apply the CR file with the following entries. Update the username and
password fields in the CR file.
cat <<EOF| oc apply –f -
apiVersion: mongodbcommunity.mongodb.com/v1
kind: MongoDBCommunity
metadata:
name: productmaster-mongodb
spec:
#To create multiple replicas, update the value of the members property to the number of replicas required
members: 1
type: ReplicaSet
version: "7.0.2"
security:
authentication:
modes: ["SCRAM-SHA-1"]
users:
- name: <mongodb_username>
db: admin
passwordSecretRef:
name: my-user-password
roles:
- name: clusterAdmin
db: admin
- name: userAdminAnyDatabase
db: admin
- name: readWriteAnyDatabase
db: admin
- name: backup
db: admin
scramCredentialsSecretName: my-scram
statefulSet:
spec:
serviceName: productmaster-mongodb-svc
selector: {}
# the user credentials will be generated from this secret
# once the credentials are generated, this secret is no longer required
---
apiVersion: v1
kind: Secret
metadata:
name: my-user-password
type: Opaque
stringData:
password: <mongodb_password>
EOF
-
View MongoDB instance and MongoDB operator statuses by using the following
command.
oc get pods | grep mongodb
NAME READY STATUS RESTARTS AGE
mongodb-kubernetes-operator-857946dd48-wb29f 1/1 Running 0 1m40s
productmaster-mongodb-0 2/2 Running 0 13s
-
Go to the MongoDB instance by using the following command.
oc rsh productmaster-mongodb-0
-
Use the following commands to ensure that the MongoDB instance is up and running with
username and password.
mongosh
use admin
db.auth (“username”,”password”)
use {{ db_name }
db.createcollection(‘test1’)
-
Ensure that you have the same service name as specified in the
mongodb_cr_openshift file. See the service details by using the
following command.
oc get svc | grep mongodb
What to do next
Specify the following in the app_secrets.yaml file during the IBM® Product Master installation.
| Property |
Value |
| mongodb_host
|
<mongodb_services_name> |
| mongodb_name |
<mongodb_db_name> |
| mongodb_pass |
<mongodb_password> |
| mongodb_user |
<mongodb_username> |