Home > HowTo, python > Deploy Weblogic bash script

Deploy Weblogic bash script

November 8th, 2017 Leave a comment Go to comments

This are linux BASH scripts to performs a weblogic deploy using Weblogic WLST API.
I wrote two versions.
They both expect the package a .zip file with all the ear files in it. I couple it with Jenkins to do remote deploys.

The key commands that took me time to learn where to invoke the WLST passing the authentication and command.

To deploy a simple ear I did:

${JAVA_BIN} -cp ${WL_JAR} weblogic.Deployer -adminurl t3://${HOST_NAME}:${HOST_PORT} -user ${HOST_USER} -password ${HOST_PASS} -targets ${SERVER} -deploy -upload ${TMP_DIR}${DEPLOYEAR} -name ${APPNAME}

But on the second script I had to do a stop(kill) of the server, cleanup the tmp and cache folder then start the server. Here I needed to use the NodeManager command.
So here we have to connect to WLST and then to NM(nodemanager) kind of complicated really! But then I had to do it using a python script.

This is the dynamic creation of the python script to Start or Stop the Server.

/bin/cat >${TMP_DIR}${ACT}_${SERVER}.py<Script Deploy 1 (weblogic deploy API)
Jenkins – chiamare via ssh il script di deploy con i parametri
parametri ? (server,appname,package )

    unzipDeployFile
    backup
    source $WLENV
    agentDeployer $FILESDEP (one.ear file at a time)
    waitdep
    checklog $WL_LOG
    checklog $WL_LOGOUT
    checkapp

2-B) Script Deploy 2 (manual: stop, cleanup, copyear, start)
Functions:

    unzipDeployFile
    createScript start
    createScript stop
    backup
    cleanup
    source $WLENV
    stopApp
    copyear
    startApp
    waitdep
    checklog $WL_LOG
    checklog $WL_LOGOUT
    checkapp

Here is the code for script 1 :

  1. No comments yet.

VAMOVE *

*