Pages

Thursday, December 31, 2015

weblogic auto deployment script

Purpose : This script will copy the ear file from specific location and uninstall and install same ear file on the weblogic cluster . After the script will bounce the server .














## General Srcipt for Preprod App server , which have two Maneged servers 


## Config Variables

ADMINSERVERIP=10.192.168.1
ADMINSERVERPORT=7050

APPSERVER1IP=10.192.168.1
APPSERVER2IP=10.192.168.2

APPSERVER1PORT=8004
APPSERVER2PORT=9004

APPSERVER1NAME=appserver1
APPSERVER2NAME=appserver2

TARGET=mycluster

USERNAME=weblogic
PASSWORD=welcome1


APPLIB=/opt/app/bea/wls81sp6/user_projects/WLS1/applications
WLSDIR=/opt/app/bea/wls81sp6/user_projects/WLS1

SOURCE=/tmp
APPFILE=app.ear
APPILICATION=application

MAILLIST="yoyo.prod.support@company.com"
MAILSENDER="machineIP.host@@company.com"
MAILSUB="Deployment Status application  PREPROD  "


#### script starts from here

if ! id | grep oracle
then 
echo " please run as oracle " 
exit 90
fi

## /tmp/tt is the message file for the email content

mv /tmp/tt /tmp/tt.last
touch /tmp/tt


## sourcing evn file for jars required to run deployer utility


. $WLSDIR/bin/setDomainEnv.sh



if java weblogic.Admin -url $ADMINSERVERIP:$ADMINSERVERPORT  -username $USERNAME -password $PASSWORD GETSTATE | grep RUNNING
then
echo " Server is Running , Going for Deployment "
else
echo " Server is Not Running, Please  Start Manually "
exit 97
fi


cd $APPLIB
mv $APPFILE $APPFILE`date +%m%d%Y_%H%M `


cp  $SOURCE/$APPFILE .
chmod 755 $APPFILE

ls -ltr >> /tmp/tt

cksum $APPFILE >> /tmp/tt

if [ -f $APPFILE  ]
then
echo " file copied successfully "
else
echo " error in copying " >>/tmp/tt
echo " error in copying "
exit 96
fi


 

echo    >> /tmp/tt
echo " ^^^^^^^^^^^^^ Undeployment For  $APPFILE ^^^^^^^^^^ at  "` date +%H:%M:%S ` >> /tmp/tt
echo  >> /tmp/tt
if java weblogic.Deployer -url t3://$ADMINSERVERIP:$ADMINSERVERPORT  -username $USERNAME -password $PASSWORD -targets $TARGET -name $APPILICATION  -undeploy >> /tmp/tt
then
echo "File Undeployed Going for Deployment "
else
echo "Error in UnDeployment Exiting .... "
echo "Error in UnDeployment Exiting .... " >> /tmp/tt
mailx -s $MAILSUB $MAILLIST < /tmp/tt
exit 99
fi





echo >> /tmp/tt
echo "^^^^^^^^^^^^^ Deployment For $APPFILE ^^^^^^^^^^^^^ at  "` date +%H:%M:%S `  >> /tmp/tt
echo >> /tmp/tt
if  java weblogic.Deployer -url t3://$IP:$PORT  -username $USERNAME  -password $PASSWORD -targets EBPPCluster -name $TARGET  -deploy $APPLIB/$APPFILE1 >> /tmp/tt
then
echo "File deployed Going for Bouncing The Server "
echo "File deployed Going for Bouncing The Server ">> /tmp/tt
else
echo "Error in Deployment Exiting .... "
echo "Error in Deployment Exiting .... " >> /tmp/tt
mailx -s $MAILSUB $MAILLIST < /tmp/tt
exit 98
fi
echo >> /tmp/tt




echo " ^^^^^^^^^^^^ Killing  the server ^^^^^^^^^ at  "` date +%H:%M:%S ` >> /tmp/tt

echo >> /tmp/tt

java weblogic.Admin -url $APPSERVER1IP:$APPSERVER1PORT -username $USERNAME  -password $PASSWORD  FORCESHUTDOWN >> /tmp/tt 

java weblogic.Admin -url $APPSERVER2IP:$APPSERVER2PORT -username $USERNAME  -password $PASSWORD   FORCESHUTDOWN >> /tmp/tt 

java weblogic.Admin -url $ADMINSERVERIP:$ADMINSERVERPORT -username $USERNAME  -password $PASSWORD FORCESHUTDOWN >> /tmp/tt

echo >> /tmp/tt
sleep 5


# this is custom made script

cd $WLSDIR

./startAdmin1.sh

#./startWeblogic.sh &

count=0
while [ $count -le 120 ]

do
 if netstat -an | grep $PORT | grep LISTEN
  then
  echo " Server is UP "
  break
  else
  sleep 10
  count=`expr $count + 10`
 fi
done

if netstat -an | grep $PORT | grep LISTEN  >> /tmp/tt
 then
 echo " Server is UP after  $count sec " >>  /tmp/tt
 else
 echo " Server is not UP after $count sec Please check Manually " >> /tmp/tt
fi


## starting managed servers ,Node manager should be configured if not, start manually


java weblogic.Admin -url $ADMINSERVERIP:$ADMINSERVERPOR  -username $USERNAME  -password $PASSWORD START APPSERVER1NAME

sleep 60


java weblogic.Admin -url $ADMINSERVERIP:$ADMINSERVERPOR  -username $USERNAME  -password $PASSWORD START APPSERVER2NAME





mailx -r $MAILSENDER -s $MAILSUB $MAILLIST < /tmp/tt

Monday, December 21, 2015

How to overwrite a template in UCM page for customization ?






Purpose : How to overwrite a template in UCM page for customization .


Example : In this example we overwrite “Active Workflows” page . Which can 


be located at

Content Management → Active Workflows

IdcService : IdcService=GET_ACTIVE_WORKFLOWS

URL : http://IP:PORT/cs/idcplg?IdcService=GET_ACTIVE_WORKFLOWS




Detailed Steps :

1. Find out which template is used :


Template Class : Workflow
Template FilePath : Path of htm file used
Template Name : WORKFLOW_LIST
Template Type : WorkFlowListPage



2. Go to file system , which mention in Template FilePath .

3. Edit the workflow_list.htm
Add below line before <$include std_page_end$> :

Example
<br style="line-height:15px">

Added Manually in the file

<$include std_page_end$>

</body>
</html>



4. Re load the same page again in WCC . It should show the whatever added in the htm file




















This will make sure that , we are editing the correct template file . But this can't be done in proudction because every patch update will overwrite htm . So we have to create a custom component to overwrite htm file . That will save the htm file from “patching”

5. Going to create new custom component .

Start ComponentWizard from file system

6 . Add →

Name : OverWriteWorkFlowList











































7. Click Ok

8. Click on “Add” in Component page , Select “Template”

9.Next -->(Use default options)---> Next

10. On Add Intradoc Template page

Name : WORKFLOW_LIST
Select “Copy From” –> Browse → workflow_list.htm
Class : Workflow
Type : WorkFlowListPage

FileName: NewWorkFlowList.htm ( You can give any Name )
Description : Provide anything

Check Step1 for how to get those 4 details :



















































11. Finish , it will show message which provides the status

12. Go to Build → Build Settings

Wait for default values to load , then click ok

13. Go to Build – > Build

Wait for default values to load , then click ok

14. Go to Options → Enable


Since htm files are dynamic , we can edit “on the go” 









 









































Before restarting the WCC server , compare with above screen shot


15. Restart the WCC server


16. Go to File system ,where custom component are created .

Usually it will be : <domain>/ucm/cs/custom/OverWriteWorkFlowList

Go to templates/ Directory :

Same step can be done from ComponentWizard applet ,by click on Launch editor ( if you select the default editor )


17. Remove the lines added manually before (Step 4) and Add new Line

Like Added from CUSTOM component

18. Reload the page

19. It will show new date updated on Step 17

Key of Custom Component creation is

Any update in hda file , Restart is required
Any update in htm file , Restart is NOT required