Configuring Oracle database
You can use an Oracle database for PMF.
A pre-configured database is required to store the data for Mobile Foundation server, Push and Application Center components.
By default, PMF installers is packaged with IBM® Db2 JDBC drivers.
To do so proceed as follows.
Prerequisites
- Ensure that the Oracle thin JDBC driver is placed in a Persistent Volume.
- Use “oracle service name” for the name property under the db section in the
CR.yaml
file. - Ensure that the Oracle database user is created with UPPERCASE and the same user is used while creating the database secret.
Procedure
Proceed as follows.
-
Place the JDBC driver in a NFS mounted volume.
Example
/nfs/share/dbdrivers
-
Create a Persistent Volume (PV) and Persistent Volume Claim (PVC) by providing the correct NFS server details and the path where the JDBC driver is stored.
Sample PersistentVolume.yaml file
cat <<EOF | kubectl apply -f - apiVersion: v1 kind: PersistentVolume metadata: labels: name: mfppvdbdrivers name: mfppvdbdrivers spec: accessModes: - ReadWriteMany capacity: storage: 20Gi nfs: path: <nfs_path> server: <nfs_server> EOF
Sample PersistentVolumeClaim.yaml file
cat <<EOF | kubectl apply -f - apiVersion: v1 kind: PersistentVolumeClaim metadata: name: mfppvc namespace: projectname-or-namespace spec: accessModes: - ReadWriteMany resources: requests: storage: 20Gi selector: matchLabels: name: mfppvdbdrivers volumeName: mfppvdbdrivers status: accessModes: - ReadWriteMany capacity: storage: 20Gi EOF
-
Update the PVC name in the driverPvc section of the
charts_v1_mfoperator_cr.yaml
file.Example
db: type: "ORACLE" host: "<Oracle DB Host IP>" port: "<Oracle DB Host PORT>" name: "ORCLCDB" secret: "server-dbsecret-oracle" schema: "C##OCS201224" ssl: false sslTrustStoreSecret : "" driverPvc: "mfppvc" adminCredentialsSecret: ""
Note: Ensure that you add the correct projectname-or-namespace.
NFS server unavailable
If there is no NFS server is available, proceed as follows to set up PV and PVC.
Note: This is not an recommended for for production environment.
-
Place the JDBC driver in your local path. You can use any path.
Example
/mnt/data
-
Create PV and PVC as follows. Sample PersistentVolume.yaml
cat <<EOF | kubectl apply -f - apiVersion: v1 kind: PersistentVolume metadata: name: task-pv-volume labels: type: local spec: storageClassName: manual capacity: storage: 10Gi accessModes: - ReadOnlyMany hostPath: path: "/mnt/data" EOF
Sample PersistentVolumeClaim.yaml file
cat <<EOF | kubectl apply -f - apiVersion: v1 kind: PersistentVolumeClaim metadata: name: task-pv-claim spec: storageClassName: manual accessModes: - ReadOnlyMany resources: requests: storage: 3Gi EOF
Handling PMF database operations with admin privileges (Optional)
You can have a separate database admin secret to execute the database initialization tasks, that would in turn create the required PMF schema and tables in the database (if it does not exist). Through the database Admin secret, you can control the Data Definition Language (DDL) operations on your database instance.
-
Create PMF Admin database secret for the PMF Server component by using the following code snippet.
cat <<EOF | kubectl apply -f - apiVersion: v1 data: MFPF_ADMIN_DB_ADMIN_USERNAME: encoded_uname MFPF_ADMIN_DB_ADMIN_PASSWORD: encoded_password MFPF_RUNTIME_DB_ADMIN_USERNAME: encoded_uname MFPF_RUNTIME_DB_ADMIN_PASSWORD: encoded_password MFPF_PUSH_DB_ADMIN_USERNAME: encoded_uname MFPF_PUSH_DB_ADMIN_PASSWORD: encoded_password kind: Secret metadata: name: mfpserver-dbadminsecret type: Opaque EOF
If the {mfpserver-dbadminsecret} is not provided, then the default
database secret name
is used to perform database initialization tasks. -
Create PMF AppCenter database secret for the PMF Appcenter component by using the following code snippet.
cat <<EOF | kubectl apply -f - apiVersion: v1 data: MFPF_APPCNTR_DB_ADMIN_USERNAME: encoded_uname MFPF_APPCNTR_DB_ADMIN_PASSWORD: encoded_password kind: Secret metadata: name: appcenter-dbadminsecret type: Opaque EOF
If the {appcenter-dbadminsecret} name is not provided, then the default
database secret name
is used to perform database initialization tasks.