-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sh
81 lines (63 loc) · 1.29 KB
/
build.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
#!/bin/bash
set -e
ROOT_FOLDER="$(pwd)"
removeLastDockerImages() {
docker rmi node/service-a:latest spring/service-b:latest quarkus/service-c:latest quarkus/service-d:latest --force
}
buildServiceA() {
cd "$ROOT_FOLDER"/service-a
sh build.sh
}
buildServiceB() {
cd "$ROOT_FOLDER"/service-b
sh build.sh
}
buildServiceC() {
cd "$ROOT_FOLDER"/service-c
sh build.sh
}
buildServiceD() {
cd "$ROOT_FOLDER"/service-d
sh build.sh
}
buildServices() {
buildServiceA
buildServiceB
buildServiceC
buildServiceD
}
generateData() {
printf "Generando datos.."
until curl -s -f -o /dev/null "http://localhost:8080/metrics/prometheus"
do
sleep 5
done
i=0
while [ $i -ne 200 ]
do
RANDOM_NUMBER=$(($RANDOM%201-100))
curl --silent --location --request POST 'http://localhost:8080/' --header 'Content-Type: application/json' --data-raw '{"initialValue":"'"$RANDOM_NUMBER"'"}' > /dev/null
i=$(($i+1))
sleep 0.1
if [ $((i % 10)) == 0 ]; then
printf "."
fi
done
echo "Datos generados!"
}
showInfo() {
echo ""
echo ""
echo "Entorno listo!"
echo "- Dashboard: http://localhost:3000/d/metrics/dashboard-post"
echo ""
echo ""
}
start() {
removeLastDockerImages
buildServices
docker-compose up -d
generateData
showInfo
}
start