forked from Canadensys/canadensys-explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy
executable file
·62 lines (54 loc) · 1.79 KB
/
deploy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# Check for parameters:
if test -n $1 ; then
case $1 in
"-d" ) if test -z $2 ; then
echo "ERROR! You must provide the parameter for the -d option!";
exit 1
else
TOMCAT_DIR=$2
fi
;;
"-j" ) if test -z $2 ; then
echo "ERROR! You must provide the parameter for the -j option!";
exit 1
else
export JAVA_HOME=$2;
echo "JAVA_HOME=$JAVA_HOME"
fi
;;
"--help" ) echo "deploy.sh Help menu.";
echo "This script will assist you in automatizing the building process for the dataporal code.";
echo "List of available commands:";
echo "-d TOMCAT_PATH // Sets Apache Tomcat directory for build.";
echo "-j JAVA_HOME // Sets prefered JAVA_HOME to system environment variable";
echo "--help // Display this help menu.";
exit 0
;;
esac
fi
# export Java JDK:
export JAVA_HOME="/opt/jdk1.7.0_79/"
#Tomcat base diretory:
TOMCAT_DIR="/opt/apache-tomcat-8.0.22"
#Package name:
PACKAGE_NAME="explorador.war"
echo "*** Stopping tomcat:"
sh $TOMCAT_DIR/bin/shutdown.sh
echo "*** Building application with gradle..."
gradle clean -x test buildProduction
echo "*** Tomcat directory set to: $TOMCAT_DIR"
echo "*** Cleaning old data from tomcat ***"
echo ""
rm -r $TOMCAT_DIR/work/Catalina/localhost/*
rm -r $TOMCAT_DIR/webapps/explorador/
rm $TOMCAT_DIR/webapps/$PACKAGE_NAME
echo ""
echo "*** Moving recently built" $PACKAGE_NAME "file to tomcat webapps directory ***"
mv ./build/libs/$PACKAGE_NAME $TOMCAT_DIR/webapps/$PACKAGE_NAME
echo "*** Starting tomcat:"
sh $TOMCAT_DIR/bin/startup.sh
echo "*** Done. Server must me up in a few seconds."
#Uncomment only if running redis for map points and tiler server locally
#echo "*** Flushing Redis."
#redis-cli FLUSHALL