Sunday, June 19, 2011

Oracle SOA composite Deployment and Migration using WLST script

Deployment

Step 1: Prepare execution location and codebase in the server where SOA is installed

We need to create a directory in the server location where SOA installed .From that directory we need to execute our deployment scripts.For example, I assume that directory as /app/deployment. Similarly for codebase we need to create another directory. I assume that directory as /app/codebase. We need to put our composite project source here (Not application file[.jws])

Step 2: Generate Configuration Plan:

Configuration plan is created based on composite.xml. This plan is used to modify server references in BPEL process.After developing SOA composites using JDeveloper , we need to generate configuration plan file by right clicking on the composite.xml file.

image

 

We can SFTP that Composite project folder including the configuration file to /app/codebase.

Step 3: Create Deployment Property file

We need to create a property file under /app/deployment directory. Sample Property file will look like below. Named the property file as deploy<BPEL Name>.properties.

  1. filenamewithpath=<SAR file location>
  2. oraclehome=<Oracle Home Location>
  3. apphome=<codebase location>
  4. processName=<Composite Name>
  5. configPlan=<Configuration plan location>
  6. description="BPEL process"
  7. serverurl=<admin server url>
  8. bpelversion=2.0

Note: we need to change the Property file name and its content for other BPEL process.

 

Step 4: Create Python Script

We need to create a python script file [/app/deployment/compileComposite.py] to compile BPEL source code and create SAR file. A sample python script is as below.

  1. import os
  2. if os.environ.has_key('wlsUserID'):
  3. wlsUserID = os.environ['wlsUserID']
  4. if os.environ.has_key('wlsPassword'):
  5. wlsPassword = os.environ['wlsPassword']
  6. sca_package(apphome,processName,bpelversion,oracleHome=oraclehome)
  7. exit()

to know more about sca_package () please find below link http://download.oracle.com/docs/cd/E12839_01/web.1111/e13813/custom_soa.htm

we need to create python script file [/app/deployment/soa_common_deployment.py] to deploy SAR files created from above python script after attaching configuration file created from above step.

A sample python script is as follows.

  1. import os
  2. if os.environ.has_key('wlsUserID'):
  3. wlsUserID = os.environ['wlsUserID']
  4. if os.environ.has_key('wlsPassword'):
  5. wlsPassword = os.environ['wlsPassword']
  6. connect( url='t3://cbicdg-pcp06:6001', adminServerName='soa_server1')
  7. print "server url[",serverurl,"] filename with path [",filenamewithpath,"] bpel version [",bpelversion,"] configPlan [",configPlan,"]"
  8. sca_attachPlan (filenamewithpath, configPlan,true,true)
  9. sca_deployComposite (serverurl,filenamewithpath,true)
  10. exit()

Note: Unlike property file we need not to change the python file for different BPEL processes.

To know more about sca_attachPlan(),sca_deployComposite() please visit below link http://download.oracle.com/docs/cd/E12839_01/web.1111/e13813/custom_soa.htm

Step 5 : Create Build [Shell] script

We need to create a shell script which will execute above python scripts recursively for all interfaces. Below shell script will ask for Interface name and based on given name it will load corresponding property file and execute python Scripts.

  1. while :
  2. do
  3. echo "Enter Process Name to be build and deploy[default none]: "
  4. read processName
  5. echo /app/deployment/deploy$processName.properties
  6. cp /app/oracle/product/wls1032/aia11g/aia_instances/aia11gdev/config/.adf/META-INF/adf-config.xml /app/codebase/$processName/SCA-INF/classes/META-INF
  7. export wlsttoolhome=(Location of wlst.sh script under SOA server installation normally it resides under wls1032/soa11g/common/bin)
  8. export wlsUserID=$1
  9. export wlsPassword=$2
  10. cd $wlsttoolhome
  11. pwd
  12. ./wlst.sh -loadProperties /app/deployment/deploy$processName.properties /app/deployment/compileComposite.py
  13. mv /app/codebase/$processName/deploy/sca\_$processName\_rev2.0.jar /app/codebase/$processName/deploy/sca_$processName.jar
  14. cp /app/codebase/$processName/deploy/sca_$processName.jar /app/deployment
  15. ./wlst.sh -loadProperties /app/deployment/deploy$processName.properties /app/deployment/soa_common_deployment.py
  16. done
  17. exit()

Note:

If your BPEL process refer MDS storage then we need to define that location in adf-config.xml file.So proper adf-config.xml will refer proper mds. So in above shell script we copy standard adf-config.xml which comes with AIA installation to our SOA project [Please refer Line 6]

 

Step 6 : Modify Configuration file:

We need to Modify generic auto generated configuration plan by including searchReplace components and use the targeted instance host name and port name in search and replace component like below.

image

Migration:

Here I assume migration happens from DEV to TEST so below places needs to changed from DEV references to TEST references.

1. In configuration file like above.

2. In property file the admin server references and Oracle home  needs to be changed based on TEST server references

3. In build script below lines needs to be modified based on Test server references.

image

Execute WLST utility

Execute the build script from /app/deployment and pass weblogic admin userid and weblogic admin password as argument. Before execution please give chmod 755 to that build.sh (refer step 5). Sample command for executing python script as follows

./build.sh <weblogic userid > <password>

if prompted please give the SOA composite name.

Note: “Deploying composite success” confirms the successful deployment.

3 comments:

  1. Migrating data is risky and complex if it is not planned well. Ilabs Technology Solutions has Microsoft certified engineers who has proved their capabilities and can assist in all stages of OS Migration process.

    ReplyDelete
  2. Hi,

    Great work !!

    can you also share WLST script for creating "configuration/customization file" and "building" SOA composite application (ie. BPEL process).

    Please contact me on abhisheknegi684@gmail.com

    ReplyDelete
  3. Harrah's Resort Southern California Casino & Hotel - Mapyro
    Free Parking near 광주 출장안마 Harrah's 구미 출장샵 Rincon 남양주 출장샵 Casino & Hotel, Funner. 김포 출장샵 Rental Options: $10, free cancellation 여수 출장샵 until 6 pm. Transportation. Nearby Restaurants.

    ReplyDelete