-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
executable file
·151 lines (129 loc) · 4.15 KB
/
init.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/sh
AUTHOR1="Rodrigo Vitor Ribeiro"
AUTHOR2="Lucas de Assis Dias"
AUTHOR3="Vinicius Vicentini"
AUTHOR4="Victor Vasconcellos"
AUTHOR5="Marcello Nardi"
PROJECT="Lab. Eng. Software - Judocas web version"
TARGET=./target
TMP=$TARGET/tmp
APP=Projeto-Lab-ES
SRC_APP=$TMP/$APP
JBOSS_HOME=$TARGET/EAP-7.2.0
SERVER_DIR=$JBOSS_HOME/standalone/deployments
SERVER_CONF=$JBOSS_HOME/standalone/configuration
SERVER_BIN=$JBOSS_HOME/bin
SRC_DIR=./install
SUPPORT_DIR=./support
EAP=jboss-eap-7.2.0-installer.jar
VERSION=7.2
PROJECT_GIT_REPO=https://github.com/victorborba7/Projeto-Lab-ES
# clear screen.
clear
# Presente this script
echo
echo "################################################################################"
echo "## ##"
echo "## Configurando a aplicação: ##"
echo "## ##"
echo "## ##### # # #### ### ### ### ### ##"
echo "## # # # # # # # # # # # # ##"
echo "## # # # # # # # # ##### ### ##"
echo "## # # # # # # # # # # # # # ##"
echo "## # ## #### ### ### # # ### ##"
echo "## ##"
echo "## Projeto criado por ##"
echo "## ${AUTHOR1} ##"
echo "## ${AUTHOR2} ##"
echo "## ${AUTHOR3} ##"
echo "## ${AUTHOR4} ##"
echo "## ${AUTHOR5} ##"
echo "## ##"
echo "################################################################################"
echo
sleep 1
# Verify if the JBoss EAP installer is present
if [ -r $SRC_DIR/$EAP ] || [ -L $SRC_DIR/$EAP ]; then
echo "Product sources are present..."
else
echo "Need to download $EAP installer from http://developer.redhat.com"
echo "and place it in the $SRC_DIR directory to proceed..."
exit
fi
echo
# Check if exist an old version of the application
if [ -x $TARGET ]; then
echo " Old version found, going to deploy the application."
echo
else
# Install JBoss EAP
echo "Installing the JBoss EAP..."
echo
java -jar $SRC_DIR/$EAP ./support/auto.xml
echo
if [ $? -ne 0 ]; then
echo "Error occured during JBoss EAP installation!"
echo
exit
fi
# Creating database connection
echo "Creating database connection..."
echo
echo "Starting EAP to create the connection"
echo
$SERVER_BIN/standalone.sh &
sleep 10
echo "Add module"
$SERVER_BIN/jboss-cli.sh --file=support/add-module.txt
echo
echo "Add driver"
$SERVER_BIN/jboss-cli.sh -c --file=support/add-driver.txt
echo
echo "Add datasource"
$SERVER_BIN/jboss-cli.sh -c --file=support/add-datasource.txt
echo
echo "Clossing EAP"
kill $(ps -aux |grep EAP-7.2.0/standalone | cut -d ' ' -f2)
echo
fi
echo " - Setting up the project..."
echo
echo " Cloning the project's Git repo from: $PROJECT_GIT_REPO"
echo
git clone $PROJECT_GIT_REPO.git $SRC_APP
echo
echo " - Deploying the application..."
echo
echo " Test the application"
echo
cd $SRC_APP
mvn clean test
if [ $? -ne 0 ]; then
echo "Error occured during application tests!"
echo
exit
fi
echo " Build the apllication"
echo
mvn clean install -DskipTests
if [ $? -ne 0 ]; then
echo "Error occured during application build"
echo
exit
fi
echo " Deploy the application"
echo
cd ../../../
cp $SRC_APP/target/judocas.war $SERVER_DIR
echo " - Clean up..."
echo
rm -rf $TMP
echo "Now you can start the application with $SERVER_BIN/standalone.sh"
echo
echo "Look at http://localhost:8080/judocas"
echo
echo "JBoss user: eapAdmin"
echo " password: judocas#1"
echo
echo "Setup complete."
echo