Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only

Deploy Oracle on Openshift to use with Maximo

By Jean-Philippe Alexandre posted Tue December 13, 2022 06:22 AM

  

Maximo application suite is shipped with DB2 license to use with MAS Manage.
But historically, and for a lots of reason, sometimes we may need Oracle DB with our MAS Manage deployment. 

With Maximo on SNO delivered with the last version of MAS 8.9, having a all-in-one would be great asset.
Let's go to deploy oracle enterprise database within our openshift cluster.

(By the way, there is an operator for that, available in oracle registry, but too complex for my usage ; if somebody succeed to go with this operator, thank you to share it ! 😉)

Be careful : Oracle 19c is setting NLS_LENGTH_SEMANTICS to BYTE by default and not easy to change. In my case, I had to create a trigger to modify that :

Log in Oracle as system or sysdba user and run this:

create or replace 
TRIGGER ALTER_NLS 
AFTER LOGON ON DATABASE 
BEGIN
  execute immediate 'ALTER SESSION SET NLS_LENGTH_SEMANTICS="CHAR"';
END;

If you do not run this you may have translation issues or length issues on text search field in maximo.

You will first need to create an oracle user account and agree the license usage :
- visit the link https://container-registry.oracle.com/
- navigate to "Database"


- Select the enterprise edition (Oracle 19c, compatible with MAS Manage)

- Sign in and accept the terms 


Once done, you are ready to go on openshift stuffs. At the end of this article you will find a template to create everything in a single yaml file.

- Login in your openshift console
- Create a new project : ex oracle-db

- Create an image pull secret named "oracle-pull-secret" :




- create a configmap named "oracle-settings" with two keys "oracle.pdb" and "oracle.sid" :

- create a secret, named oracle-admin-password, with a password entry :

- create a new service account, named "oracle-sa" :
- create a role binding for this service account, granting him the SCC anyuid :

- create a PVC, named "oradata-pvc-env1" ; you will need to adjust the storage class according to your platform; it must support FileSystem access mode :
(ReadWriteOne should be enough but did not tested it)

- Create a new service named "oracle-env1" :

- Finally, create a new deployment :

kind: Deployment
apiVersion: apps/v1
metadata:
  labels:
    app: oracle-env1
    app.kubernetes.io/component: oracle
    app.kubernetes.io/instance: oracle-env1
    app.openshift.io/runtime-namespace: oracle-db
  name: oracle
  namespace: oracle-db
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: oracle-env1
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: oracle-env1
        deploymentconfig: oracle
    spec:
      containers:
      - name: oracle
        env:
        - name: ORACLE_SID
          valueFrom:
            configMapKeyRef:
              name: oracle-settings
              key: oracle.sid
        - name: ORACLE_PDB
          valueFrom:
            configMapKeyRef:
              name: oracle-settings
              key: oracle.pdb
        - name: ORACLE_PWD
          valueFrom:
            secretKeyRef:
              key: password
              name: oracle-admin-password
        image: container-registry.oracle.com/database/enterprise:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 1521
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /opt/oracle/oradata
          name: oradata-pvc
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      serviceAccountName: oracle-sa
      volumes:
      - name: oradata-pvc
        persistentVolumeClaim:
          claimName: oradata-pvc-env1​


Et voilà ! 
You will end up with a brand new oracle schema, with default user system, or sys users, with the password provided during the setup. You now have to create the tablespaces, maximo users and forward all theses parameters to you MAS Manage deployment.

you jdbc url will be jdbc:oracle:thin:@oracle-env1.oracle-db.svc:1521/maximo_pdb


You can do all of that in one shot, with this yaml file you can import through oc command line or through the "import" button, on the top right corner of the openshift web console ; Of course, don't forget to substitute all {{*}} values in this file to match yours.

---
kind: Namespace
apiVersion: v1
metadata:
  name: {{NAMESPACE}}
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: oracle-settings
  namespace: {{NAMESPACE}}
data:
  oracle.sid: {{ORACLE_SID}}
  oracle.pdb : {{ORACLE_PDB}}
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: oradata-pvc-env1
  namespace: {{NAMESPACE}}
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: {{ORACLE_ORADATA_SIZE}}
  storageClassName: {{ORACLE_ORADATA_STORAGECLASS}}
  volumeMode: Filesystem
---
kind: Secret
apiVersion: v1
metadata:
  name: oracle-admin-password
  namespace: {{NAMESPACE}}
data:
  password: {{ORACLE_ADMINPASSWORD}}
type: Opaque
---
kind: Secret
apiVersion: v1
metadata:
  name: oracle-pull-secret
  namespace: {{NAMESPACE}}
data:
  .dockerconfigjson: >-
    {{ORACLE_REGISTRY_DOCKERCONFIGJSON}}
type: kubernetes.io/dockerconfigjson
---
kind: ServiceAccount
apiVersion: v1
metadata:
  name: oracle-sa
  namespace: {{NAMESPACE}}
imagePullSecrets:
  - name: oracle-pull-secret
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: 'system:openshift:scc:anyuid'
  namespace: {{NAMESPACE}}
subjects:
  - kind: ServiceAccount
    name: oracle-sa
    namespace: {{NAMESPACE}}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: 'system:openshift:scc:anyuid'
---
kind: Deployment
apiVersion: apps/v1
metadata:
  labels:
    app: oracle-env1
    app.kubernetes.io/component: oracle
    app.kubernetes.io/instance: oracle-env1
    app.openshift.io/runtime-namespace: {{NAMESPACE}}
  name: oracle
  namespace: {{NAMESPACE}}
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: oracle-env1
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: oracle-env1
        deploymentconfig: oracle
    spec:
      containers:
      - name: oracle
        env:
        - name: ORACLE_SID
          valueFrom:
            configMapKeyRef:
              name: oracle-settings
              key: oracle.sid
        - name: ORACLE_PDB
          valueFrom:
            configMapKeyRef:
              name: oracle-settings
              key: oracle.pdb
        - name: ORACLE_PWD
          valueFrom:
            secretKeyRef:
              key: password
              name: oracle-admin-password
        image: container-registry.oracle.com/database/enterprise:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 1521
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /opt/oracle/oradata
          name: oradata-pvc
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      serviceAccountName: oracle-sa
      volumes:
      - name: oradata-pvc
        persistentVolumeClaim:
          claimName: oradata-pvc-env1
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: oracle-env1
    app.kubernetes.io/component: oracle
    app.kubernetes.io/instance: oracle-env1
    app.kubernetes.io/name: oracle
    app.kubernetes.io/part-of: maximo
  name: oracle-env1
  namespace: {{NAMESPACE}}
spec:
  ports:
  - name: 1521-tcp
    port: 1521
    protocol: TCP
    targetPort: 1521
  selector:
    app: oracle-env1
    deploymentconfig: oracle
  type: ClusterIP​


#AssetandFacilitiesManagement
#Maximo

0 comments
50 views

Permalink