Build scripts

Jetspeed

There are several scripts there, but only one is currenlty used. It will update the source code from the svn, build the portal and deploy it to the server (Tomcat). To get a homogenous build, the local Maven repository is cleaned before the building process.

The script is found at /usr/local/src/kplab/deployjetspeed on both mielikki and 2d servers. On mielikki sever this script is executed as a cron script every night. On 2d, the script has to be run manually and as user tomcat. More scripts will follow..

deployjetspeed


#!/bin/bash # Script to stop tomcat, update build and deploy jetspeed, and start tomcat # It also sends email if jetspeed does not build successfully # Settings export JAVA_HOME="/opt/java" export CATALINA_HOME="/usr/local/tomcat" #Setup some extra java options #export JAVA_OPTS="-Xms32m -Xmx32m -XX:PermSize=32m -XX:MaxPermSize=32m" export M2_HOME="/opt/maven2" export MAVEN_HOME="/opt/maven" JETSPEEDLOGFILE="/tmp/jetspeedbuild.log" GRAFFITOLOGFILE="/tmp/graffitobuild.log" MAILTO="mikko.wuokko@evtek.fi,markuho@evtek.fi" TOMCAT_USER="tomcat" # This is the target SWKM server # Value can currently be either 'evtek' or 'forth' SWKMSERVER=forth # By default we wont restart the catalina # This will changed to true if the build succeeds RESTART_CATALINA=false # Another technique to shutdown with force (Used on machines with low memory) #CATALINA_PID=`ps aux | grep catalina | head -2 | head -1 | awk '{print $2}'` #kill $CATALINA_PID # Suggestions for a Super clean environment rm -rf ~/.m2/repository rm -rf ~/.maven/repository rm $JETSPEEDLOGFILE #rm -rf /tmp/j2 #rm -rf $CATLINA_HOME #tar xzf apache-tomcat-5.5.17.tar.gz #cp tomcat-users.xml $CATLINA_HOME/conf # Update, clean, build and deploy jetspeed cd /usr/local/src/kplab/kplabportal svn update --username reader --password reader #Clean project $M2_HOME/bin/mvn clean >> $JETSPEEDLOGFILE # Catching success count.. should be 1 ERRORSTATUS=$( grep "BUILD SUCCESSFUL" $JETSPEEDLOGFILE | wc -l ) # Prepare and build the project if no errors if [ $ERRORSTATUS -eq 1 ]; then $M2_HOME/bin/mvn -Dorg.kplab.swkm.server=${SWKMSERVER} >> $JETSPEEDLOGFILE fi # Success count should be 2 ERRORSTATUS=$(grep "BUILD SUCCESSFUL" $JETSPEEDLOGFILE | wc -l ) # Deploy project if no errors # Using nodb profile to keep the current database data if [ $ERRORSTATUS -eq 2 ]; then # Shutting down tomcat.. only if build will success $CATALINA_HOME/bin/shutdown.sh RESTART_CATALINA=true # Removing the kbservice and katool webapps so they will be correcly redeployed rm -Rf $CATALINA_HOME/webapps/katool* rm -Rf $CATALINA_HOME/webapps/kbservice* # Deploying $M2_HOME/bin/mvn -P tomcat,nodb -Dorg.kplab.swkm.server=${SWKMSERVER} >> $JETSPEEDLOGFILE fi # Start tomcat if shutdown if [ $RESTART_CATALINA ]; then # Kill any existing tomcat processes to be sure # no Tomcat is running # Kill processes for i in `ps -aeo ruser,pid,comm | grep ${TOMCAT_USER} | grep java | awk '{print $2}'` do echo "Killing $i" >> $JETSPEEDLOGFILE kill -s 9 $i done echo RESTARTING TOMCAT >> $JETSPEEDLOGFILE $CATALINA_HOME/bin/startup.sh fi # Success count should be 3 ERRORSTATUS=$(grep "BUILD SUCCESSFUL" $JETSPEEDLOGFILE | wc -l ) if [ $ERRORSTATUS -eq 3 ]; then # On error sen FAIL email mail -s "Jetspeed 2 BUILD SUCCESSFUL" $MAILTO < $JETSPEEDLOGFILE else # if no errors send SUCCESFULL email mail -s "Jetspeed BUILD FAILED" $MAILTO < $JETSPEEDLOGFILE fi


Development Development tools

  Page Info My Prefs Log in
This page (revision-12) last changed on 18:24 25-Mar-2017 by Patrick Ausderau.
 

Referenced by
2 D
Mielikki

JSPWiki v2.4.102
[RSS]