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
#!/usr/bin/env bash
#set -x
# Emmanuel Deviller
# 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"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
SPRINGBOOT="mvn spring-boot:run -Dspring-boot.run.noverify"
NPMSTART="sh -c 'npm install; npm run start'"
function launch() {
echo ; echo =========== Starting $1 ========== ; echo
gnome-terminal --disable-factory --title="$(basename $1)" --working-directory="${DIR}/$1" -e "$2" &>/dev/null &
#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"
# Start Iam Server Internal
launch "../api/api-iam/iam-internal" "$SPRINGBOOT"
# Start Iam Server External
launch "../api/api-iam/iam-external" "$SPRINGBOOT"
# Start Cas Server
launch "../cas/cas-server" "java -Dspring.config.location=src/main/config/cas-server-application-dev.yml -jar target/cas-server.war"
}
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"
# Start UI Portal back
clean "../ui/ui-portal"
launch "../ui/ui-portal" "$SPRINGBOOT"
}
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 ==========
pushd docker/mongo ; ./start_dev.sh ; popd
BRANCH=$(grep -oP '(?<=>).*?(?=</version>)' ../api/pom.xml | grep -v 'version')
case $1 in
"api")
start_api
;;
"back")
start_api
start_ui_back_dev
;;
"front")
start_api
start_ui_back_dev
start_ui_front_dev
;;
*)
start_api
start_ui_prod
;;
esac
) 200>/tmp/external.lockfile
echo
echo =================================
echo INTEGRATION ENVIRONNEMENT STARTED
echo =================================
echo