Fix timeout error
[vfc/nfvo/driver/ems.git] / ems / microservice-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
9 if [ -z "$MSB_ADDR" ]; then
10     echo "Missing required variable MSB_ADDR: Microservices Service Bus address <ip>:<port>"
11     exit 1
12 fi
13 echo "MSB_ADDR=$MSB_ADDR"
14
15 # Wait for MSB initialization
16 echo "Wait for MSB initialization"
17 for i in {1..5}; do
18     curl -sS -m 1 $MSB_PROTO://$MSB_ADDR/msb -k > /dev/null
19     res=$?
20     if [ $res -ne 0 ]; then
21         break
22     fi
23     sleep $i
24 done
25
26 # Configure service based on docker environment variables
27 emsdriver/docker/instance_config.sh
28
29 date > init.log
30
31 # Start the microservice
32 emsdriver/docker/instance_run.sh