summaryrefslogtreecommitdiffstats
path: root/boot/policy_vm_init.sh
blob: ffb26bcfcf6d398ea74567440c0d9784d0aa65cc (plain)
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
#!/bin/bash

NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt)
NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt)
NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt)
DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt)
export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
export DOCKER_REPOSITORY=${NEXUS_DOCKER_REPO}

cd /opt/policy
git pull

chmod +x config/drools/drools-tweaks.sh

if [ -e /opt/config/public_ip.txt ]
then
  IP_ADDRESS=$(cat /opt/config/public_ip.txt)
else
  IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
fi

echo $IP_ADDRESS > config/pe/ip_addr.txt

docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO

docker pull $NEXUS_DOCKER_REPO/onap/policy/policy-db:$DOCKER_IMAGE_VERSION
docker tag $NEXUS_DOCKER_REPO/onap/policy/policy-db:$DOCKER_IMAGE_VERSION onap/policy/policy-db:latest

docker pull $NEXUS_DOCKER_REPO/onap/policy/policy-pe:$DOCKER_IMAGE_VERSION
docker tag $NEXUS_DOCKER_REPO/onap/policy/policy-pe:$DOCKER_IMAGE_VERSION onap/policy/policy-pe:latest

docker pull $NEXUS_DOCKER_REPO/onap/policy/policy-drools:$DOCKER_IMAGE_VERSION
docker tag $NEXUS_DOCKER_REPO/onap/policy/policy-drools:$DOCKER_IMAGE_VERSION onap/policy/policy-drools:latest

docker pull $NEXUS_DOCKER_REPO/onap/policy/policy-nexus:$DOCKER_IMAGE_VERSION
docker tag $NEXUS_DOCKER_REPO/onap/policy/policy-nexus:$DOCKER_IMAGE_VERSION onap/policy/policy-nexus:latest

/opt/docker/docker-compose up -d