Pre-requisites set-up for Multitenancy:You can also visit the following post so that you can have connectivity what we are discussing here.
- Configure Security Realm for MT
- Create Users & Groups for Partition domain
- Configure Virtual Target
- Creating Partition Domain
- Configure IDD for Partition
- Partition Control (start/stop using WLST)
- Deploy and Undeploy Application on Partition [This post]
Download sample applicationYou can download sample web application for WebLogic environment :
Here I am using benefits.war which available in Oracle examples.
Download Shopping Cart Sample Link
Deploying an application to a WebLogic server fine it was upto 11g and regular WebLogic environment. In WebLogic 12.2.1 MT introduced with the great feature that is maintaining small domain partitions where you can feel the required resources all that need to run the application you will get in the partition. This MT deployment might more frequent when your application moved to WebLogic 12.2.1.
The deploy() and undeploy() command variation with the number of arguments you pass that are related to partition or resource group template. Here I've used first option targeting to a RUNNING State partition. As Oracle recommends to use ResourceGroupTemplate as target in the MT environment.
|WebLogic web application deployment with WLST to a partition|
The best benefit you can provide it to the partition deployment do one time deployment same partition you can package using export you will get final outcome as zip file. That you can reuse in other test environments as well.using import.
def deploy2partition(a,ap, p,rg,o): progress=deploy(appName=a, path=ap, partition=p, resourceGroup=rg, deploymentOrder=o, securityModel='DDOnly') while not (progress.isCompleted() or progress.isFailed()) : os.time.sleep(2) print progress.getState() def undeploy4mPartition(a, p): progress=undeploy(appName=a, partition=p) while not (progress.isCompleted() or progress.isFailed()) : java.lang.Thread.sleep(2000) print progress.getState() def main(): # The following are the properties which can be changed according to your needs. APP_PATH='/u01/app/software/benefits.war' APPNAME='BENEFITS' USER='weblogic' PASSWD='welcome1' ADMURL='t3://192.168.33.100:6100' connect(USER, PASSWD, ADMURL) partitionName="Corporate_partition" rgName="Corporate_rg" DOrder=10 if len(sys.argv) >1: choice = sys.argv else: usage() if choice == 'deploy': deploy2partition(APPNAME, APP_PATH, partitionName, rgName, DOrder) elif choice == 'undeploy': undeploy4mPartition(APPNAME, partitionName) disconnect() print "Deployment process on partition completed successful !!!" def usage(): print """Usage: wlst """+sys.argv +""" deploy | undeploy""" exit() main()
The deploy option:
wlst partitionDeploy1.py deploy
|WLST deploy on Partition Domain|
wlst partitionDeploy1.py undeploy
|WLST Undeploy on Partion|