Initial commit
This commit is contained in:
commit
880e39de2e
511 files changed
+38363
No files matched your search
@@ -0,0 +1,159 @@
|
||||
#! /bin/bash
|
||||
|
||||
#Variables
|
||||
clean=false
|
||||
flywayClean=false
|
||||
flywayMigrate=false
|
||||
flywayRepair=false
|
||||
skip=false
|
||||
deploy=false
|
||||
cleanTomcat=false
|
||||
docs=false
|
||||
warDeploy=false
|
||||
currentDir=`pwd`
|
||||
branchName=""
|
||||
PROG="`basename $0`"
|
||||
|
||||
#Functions
|
||||
function cleanup(){
|
||||
echo "exiting"
|
||||
exit
|
||||
}
|
||||
|
||||
function errorexit(){
|
||||
true
|
||||
echo "errorexit"
|
||||
}
|
||||
|
||||
function clean_tomcat_dir(){
|
||||
echo "Cleaning tomcat directory"
|
||||
rm -rf $CATALINA_HOME/logs/*
|
||||
rm -rf $CATALINA_HOME/temp/*
|
||||
rm -rf $CATALINA_HOME/work/*
|
||||
}
|
||||
|
||||
function usage(){
|
||||
local error="$*"
|
||||
if [[ $error ]]; then
|
||||
echo ""
|
||||
echo "Error: ${error}"
|
||||
echo ""
|
||||
fi
|
||||
echo "Usage: $PROG [OPTION...]"
|
||||
echo ""
|
||||
echo "Options"
|
||||
echo " -h, --help show this usage text"
|
||||
echo " -j, --docs build the javadocs"
|
||||
echo " -b, --branch branch name to checkout and build"
|
||||
echo " -c, --clean performs mvn clean and cleans tomcat directory"
|
||||
echo " -f, --flyway-clean performs mvn flyway:clean (clears out database)"
|
||||
echo " -m, --flyway-migrate performs mvn flyway:migrate (runs one or more servers to update"
|
||||
echo " -r, --flyway-repair performs mvn flyway:repair (fixes checksums)"
|
||||
echo " -s, --skip skips jslint test on javascript"
|
||||
echo " -d, --deploy deploys app to tomcat directory"
|
||||
echo " -w, --war performs tomcat7:redeploy to deploy the war without having to "
|
||||
echo " clean/remove existing "
|
||||
echo " -t, --clean-tomcat cleans tomcats work, temp, and log directories"
|
||||
|
||||
if [ "`uname`" == "Darwin" ]; then
|
||||
echo "Mac users: use short options only!"
|
||||
fi
|
||||
|
||||
if [[ $error ]]; then
|
||||
exit 1
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
#main
|
||||
short_opts='cb:fmrsdhtjw'
|
||||
long_opts='help,clean,flyway-clean,flyway-migrate,flyway-repair,noskip,nodeploy,clean-tomcat,branch:,docs,war'
|
||||
|
||||
# note: for mac use short opts without the -o option
|
||||
if [ "`uname`" == "Darwin" ]; then
|
||||
#TEMP=`getopt ${short_opts} ${PROG} -- "$@"`
|
||||
TEMP=`getopt ${short_opts} $*`
|
||||
else
|
||||
TEMP=`getopt -o ${short_opts} --long ${long_opts} -n ${PROG} -- "$@"`
|
||||
fi
|
||||
|
||||
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
|
||||
|
||||
# Note the quotes around `$TEMP': they are essential!
|
||||
eval set -- "$TEMP"
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-c|--clean) clean=true ; shift ;;
|
||||
-j|--docs) docs=true ; shift ;;
|
||||
-b|--branch) branchName=$2 ; shift 2 ;;
|
||||
-f|--flyway-clean) flywayClean=true ; shift ;;
|
||||
-m|--flyway-migrate) flywayMigrate=true ; shift ;;
|
||||
-r|--flyway-repair) flywayRepair ; shift ;;
|
||||
-s|--skip) skip=true ; shift ;;
|
||||
-d|--deploy) deploy=true ; shift ;;
|
||||
-t|--clean-tomcat) cleanTomcat=true ; shift ;;
|
||||
-w|--war) warDeploy=true ; shift ;;
|
||||
-h|--help) usage; shift;;
|
||||
--) shift ; break ;;
|
||||
*) echo "Internal error!" ; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
cd $PORTAL_HOME
|
||||
|
||||
if [ -n "$branchName" ]; then
|
||||
git checkout -f $branchName
|
||||
git pull origin $branchName
|
||||
fi
|
||||
|
||||
if [ $clean = true ]; then
|
||||
echo "Performing mvn clean..."
|
||||
mvn clean
|
||||
fi
|
||||
|
||||
if [ $flywayClean = true ]; then
|
||||
echo "Performing flyway clean"
|
||||
mvn flyway:clean
|
||||
fi
|
||||
|
||||
if [ $flywayMigrate = true ]; then
|
||||
echo "Performing flyway migrate"
|
||||
mvn flyway:migrate
|
||||
fi
|
||||
|
||||
if [ $flywayRepair = true ]; then
|
||||
echo "Performing flyway repair"
|
||||
mvn flyway:repair
|
||||
fi
|
||||
|
||||
if [ $docs = true ]; then
|
||||
echo "Building documents"
|
||||
cd $PORTAL_HOME/scripts
|
||||
./build-docs.sh
|
||||
fi
|
||||
|
||||
if [ $deploy = true ]; then
|
||||
echo "Undeploying server"
|
||||
cd $PORTAL_HOME/scripts
|
||||
./undeploy-server.sh
|
||||
if [ $cleanTomcat = true ]; then
|
||||
clean_tomcat_dir
|
||||
fi
|
||||
fi
|
||||
|
||||
cd $PORTAL_HOME
|
||||
|
||||
mvn -DskipTests=$skip install
|
||||
|
||||
if [ $warDeploy = true ]; then
|
||||
mvn tomcat7:redeploy
|
||||
fi
|
||||
|
||||
if [ $deploy = true ]; then
|
||||
echo "Deploying webapp to server"
|
||||
cd $PORTAL_HOME/scripts
|
||||
./deploy-server.sh
|
||||
fi
|
||||
|
||||
cd $currentDir
|
||||
@@ -0,0 +1,45 @@
|
||||
# !/bin/bash
|
||||
|
||||
. portal-env.sh
|
||||
|
||||
cd $PORTAL_HOME
|
||||
|
||||
declare -a arr=("portal_client" "portal_common" "portal_database" "portal_migration" "portal_webapp")
|
||||
|
||||
echo Deleting old content
|
||||
echo Deleting old web content
|
||||
rm -rf web
|
||||
|
||||
echo Deleting old site content
|
||||
rm -rf target/site
|
||||
|
||||
for i in "${arr[@]}"
|
||||
do
|
||||
echo Deleting $i old site content
|
||||
rm -rf $i/target/site
|
||||
done
|
||||
|
||||
if [ ! -d "web" ]; then
|
||||
mkdir web
|
||||
fi
|
||||
|
||||
for i in "${arr[@]}"
|
||||
do
|
||||
if [ ! -d web/$i ]; then
|
||||
echo "Creating directory web/$i"
|
||||
mkdir web/$i
|
||||
fi
|
||||
done
|
||||
|
||||
echo Creating javadocs
|
||||
mvn site
|
||||
|
||||
echo Moving documents to web
|
||||
mv target/site/* web/.
|
||||
|
||||
for i in "${arr[@]}"
|
||||
do
|
||||
echo Moving $i to web/$i
|
||||
mv $i/target/site/* web/$i/.
|
||||
done
|
||||
echo Done
|
||||
@@ -0,0 +1,7 @@
|
||||
#! /bin/bash
|
||||
|
||||
. portal-env.sh
|
||||
. portal-catalina.sh env
|
||||
cd ${PORTAL_HOME}
|
||||
set -x
|
||||
cp "portal_webapp/target/patchrepo.war" "${CATALINA_HOME}/webapps/"
|
||||
@@ -0,0 +1,53 @@
|
||||
#! /bin/bash
|
||||
|
||||
|
||||
. portal-env.sh
|
||||
|
||||
|
||||
#define tomcat variables
|
||||
export CATALINA_BASE="${CATALINA_BASE:-$CATALINA_HOME}"
|
||||
export JPDA_ADDRESS="${JPDA_ADDRESS:-8001}"
|
||||
export JPDA_TRANSPORT="${JPDA_TRANSPORT:-dt_socket}"
|
||||
#export CATALINA_OPTS='-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n'
|
||||
|
||||
|
||||
get_most_recent() {
|
||||
|
||||
most_recent_file="`perl -le '@sorted = map {$_->[0]}
|
||||
sort {$a->[1] <=> $b->[1]}
|
||||
map {[$_, -M $_]}
|
||||
@ARGV;
|
||||
print $sorted[0]' $1`"
|
||||
|
||||
}
|
||||
|
||||
cd "${CATALINA_HOME}"
|
||||
|
||||
# start tail of catalina.out in new window
|
||||
# shift and $* allows any additional options to be applied to the tail command
|
||||
# such as -l 1000 to open with the previous 1000 lines
|
||||
if [ "$1" == "tail" ]; then
|
||||
shift 1
|
||||
cd logs
|
||||
get_most_recent 'localhost*.log'
|
||||
localhost_log="${most_recent_file}"
|
||||
get_most_recent 'localhost_access_log*.txt'
|
||||
localhost_access_log="${most_recent_file}"
|
||||
catalina_out="catalina.out"
|
||||
$terminal tail -f "${catalina_out}" "${localhost_log}" "${localhost_access_log}" $* &
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
#use terminal for the run command
|
||||
case "$*" in
|
||||
env)
|
||||
;;
|
||||
*run)
|
||||
$terminal "${CATALINA_HOME}/bin/catalina.sh" $* &
|
||||
;;
|
||||
|
||||
*)
|
||||
"${CATALINA_HOME}/bin/catalina.sh" $*
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
wait_count=0;
|
||||
est_count=0;
|
||||
|
||||
while [ 1 ]
|
||||
do
|
||||
new=`netstat -an |grep 3306 |grep TIME_WAIT |wc -l`
|
||||
new2=`netstat -an |grep 3306 |grep ESTABLISHED |wc -l`
|
||||
if [ $wait_count != $new ]; then
|
||||
echo Number of connections waiting = $new
|
||||
wait_count=$new
|
||||
fi
|
||||
if [ $est_count != $new2 ]; then
|
||||
echo Number of connections established = $new2
|
||||
est_count=$new2
|
||||
fi
|
||||
sleep 1
|
||||
|
||||
done
|
||||
@@ -0,0 +1,21 @@
|
||||
#! /bin/bash
|
||||
|
||||
if [ ! -f "envar.sh" ]; then
|
||||
echo "envar.sh file not found"
|
||||
echo "Create envar.sh and export PORTAL_HOME, CATALINA_HOME"
|
||||
echo "PORTAL_HOME points to the patch repository source location"
|
||||
echo "CATALINA_HOME points to the local tomcat location"
|
||||
exit
|
||||
fi
|
||||
|
||||
. envar.sh env
|
||||
|
||||
# choose os-dependent terminal
|
||||
case "`uname`" in
|
||||
CYGWIN*)
|
||||
terminal="mintty --window normal --size 200,60 --hold error --exec"
|
||||
;;
|
||||
*)
|
||||
terminal="xterm -geometry 200x30 -e "
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,15 @@
|
||||
#! /bin/bash
|
||||
|
||||
. portal-env.sh
|
||||
cd "${PORTAL_HOME}/portal_client"
|
||||
|
||||
#use terminal for the serve command
|
||||
case $1 in
|
||||
serve|onlyServe)
|
||||
$terminal grunt $* &
|
||||
;;
|
||||
|
||||
*)
|
||||
grunt $* &
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,7 @@
|
||||
#! /bin/bash
|
||||
|
||||
. portal-catalina.sh env
|
||||
|
||||
set -x
|
||||
rm "${CATALINA_HOME}/webapps/portal.war"
|
||||
rm -rf "${CATALINA_HOME}/webapps/portal"
|
||||
Reference in new issue
Block a user