BUILD
and
DEPLOYMENT
Framework
Author : Sandeep Singh
1. BPEL Deployment
The BPEL deployment is done using the build scripts generated when a JDeveloper BPEL project is created. We use the ANT tool to deploy.
1.1 Requirements
The BPEL project has Partner Links that point to end point URLs that exist on different servers. These links are different for DEV, TEST or any other environments. Once again, at design time a DEV URL may be specified but when we are moving code from one environment to another, these URLs need to be changed at deployment time.
All partner link URLs are stored in the bpel.xml (in the project’s root directory) and as follows, these partner links point to the DEV server at design time.
When moving to a different environment, we need to change these partner links to point to the Test / UAT environment. This needs to be done at Deploy time.
We have created Customize Ant task to achieve the above. The customize task can replace the URL at deploy time.
1.2 BPEL Build Scripts Library
The BPEL build scripts are auto-generated by Jdev. We need to use the build.properties file and point the properties to our suitable environment. A sample build.properties files is provided in the Template build files section:
The build.xml file is also generated by Jdev and should be used. Whenever a Jdev BPEL project is created, a corresponding build.xml and build.properties is also created. By default, the build.properties has all properties commented out.
To enable deployment outside of Jdeveloper, we use ANT 1.7.1. Download the 1.7.1 Version on your system.
Following Environment Variables need to be set before starting with the Deployment
1. ORACLE_HOME -> Point to Jdeveloper 10.1.3.4 Directory—add for linux
2. BPEL_HOME -> Point to Jdeveloper 10.3.4/integration/bpel
3. ANT_HOME -> Point to ANT 1.7.1 Directory
4. Append the following to your PATH env. variable -> %ANT_HOME%/bin
Note : Copy all library files from BPEL/lib to ANT_HOME/lib. The BPEL directory is present on the SOA Server Home.
1.3 The BPEL Build Life Cycle
To deploy a BPEL process, do the following steps:
· Open your project build.xml (see the template build.xml) for edit. If you open up your BPEL project you will find that in Folder called Resources. If you are looking in the actual physical folder then you will find this in ${process.dir} (the bpel ant terminology). Basically the top project folder where you find your jpr file.
· Add the following lines in the end of build.xml file just before the </project> tag :
<target name="GenerateMyPlanFromSuitcaseFile" depends="compile, deleteExtractDeploymentPlan">
<generateplan planfile="${process.dir}/${deploymentPlanFilename}"
verbose="true" overwrite="true" suitecase="${process.dir}/output/bpel_${BPELSuitcase.BPELProcess(id)}_${rev}.jar"/>
</target>
<target name="AttachMyPlan">
<echo>
--------------------------------------------------------------
| Attaching the plan file
------------------------------------------------
</echo>
<attachplan planfile="${process.dir}/${deploymentPlanFilename}"
verbose="true" overwrite="true" suitecase="${process.dir}/output/bpel_${BPELSuitcase.BPELProcess(id)}_${rev}.jar"/>
</target>
<target name="deleteExtractDeploymentPlan">
<delete file="${process.dir}\${deploymentPlanFilename}"/>
</target>
<target name="ModGenDeploymentPlan" depends="GenerateMyPlanFromSuitcaseFile">
<echo>
--------------------------------------------------------------
| Replacing tokens for Hostname and Port
------------------------------------------------
</echo>
<replaceregexp file="${deploymentPlanFilename}"
match='${token1}|${token2}|${token3}|${token4}'
replace="${http.hostname}:${http.port}" flags="gi"
byline="true"/>
<replaceregexp file="${deploymentPlanFilename}" match='${strSeacrh1}'
replace="${strReplace1}" flags="gi" byline="false"/>
<replaceregexp file="${deploymentPlanFilename}" match='${strSeacrh2}'
replace="${strReplace2}" flags="gi" byline="false"/>
<replaceregexp file="${deploymentPlanFilename}"
match="${http.hostname}:${http.hostname}:${http.port}"
replace="${http.hostname}:${http.port}" flags="gi"
byline="true"/>
<replaceregexp file="${deploymentPlanFilename}"
match="${http.hostname}:${http.port}:${http.port}"
replace="${http.hostname}:${http.port}" flags="gi"
byline="true"/>
· Moving forward in the depends part of <target name="process-deploy"
Add the target AttachMyPlan after complie. So the new target will looks like
<target name="process-deploy" depends="validateTask, compile, AttachMyPlan, deployProcess, deployTaskForm, deployDecisionServices"/>
1.4 How to Write Build Script
Prerequisites:
You must have
· ANT 1.7.1 installed.
· All Env. Variables set specified in section 1.2
The following section explains the procedure needed to write a build script for a new project.
Copy Build File (First Time Only)
Replace the Build.xml template files into your project root folder. The template files are described in the section “Template Build Files”
OR
Make the modifications in the file as described.
2. Master Ant Script
As is evident from the steps to deploy the BPEL components, you have to execute the deployment commands from each project’s directory. During mass code migration, where we could be deploying several interfaces and each interface could have several BPEL components, this is a painstaking process. Also, when migration requires to perform in cluster node, it requires a special approach to carry out so BPEL component deployment happen properly.
Currently all projects have their individual ANT scripts. The master Ant script located at (Deployment/MasterAntScript/build.xml), contains reference to each build.xml file and executes them in the order required for the project.
2.1 Understanding Master Ant Script
Master ANT script contains reference to each Interface and project. Here Interface consists of multiple BPEL projects.
1. build.properties:
It contains entry for each interface. True/False flag represents if that Interface need to be deployed or not. For detailed info read section 2.3
For example:
TestDeploymentApplication=true
Copy paste the following text and save the file as build.properties
http://docs.google.com/Doc?docid=0ASr47_fC2kwkZGtnNXN4cl82MWQ2NjVzYmZn&hl=en
2. build.xml :
Copy paste the following text and save the file as build.xml for Master Ant(to be changed accordingly) :
http://docs.google.com/Doc?docid=0ASr47_fC2kwkZGtnNXN4cl82MGYzbWc3d3pz&hl=en
In header section on build.xml conditions are evaluated for true and false for each interface. These conditions are used in Interface specific targets.
For example:
<condition property="TestDeploymentProjectExecute" value="true">
<equals arg1="${TestDeploymentProject}" arg2="true"
casesensitive="true" trim="yes"/>
</condition>
3. Individual Interface
Individual interface are added in Master ant script as Ant Target. For example:
<target name="CommonErrorHandlingApplication" if="CommonErrorHandlingApplicationExecute">
<echo>
----------------------------------------------------
|-----Deploying CommonErrorHandlingApplication-----|
----------------------------------------------------
</echo>
<var name="proDir" value="${code.path}\Common\ELF\SAN_CMN_LOG_ERROR_INITIATE"/>
<echo>"Directory ${proDir}"</echo>
<antcall target="ModGenDeploymentPlans">
<param name="proDir" value="${proDir}"/>
</antcall>
<antcall target="DeployProcess">
<param name="proDir" value="${proDir}"/>
<param name="domain" value="${commonDomain}"/>
</antcall>
<var name="proDir" value="${code.path}\Common\ELF\SAN_CMN_LOG_ERROR_PROCESS"/>
<echo>"Directory ${proDir}"</echo>
<antcall target="ModGenDeploymentPlans">
<param name="proDir" value="${proDir}"/>
</antcall>
<antcall target="DeployProcess">
<param name="proDir" value="${proDir}"/>
<param name="domain" value="${commonDomain}"/>
</antcall>
</target>
2.2 Adding Interface/Project in Master Ant Script
To add Interface in Master Ant script:
The following entries have to be made in the build.xml of the Master ANT
1. Add a condition property for your Project. The value of ${application} will come from build.properties
<condition property="IVRApplicationExecute" value="true">
<equals arg1="${IVRApplication}" arg2="true" casesensitive="true" trim="yes"/>
</condition>
2. Add the individual Project/Application target. For eg.
<target name="IVRApplication" if="IVRApplicationExecute">
<echo>
----------------------------------------------------
|-----Deploying IVRApplication-----|
----------------------------------------------------
</echo>
<var name="proDir" value="${code.path}\C2R\SAN_EBS_IVR_Inbound"/>
<echo>"Directory ${proDir}"</echo>
<antcall target="ModGenDeploymentPlans">
<param name="proDir" value="${proDir}"/>
</antcall>
<antcall target="DeployProcess">
<param name="proDir" value="${proDir}"/>
<param name="domain" value="${c2rDomain}"/>
</antcall>
<var name="proDir" value="${code.path}\C2R\SAN_ABCS_IVR_Inbound"/>
<echo>"Directory ${proDir}"</echo>
<antcall target="ModGenDeploymentPlans">
<param name="proDir" value="${proDir}"/>
</antcall>
<antcall target="DeployProcess">
<param name="proDir" value="${proDir}"/>
<param name="domain" value="${c2rDomain}"/>
</antcall>
</target>
The above code has two BPEL processes (ABCS and EBS) to be deployed. You might have ‘n’ no. of BPEL’s in your application. Make sure to keep the most dependent one on the top of the list. For eg. in the above example SAN_ABCS_IVR_Inbound is invoking SAN_EBS_IVR_Inbound, therefore SAN_EBS_IVR_Inbound is to be deployed prior. You should make a list of such dependencies in an application.
Change the above entries in bold. The values would be different for every project. Replace the <param name=”domain” value=${<domain>}/> with domain value. Supported list of values is available in build.properties file of Master Ant script.
1. Add a new antcall in the <target name=”DeployAll”> section that points to name of the target created in the previous step.
Eg.
<target name="DeployAll">
……
<antcall target="IVRApplication"/>
2.3 Understanding build.properties of Master Ant File
# Project Directory for all codes
code.path=D:\\Projects\\POC\\
# Change below if deploying with process revision other than 1.0
rev = 1.0
# Change below if deploying in domain other than "default". Add more domains if required
commonDomain = common
clarityDomain = clarity
# Tokens for Host name and Port name to be replaced in the Deployment File
# Supports upto 4 tokens viz. token1, token2, token3, token4
# The value in the above token is replaced by ${http.hostname}:${http.port} provided below
# Eg. If token1 is set to soadev.sandeep-pc.net:7777, then all values in ${deploymentPlanFilename} will be reeplaced by ${http.hostname}:${http.port}
token1=soadev.sandeep-pc.net:7777
token2=soatest.sandeep-pc.net:80
token3=soatest.sandeep-pc.net
token4=localhost:9700
#Custom Search and Replace to change External URL's. This is helpful if you want to change endpoint URI's of third party WSDL in deployment plan. Provide a search criteria (regex) in custom.strSeach{index} and corresponding replacement string in custom.strReplace{index}
#strSeacrh1=searchReplace(.*?)/searchReplace
#strReplace1=searchReplace><search>http://www.w3.org</search><replace>http://www.w311.org</replace></searchReplace
strSeacrh1=^NULL^
strReplace1=^NULL^
strSeacrh2=^NULL^
strReplace2=^NULL^
# Make sure admin.user, admin.password is correct for appserver
admin.user = oc4jadmin
admin.password = oc4jadmin01
# http.hostname and http.port should point to BPEL Server's host and http port
http.hostname = SOADEV.sandeep-pc.net
http.port = 7777
# Deployment Plan Filename (Use values Like : DEV, TEST, PROD). This file would appear in your project Directory and would be used while deploying
deploymentPlanFilename=DEV.xml
#Generate Deployment Plans for Processes before Deploying
##Imp : Use this param wisely. Setting it to true would override the ${deploymentPlanFilename} file in the project directory with the latest Deployment plan. It results in a performance hit as the project is recompiled to extract the Deployment info from the jar files. To be used only when there has been a endpoint change in the BPEL Partner links OR when migrating to a new environment for the first time
plan.regen=true
##Set to true if you want to deploy your process. Set it to NO only if you want to regenrate your Deployment plan file without deploying the process, provided that the plan.regen property is set to true.
deploy.app=true
# Projects/Applications flag for the above two operations (plan.regen and deploy.app)
……
……
2.5 Deploying Interface to the SOA Environment
Start SOA Suite Server.
Open a command line prompt to the Master Ant Script root folder and use the following commands to deploy:
<Master Ant Script> ant DeployAll

This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDelete