Newer
Older
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/usr/bin/env bash
#set -x
# This script starts vitamui modules
# The dev environnement use node.js as front
# Http ports are 4200, 4201, etc.
# Modules needs to be compiled with the default profile :
# mvn clean install -DskipTests
# The prod environnement put the angular webapp in a jar with tomcat embedded
# Http ports are 8200, 8201, etc.
# Modules needs to be compiled with the webpack profile :
# mvn clean install -Pwebpack -DskipTests
# To use debug mode :
# mvn spring-boot:run -Dspring-boot.run.profiles=dev -Dspring-boot.run.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
export MAVEN_OPTS="-Xmx50M -XX:+UseG1GC"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
# SPRINGBOOT="mvn spring-boot:run -Dspring-boot.run.noverify"
SPRINGBOOT='mvn -Pvitam --batch-mode spring-boot:run -Dspring-boot.run.noverify -Dspring-boot.run.jvmArguments='\''-XX:+UseG1GC'\'
NPMSTART="sh -c 'npm install; npm run start'"
if [[ "$*" =~ --erase ]]
then
rm "${DIR}"/logs/*
fi
log_count=0
function launch() {
if [[ ! -e "${DIR}/logs" ]] ; then mkdir "${DIR}/logs" ; fi
echo ; echo =========== Starting $1 ========== ; echo
#gnome-terminal --disable-factory --title="$(basename $1)" --working-directory="${DIR}/$1" -e "$2" &>/dev/null &
((log_count += 1))
pushd "${DIR}/$1" > /dev/null || exitm
eval $2 > "${DIR}/logs/$(basename "$1")-$log_count.log" 2> "${DIR}/logs/$(basename "$1")-error.$log_count.log" &
echo "$2 &"
popd > /dev/null || exit
#echo "$! " >> /tmp/external.pids
}
function clean() {
mkdir -p $1/target/src/main
rm -rf $1/target/src/main/config
cp -r $1/src/main/config $1/target/src/main/config
}
function cmd() {
echo $1 $2
pushd $1 ; $2 ; popd
}
function start_api() {
# Start Iam Security
launch "../api/api-security/security-internal" "$SPRINGBOOT"
sleep 15
# Start Iam Server Internal
launch "../api/api-iam/iam-internal" "$SPRINGBOOT"
sleep 15
# Start Iam Server External
launch "../api/api-iam/iam-external" "$SPRINGBOOT"
sleep 15
# Start Cas Server
launch "../cas/cas-server" "java -Xmx200M -XX:+UseG1GC -Dspring.config.location=src/main/config/cas-server-application-dev.yml -jar target/cas-server.war"
sleep 15
}
function start_ui_prod() {
# Start UI Identity
clean "../ui/ui-identity"
launch "../ui/ui-identity" "./target/ui-identity-${BRANCH}.jar --spring.config.additional-location=file:src/main/config/ui-identity-application-recette.yml"
# Start UI Portal
clean "../ui/ui-portal"
launch "../ui/ui-portal" "./target/ui-portal-${BRANCH}.jar --spring.config.additional-location=file:src/main/config/ui-portal-application-recette.yml"
}
function start_ui_back_dev() {
# Start UI Identity back
clean "../ui/ui-identity"
launch "../ui/ui-identity" "$SPRINGBOOT"
sleep 15
# Start UI Portal back
clean "../ui/ui-portal"
launch "../ui/ui-portal" "$SPRINGBOOT"
sleep 15
}
function start_ui_front_dev {
# Start UI Identity front
# cmd "ui/ui-frontend" "$NPMINSTALL"
launch "../ui/ui-frontend" "$NPMSTART:identity"
# Start UI Portal front
# cmd "ui/ui-frontend" "$NPMINSTALL"
launch "../ui/ui-frontend" "$NPMSTART:portal"
}
./stop_external.sh &> /dev/null
echo
echo =================================
echo STARTING INTEGRATION ENVIRONNEMENT
echo =================================
echo
(
flock -e -n 200
echo =========== Starting MONGO ==========
case $(docker inspect -f \{\{.State.Running\}\} vitamui-mongo) in
"false")
docker start vitamui-mongo
;;
"true")
# do nothing
;;
*)
pushd docker/mongo ; ./start_dev.sh ; popd
;;
esac
BRANCH=$(grep -oP '(?<=>).*?(?=</version>)' ../api/pom.xml | grep -v 'version')
case $1 in
api-only)
start_api
;;
back)
start_api
start_ui_back_dev
;;
front)
start_ui_front_dev
;;
all-ui-prod)
start_api
start_ui_prod
;;
*)
start_api
start_ui_back_dev
start_ui_front_dev
;;
esac
) 200>/tmp/external.lockfile
echo
echo =================================
echo INTEGRATION ENVIRONNEMENT STARTED
echo =================================
echo