Monday, March 11, 2019

How To Migrate ORDS To Welogic Cluster In K8S

Requirement

We have quite a few APEX applications which are running on ORDS in weblogic domain. Now with oracle weblogic kubernetes operator please refer  github link. We can deploy a weblogic cluster in OKE. Please refer How To Create Weblogic Cluster Service via Weblogic Operator In K8S
So we would like to migrate our ORDS and APEX workload to weblogic cluster in OKE to leverage the advantages of kubernetes. 

Solution:

Most of hard work how to create weblogic domain has been done via How To Create Weblogic Cluster Service via Weblogic Operator In K8S
As ORDS needs some extra config,lib, static files other than just ords.war , it is not as simple as to deploy a war into the domain  like testwebapp .
The Key thing here is to build a docker image with ORDS in it 
  • Download ORDS file from OTN
  • unzip it to ords/  under  the weblogic domain creation build directory . The directory is a bit long as we git clone the weblogic kubernetes operator . All scripts are under it. 
  •  ie  /home/k8suser/yaml/weblogic-kubernetes-operator/kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/docker-images/OracleWebLogic/samples/12213-domain-home-in-image
  • Update Dockerfile to add an  entry  to copy  ord/  we just unzip to docker image  "COPY ./ords/  /u01/app/oracle/product/ords/17.4.1.353.06.48/livesql"
    • /u01/app/oracle/product/ords/17.4.1.353.06.48/livesql   is the dir that weblogic cluster will deploy the war file to .  Each version of war would be a bit different , as the war has dependency on config files outside war file,  it makes deployment difficult . We have to maintain the same directory in the docker images to let ords find correct config files 
    • It is the same with APEX static image files , the images files are put  ./ords/i , so all images files are copied into docker image
  • Update myinputs.yaml file to add extra java options for ORDS. Details below
    • javaOptions: -Dweblogic.StdoutDebugEnabled=false -Dcom.sun.xml.ws.spi.db.BindingContextFactory=com.sun.xml.ws.db.glassfish.JAXBRIContextFactory -Djavax.xml.bind.JAXBContext=com.sun.xml.bind.v2.ContextFactory -Djava.awt.headless=true -Doracle.jdbc.fanEnabled=false
    • For PROD ,we may add big memory for jvm  like
      • javaOptions: -Xms3g -Xmx3g -verbose:memory,gcreport,gc -Doracle.jdbc.implicitStatementCacheSize=100 -Dweblogic.StdoutDebugEnabled=false -Dcom.sun.xml.ws.spi.db.BindingContextFactory=com.sun.xml.ws.db.glassfish.JAXBRIContextFactory -Djavax.xml.bind.JAXBContext=com.sun.xml.bind.v2.ContextFactory -Djava.awt.headless=true -Doracle.jdbc.fanEnabled=false  
  • To create a new image based on the new Dockerfile  "./create-domain.sh -i myinputs.yaml -o .  -u weblogic -p  ****"
  • Start domain using the new images refer details on  How To Create Weblogic Cluster Service via Weblogic Operator In K8S
  • Deploy ords.war  i.war and livesql.war 3 war files in /u01/app/oracle/product/ords/17.4.1.353.06.48/livesql from console . Refer ORDS Installation and Setup
    • ords.war is for ords service  
    • i.war is for /i  static image files    (  java -jar ords.war static --context-path /i   /u01/app/oracle/product/ords/17.4.1.353.06.48/livesql/i    ) 
    • livesql.war is for /livesql static image files   (   java -jar ords.war static --context-path /livesql  /u01/app/oracle/product/ords/17.4.1.353.06.48/livesql/i/livesql   )
  • Test url  http://<domain name>/apex/

Issues

  • 404 error  "The request could not be mapped to any database. Check the request URL is correct, and that URL to database mappings have been correctly configured"
    • weblogic cluster will use its own deployment path " /u01/app/oracle/product/ords/17.4.1.353.06.48/livesql  " not the one we set on the console
      • We need to copy the ords files in the same path in docker image

No comments: