This repository has been archived by the owner on May 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-dev-dp-elonia.sh
75 lines (66 loc) · 2.16 KB
/
deploy-dev-dp-elonia.sh
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
63
64
65
66
67
68
69
70
71
72
73
74
75
#
# Copyright (C) 2018-2020 toop.eu
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#/bin/sh
TIMESTAMP=`date +%Y%m%d.%H%M%S`
BASEDIR=/opt/tomcat/webapps
FILENAME=toop-demo-ui-dp-*-SNAPSHOT.war
APP=$(pwd)/toop-demo-ui-dp/target/$FILENAME
BACKUPDIR=/toop-dir/backups
if ! [ -x "$(command -v mvn)" ]; then
echo 'Error: Maven is not installed.' >&2
exit 1
fi
if ! [ -x "$(command -v git)" ]; then
echo 'Error: Git is not installed.' >&2
exit 1
fi
if ! [ -x "$(command -v javac)" ]; then
echo 'Error: JDK is not installed.' >&2
exit 1
fi
echo Fetching latest changes
git pull
echo Making App
cd toop-demo-ui-dp
mvn clean package
cd ..
if [ -f ~/$FILENAME ]
then
echo stopping Tomcat
sudo service tomcat stop
echo Cleaning exisiting dirs
cd $BASEDIR
[ ! -d "$BACKUPDIR" ] && mkdir -p "$BACKUPDIR"
sudo mv ROOT/ $BACKUPDIR/dp.$TIMESTAMP
sudo chmod 777 $BACKUPDIR/dp.$TIMESTAMP
echo ROOT
APPDIR=$BASEDIR/ROOT
[ ! -d $APPDIR ] && sudo mkdir $APPDIR
sudo cp $APP $APPDIR
cd $APPDIR
sudo unzip -q $FILENAME && sudo rm $FILENAME
sudo rm $APPDIR/WEB-INF/classes/private-*.properties
sudo rm $APPDIR/WEB-INF/classes/dcui.properties
sudo mv $APPDIR/WEB-INF/classes/dcui.elonia-dev.properties $APPDIR/WEB-INF/classes/dcui.properties
sudo rm $APPDIR/WEB-INF/classes/toop-interface.properties
sudo mv $APPDIR/WEB-INF/classes/toop-interface.elonia-dev.properties $APPDIR/WEB-INF/classes/toop-interface.properties
sudo mv $APPDIR/WEB-INF/classes/datasets.elonia.xml $APPDIR/WEB-INF/classes/datasets.xml
echo starting Tomcat
sudo service tomcat start
echo Done!
else
echo "Source file $APP not existing!"
fi