forked from cer/microservices-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-and-test-all.sh
More file actions
executable file
·77 lines (54 loc) · 1.55 KB
/
build-and-test-all.sh
File metadata and controls
executable file
·77 lines (54 loc) · 1.55 KB
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
#! /bin/bash
set -e
if [ -z "$DOCKER_HOST_IP" ] ; then
if which docker-machine >/dev/null; then
export DOCKER_HOST_IP=$(docker-machine ip default)
else
export DOCKER_HOST_IP=localhost
fi
echo set DOCKER_HOST_IP $DOCKER_HOST_IP
fi
docker-compose up -d --no-recreate rabbitmq mongodb
cd spring-boot-restful-service
export SPRING_RABBITMQ_HOST=${DOCKER_HOST_IP?}
export SPRING_DATA_MONGODB_URI=mongodb://${DOCKER_HOST_IP?}/userregistration
./gradlew build
cd ..
docker-compose up -d --no-deps restfulservice
echo -n waiting for restfulservice to start..
set +e
echo Launching RESTful service in Docker container
echo This takes about 30 seconds...
while [[ true ]]; do
nc -z -w 4 ${DOCKER_HOST_IP?} 8081
if [[ "$?" -eq "0" ]]; then
echo connected
break
fi
echo -n .
sleep 1
done
set -e
cd spring-boot-webapp
export USER_REGISTRATION_URL=http://${DOCKER_HOST_IP?}:8081/user
./gradlew build
cd ..
set +e
echo Launching web app in Docker container
echo This takes about 30 seconds...
docker-compose up -d --no-deps web
while [[ true ]]; do
nc -z -w 4 ${DOCKER_HOST_IP?} 8080
if [[ "$?" -eq "0" ]]; then
echo connected
break
fi
echo -n .
sleep 1
done
set -e
echo The microservices are running
echo You can visit these URLS
echo http://${DOCKER_HOST_IP?}:8080/register.html - registration
echo http://${DOCKER_HOST_IP?}:8761 - Eureka console
echo http://${DOCKER_HOST_IP?}:8081/swagger-ui.html - the Swagger UI