-
Notifications
You must be signed in to change notification settings - Fork 110
/
docker-compose-WAVEFRONT.sh
executable file
·65 lines (52 loc) · 2.06 KB
/
docker-compose-WAVEFRONT.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
#!/bin/bash
SYSTEM_PROPS="-DRABBIT_HOST=${HEALTH_HOST} -Dspring.rabbitmq.port=5672 -Dspring.zipkin.baseUrl=http://${HEALTH_HOST}:9411"
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
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=2181
echo "Waiting for Zookeeper to boot for [$(( WAIT_TIME * RETRIES ))] seconds"
docker-compose -f $dockerComposeFile up -d zookeeper
netcat_local_port $PORT_TO_CHECK && READY_FOR_TESTS="yes"
if [[ "${READY_FOR_TESTS}" == "no" ]] ; then
echo "Zookeeper 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
export WAVEFRONT_API_TOKEN="${WAVEFRONT_API_TOKEN:-}"
export WAVEFRONT_URI="${WAVEFRONT_URI:-https://vmware.wavefront.com}"
SYSTEM_PROPS="${SYSTEM_PROPS} -Dwavefront.application.name=brewery -Dmanagement.wavefront.api-token=${WAVEFRONT_API_TOKEN} -Dmanagement.wavefront.uri=${WAVEFRONT_URI}"
# Boot config-server
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" "${SYSTEM_PROPS}"
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"