onap on kubernetes source files
[oom.git] / kubernetes / config / docker / init / src / config / message-router / dcae-startup-vm-message-router / deploy.sh
1 #!/bin/bash
2
3 set -e
4
5 # do not change this, it is already matched with the git repo file structure
6 DOCKER_FILE_DIR='./docker_files'
7
8 KAFKA_VERSION='0.8.1.1'
9 SCALA_VERSION='2.9.2'
10 wget -q "http://www.namesdir.com/mirrors/apache/kafka/${KAFKA_VERSION}/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz" \
11   -O "./docker_files/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz"
12
13 # commands to run docker and docker-compose
14 DOCKER_COMPOSE_EXE='/opt/docker/docker-compose'
15
16 cd "${DOCKER_FILE_DIR}"
17
18 while ! ifconfig |grep "docker0" > /dev/null; 
19    do sleep 1
20    echo 'waiting for docker operational'
21 done
22
23 echo "prep any files with local configurations"
24 if ls __* 1> /dev/null 2>&1; then
25    IP_DOCKER0=$(ifconfig docker0 |grep "inet addr" | cut -d: -f2 |cut -d" " -f1)
26    TEMPLATES=$(ls -1 __*)
27    for TEMPLATE in $TEMPLATES
28    do
29       FILENAME=${TEMPLATE//_}
30       if [ ! -z "${IP_DOCKER0}" ]; then
31          sed -e "s/{{ ip.docker0 }}/${IP_DOCKER0}/" "$TEMPLATE" > "$FILENAME"
32       fi
33    done
34 fi
35
36 echo "starting docker operations"
37 ${DOCKER_COMPOSE_EXE} up -d