93e5973d7bbb77377073a0b87e4814bc4cf13dab
[aai/esr-server.git] / standalone / src / main / assembly / docker / docker-entrypoint.sh
1 #!/bin/bash
2
3 if [ -z "$SERVICE_IP" ]; then
4     export SERVICE_IP=`hostname -i`
5 fi
6 echo "SERVICE_IP=$SERVICE_IP"
7
8 if [ -z "$MSB_ADDR" ]; then
9     echo "Missing required variable MSB_ADDR: Microservices Service Bus address <ip>:<port>"
10     exit 1
11 fi
12 echo "MSB_ADDR=$MSB_ADDR"
13
14 # Wait for MSB initialization
15 echo "Wait for MSB initialization"
16 for i in {1..5}; do
17     curl -sS -m 1 $MSB_ADDR > /dev/null && break
18     sleep $i
19 done
20
21 # Configure service based on docker environment variables
22 /home/esr/docker/instance_config.sh
23
24 # Start the microservice
25 /home/esr/docker/instance_run.sh