-
Notifications
You must be signed in to change notification settings - Fork 110
/
docker-compose-CONSUL.sh
executable file
·61 lines (49 loc) · 1.78 KB
/
docker-compose-CONSUL.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
#!/bin/bash
SYSTEM_PROPS="-DRABBIT_HOST=${HEALTH_HOST} -Dspring.rabbitmq.port=5672 -Dspring.profiles.active=consul -Dspring.cloud.consul.host=${HEALTH_HOST}"
dockerComposeFile="docker-compose-${WHAT_TO_TEST}.yml"
kill_docker
docker-compose -f $dockerComposeFile kill
docker-compose -f $dockerComposeFile pull
docker-compose -f $dockerComposeFile build
if [[ "${SHOULD_START_RABBIT}" == "yes" ]] ; then
echo -e "\n\nBooting up RabbitMQ"
docker-compose -f $dockerComposeFile up -d rabbitmq
fi
echo -e "\n\nBooting up Discovery"
docker-compose -f $dockerComposeFile up -d discovery
READY_FOR_TESTS="no"
PORT_TO_CHECK=5672
echo "Waiting for RabbitMQ to boot for [$(( WAIT_TIME * RETRIES ))] seconds"
netcat_port $PORT_TO_CHECK && READY_FOR_TESTS="yes"
if [[ "${READY_FOR_TESTS}" == "no" ]] ; then
echo "RabbitMQ failed to start..."
exit 1
fi
READY_FOR_TESTS="no"
PORT_TO_CHECK=8500
echo "Waiting for Consul to boot for [$(( WAIT_TIME * RETRIES ))] seconds"
netcat_port $PORT_TO_CHECK && READY_FOR_TESTS="yes"
if [[ "${READY_FOR_TESTS}" == "no" ]] ; then
echo "Consul failed to start..."
exit 1
fi
READY_FOR_TESTS="no"
PORT_TO_CHECK=3100
echo "Run the rest of infra"
docker-compose -f $dockerComposeFile up -d zipkin loki prometheus grafana
netcat_local_port $PORT_TO_CHECK && READY_FOR_TESTS="yes"
if [[ "${READY_FOR_TESTS}" == "no" ]] ; then
echo "Loki failed to start..."
exit 1
fi
READY_FOR_TESTS="no"
PORT_TO_CHECK=8888
echo "Waiting for the Config Server app to boot for [$(( WAIT_TIME * RETRIES ))] seconds"
java_jar "config-server"
curl_local_health_endpoint $PORT_TO_CHECK && READY_FOR_TESTS="yes"
if [[ "${READY_FOR_TESTS}" == "no" ]] ; then
echo "Config server failed to start..."
exit 1
fi
echo -e "\n\nStarting brewery apps..."
start_brewery_apps "$SYSTEM_PROPS"