Using Oracle as Persistent Mobile Foundation database

Using Oracle as Persistent Mobile Foundation database

A pre-configured database is required to store the data for Mobile Foundation server, Push and Application Center components.

By default, Mobile Foundation installers is packaged with IBM DB2 JDBC drivers. For Oracle, make sure that the JDBC driver (for Oracle - use the Oracle thin JDBC driver) is placed within a Persistent Volume.

Note:

For Oracle database:

  1. Use Oracle Service Name for the property name under the db section in Custom Resource File (CR.yaml).
  2. Make sure the Oracle database user is created with UPPERCASE and the same is used while creating the database secret.
  1. Place the JDBC driver in a NFS mounted volume. Example: /nfs/share/dbdrivers

  2. 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 yaml is shown below.

      # Sample PersistentVolume.yaml
      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
       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
    
  3. Update PVC name in “driverPvc” in the charts_v1_mfoperator_cr.yaml

     # Example from charts_v1_mfoperator_cr.yaml
     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: Make sure you add the right projectname-or-namespace in the yaml above.

If there is no NFS server available, then follow the below approach to set up PV and PVC [Not recommendated for production]

Place the JDBC driver in your local path. Example: “/mnt/data”. It is not mandatory to keep the path as “/mnt/data”. you can use any path.

Create PV and PVC as below:

# 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
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: task-pv-claim
spec:
  storageClassName: manual
  accessModes:
    - ReadOnlyMany
  resources:
    requests:
      storage: 3Gi
   EOF         

[OPTIONAL] Handling PMF database operations with special (admin) privileges

We can have a separate database admin secret to execute the database initialization tasks, which would in turn create the required Mobile Foundation schema and tables in the database (if it does not already exist). Through the database Admin secret, you can control the DDL operations on your database instance.

If the PMF Server DB Admin Secret and PMF Appcenter DB Admin Secret details are not provided, then the default Database Secret Name will be used to perform database initialization tasks.

Run the below code snippet to create a PMF Server DB Admin Secret for Mobile Foundation Server.

# Create Server Admin DB secret for PMF server component
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

Run the below code snippet to create a PMF Appcenter DB Admin Secret for Appcenter.

# Create Appcenter Admin DB secret for PMF Appcenter
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
Last modified on