This Script has ultimate goal to automate to one-step process for deploying the code onto WebLogic Development environments. Usually the development environments are going to have multiple time deployments than other environments. Some of the WebLogic environments creates the persistances objects stores into the servers logs path. To avoid previous object references we need to clean up the cache directory that holds this persistance objects. We have developed a python module for clearCache that will do this task automatically.
There could be dependency on application archive files order. Some of the deployments does not requires the shared libraries deployments. Changes in the web application requires Only web app re-deployment. Changes in the enterprise application needs only EAR file deployments. Considering all these dependencies the script is developed in modular structure.
The following shell script is developed for the environment which I have used to. The domain path you can specify in the DHOME.
Now let me give you what I did in my experiment with deployment script, assume that 'a_ejb.jar','a_adapter.jar','b_adapter.jar','c.war' are the deployable archive file components. You may have different components may be target to different WebLogic server instances or clusters it is your choice of targetting.
Well this might be very lengthy you might feel too much!! but bear with me! this is my first time trial which I made ...
On our WebLogic, there are many logics works hahaaaaaaaaaaaaaaaa!! here I am using Python core library modules such as 'os', 'time' etc.
http://ghattus.com/2007/01/01/wlst-startserver-re-visited/
Following comments archived from "WLSTBYPANI" post:
prasanth vasireddy said...
what are the argument to pass through this script..what are the deploy.properties file?. References:
There could be dependency on application archive files order. Some of the deployments does not requires the shared libraries deployments. Changes in the web application requires Only web app re-deployment. Changes in the enterprise application needs only EAR file deployments. Considering all these dependencies the script is developed in modular structure.
The following shell script is developed for the environment which I have used to. The domain path you can specify in the DHOME.
#AppDeployment.sh [Optional] echo '***** WELCOME TO DEPLOYMENT SCRIPT *****' user=`echo $LOGNAME` echo 'APPLICATION DEPLOYMENT IS STARTING IN INSTANCE:' $user DHOME=/Home/domains/wd$LOGNAME/config WLHOST=`hostname` cd $DHOME WLPORT=`cat config.xml |grep listen-port|tr -s [:blank:] |tr " " "\n" |grep listen-port |cut -c14-17` URL='t3://'$WLHOST':'$WLPORT DENV=$HOME/domains/wd$LOGNAME/bin/setDomainEnv.sh . $DENV $* echo $CLASSPATH #calling the paniDeployment.py file java weblogic.WLST -loadProperties /Home/$user/.Admin/deploy.properties /Home/$user/.Admin/paniDeployment.py $user $URL$CLASSPATH
Now let me give you what I did in my experiment with deployment script, assume that 'a_ejb.jar','a_adapter.jar','b_adapter.jar','c.war' are the deployable archive file components. You may have different components may be target to different WebLogic server instances or clusters it is your choice of targetting.
Well this might be very lengthy you might feel too much!! but bear with me! this is my first time trial which I made ...
On our WebLogic, there are many logics works hahaaaaaaaaaaaaaaaa!! here I am using Python core library modules such as 'os', 'time' etc.
#====================================================================== # FileName: AppDeployment.py # Author : Sarangapani Matoori #====================================================================== import os import time import sys from java.util import Date from java.text import SimpleDateFormat t = Date() today=SimpleDateFormat("dd_MMM_HH:mm").format(Date()) user=sys.argv[1] URL=sys.argv[2] src="/home/"+user+"/CODE/" bksrc="/home/"+user+"/CODE_" dpath="/home/domains/wd"+user ECODE='\033[0m \n' G='\033[1;40;32m' R='\033[1;40;31m' deploylist=['a_ejb.jar','a_adapter.jar','b_adapter.jar','c.war'] def backup(): try: #Creating the Backup with Date And Time command = "cp -R "+src+" "+bksrc+today os.system(command) except: print R+' Code Backup FAILED!! '+ECODE print dumpStack() def getCode(): try: # GETTING THE Fresg Code from build location os.system('scp user@hostname:/home/user/Code_Ioc/*.*ar '+src) print G+' THE CODE COPIED SUCCESSFULLY '+ECODE except: print R+' THE CODE COPYING FAILED?!?!?'+ECODE print dumpStack() exit() def conn(): try: # CONNECTING TO THE SERVER .... connect(userConfigFile=UCF, userKeyFile=UKF, url=URL) except: print R+' CONNECTION FAILED....',+ECODE print dumpStack() exit() def editing(): edit() startEdit() def activating(): save() activate() def stoppingApp(): deploylist.reverse() for s in deploylist: try: editing() progress=stopApplication(s,timeout=360000) progress.printStatus() activating() except: print R+' FAILED TO STOP THE APPLICATION '+ECODE print dumpStack() print G+' APPLICATION STOPPED '+ECODE def pUndeploy(): deploylist.reverse() for s in deploylist: try: editing() progress=undeploy(s, timeout=360000) progress.printStatus() activating() except: print R+' FAILED TO UNDEPLOY THE APPLICATION '+ECODE print dumpStack() print G+' APPLICATION UNDEPLOYED '+ECODE # This module is optional def clearCache(): try: print G+' CLEARING THE CACHE '+ECODE command = "rm -rf "+dpath+"/servers/"+user+"/tmp/*.*" os.system(command) print G+' CLEARED THE CACHE '+ECODE except: print R+' FAILED TO CLEAR CACHE '+ECODE def pDeploy(): for s in deploylist: try: editing() progress=deploy(s,src+s,target=user,timeout=360000) progress.printStatus() activating() except: print R+'FAILED TO DEPLOY THE APPLICATION'+ECODE print dumpStack() print G+' APPLICATION DEPLOYED '+ECODE def startingApp(): for s in deploylist: try: editing() startApplication(s,timeout=360000) activating() except: print R+'FAILED TO START THE APPLICATION '+ECODE print G+'APPLICATION STARTED SUCCESSFULLY '+ECODE if __name__== "main": backup() getCode() conn() stoppingApp() pUndeploy() clearCache() pDeploy() startingApp() print G+' ....DEPLOYMENET DONE...'+ECODE ###### End of pani Deployment.py file ###########We have gone thru the Satya blog, Satya (the original author of WLST) already wrote os.system usage in the following link:
http://ghattus.com/2007/01/01/wlst-startserver-re-visited/
Following comments archived from "WLSTBYPANI" post:
prasanth vasireddy said...
what are the argument to pass through this script..what are the deploy.properties file?. References: