forked from coolgourav147/spring-boot-war-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
55 lines (41 loc) · 1.08 KB
/
setup.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
#!/bin/bash
#####
# this script will setup this project.
# run ./setup.sh to run this project.
#####
# Include files.
. ./scripts/utils.sh
. ./scripts/variables.sh
function clean_up(){
if rm -rf ./target
then
echo -e "${GREEN}clean up successfull.${NOCOLOR}"
else
echo -e "${GREEN}not able to do clean up.${NOCOLOR}"
fi
}
trap "clean_up;exit 2" 2
showBanner scripts/banner.txt
if [[ $UID != 0 ]]
then
print_exit 1 "user is not a root user"
fi
read -p "please enter access path " APP_CONTEXT
APP_CONTEXT=${APP_CONTEXT:-app}
apt-get update > /dev/null &
last_command_pid=$!
showProgress ${last_command_pid}
wait ${last_command_pid} || print_exit 1 "not able to update the repository."
installPackage maven
installPackage tomcat9
mavenTarget test
mavenTarget package
if cp -rf target/hello-world-0.0.1-SNAPSHOT.war /var/lib/tomcat9/webapps/${APP_CONTEXT}.war
then
echo "application Deployed successfully. you can access it on http://{IPADDRESS}/${APP_CONTEXT}"
else
print_exit 1 "not able to Deploy the application."
fi
# Clean Up code.
clean_up
exit 0