forked from spring-petclinic/spring-petclinic-microservices
-
Notifications
You must be signed in to change notification settings - Fork 6
/
start_all_with_inspectIT.bat
129 lines (107 loc) · 3.79 KB
/
start_all_with_inspectIT.bat
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
@echo off
rem usage: Start_all_with_inspectIT.bat <agent_path> <cmr_host>
rem the startup scipt must be placed in the same folder than the spring petclinic application
rem the path to the inspectit installation folder and the WAITTIME between the startup of the services
rem !!!!do not use spaces in the path of inspectIT installation folder!!!!
set AGENTDIR=%1
set WAITTIME=5
set /a "x = 0"
rem STARTTYPE, z.B. /B = start without open a new windows, /MIN start minized in new windows
set STARTTYPE=/B
if not exist "%AGENTDIR%/inspectit-agent.jar" (
echo Agent jar not found. Specify the path to the inspectIT agent
echo Example: Start_all_with_inspectIT.bat c:/user/inspectIT/agent localhost.
echo In case you have not installed inspectIT go to https://github.com/inspectIT/inspectIT/releases
goto :eof
)
if not "%~2"=="" (
set CMR_HOST=%2
) else (
set CMR_HOST=localhost
)
call mvn clean install -DskipTests
echo "Agent jar found."
cd spring-petclinic-config-server
echo "Starting Configuration Server"
if exist configuration-log.txt del configuration-log.txt
ping 127.0.0.1 -n 1 > nul
start %STARTTYPE% mvn spring-boot:run > configuration-log.txt
cd ..
echo|set /p="Waiting for Configuration Server"
:loop1
set /a "x = x + 1"
if %x% geq 60 (
goto :eof
)
echo|set /p="."
find "Started ConfigServerApplication" spring-petclinic-config-server\configuration-log.txt > nul
if errorlevel 1 (
ping 127.0.0.1 -n 2 > nul
goto :loop1
)
set /a "x = 0"
echo .
cd spring-petclinic-discovery-server
echo "Starting Discovery Server"
if exist discovery-log.txt del discovery-log.txt
ping 127.0.0.1 -n 1 > nul
start %STARTTYPE% mvn spring-boot:run > discovery-log.txt
cd ..
echo|set /p="Waiting for Eureka Service"
:loop2
set /a "x = x + 1"
if %x% geq 60 (
goto :eof
)
echo|set /p="."
find "Started DiscoveryServerApplication" spring-petclinic-discovery-server\discovery-log.txt > nul
if errorlevel 1 (
ping 127.0.0.1 -n 2 > nul
goto :loop2
)
start "" http://localhost:8761
echo .
set /a "x = 0"
cd spring-petclinic-customers-service
echo "Starting Customers Service"
start %STARTTYPE% mvn spring-boot:run -Drun.jvmArguments="-javaagent:%AGENTDIR%/inspectit-agent.jar -Dinspectit.repository=%CMR_HOST%:9070 -Dinspectit.agent.name=customers-service"
cd ..
ping 127.0.0.1 -n %WAITTIME% > nul
cd spring-petclinic-vets-service
echo "Starting Vets Service"
start %STARTTYPE% mvn spring-boot:run -Drun.jvmArguments="-javaagent:%AGENTDIR%/inspectit-agent.jar -Dinspectit.repository=%CMR_HOST%:9070 -Dinspectit.agent.name=vets-service"
cd ..
ping 127.0.0.1 -n %WAITTIME% > nul
cd spring-petclinic-visits-service
echo "Starting Visits Service"
start %STARTTYPE% mvn spring-boot:run -Drun.jvmArguments="-javaagent:%AGENTDIR%/inspectit-agent.jar -Dinspectit.repository=%CMR_HOST%:9070 -Dinspectit.agent.name=visits-service"
cd ..
ping 127.0.0.1 -n %WAITTIME% > nul
cd spring-petclinic-api-gateway
echo "Starting API Gateway"
if exist api-gateway-log.txt del api-gateway-log.txt
ping 127.0.0.1 -n 1 > nul
start %STARTTYPE% mvn spring-boot:run -Drun.jvmArguments="-javaagent:%AGENTDIR%/inspectit-agent.jar -Dinspectit.repository=%CMR_HOST%:9070 -Dinspectit.agent.name=api-gateway" > api-gateway-log.txt
cd ..
ping 127.0.0.1 -n %WAITTIME% > nul
cd spring-petclinic-admin-server
echo "Starting Admin Server"
ping 127.0.0.1 -n %WAITTIME% > nul
start %STARTTYPE% mvn spring-boot:run -Drun.jvmArguments="-javaagent:%AGENTDIR%/inspectit-agent.jar -Dinspectit.repository=%CMR_HOST%:9070 -Dinspectit.agent.name=admin-server"
cd ..
echo|set /p="Waiting for Api Gateway"
:loop3
set /a "x = x + 1"
if %x% geq 200 (
goto :eof
)
echo|set /p="."
find "Started ApiGatewayApplication" spring-petclinic-api-gateway\api-gateway-log.txt > nul
if errorlevel 1 (
ping 127.0.0.1 -n 2 > nul
goto :loop3
)
start "" http://localhost:8080
echo .
set /a "x = 0"
echo "All Services started!"