diff options
Diffstat (limited to 'boot')
-rw-r--r-- | boot/nbi_install.sh | 18 | ||||
-rw-r--r-- | boot/nbi_vm_init.sh | 16 |
2 files changed, 32 insertions, 2 deletions
diff --git a/boot/nbi_install.sh b/boot/nbi_install.sh index c5f5ce4c..71546016 100644 --- a/boot/nbi_install.sh +++ b/boot/nbi_install.sh @@ -5,7 +5,9 @@ NEXUS_REPO=$(cat /opt/config/nexus_repo.txt) ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) CLOUD_ENV=$(cat /opt/config/cloud_env.txt) +GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt) MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) +CODE_REPO=$(cat /opt/config/remote_repo.txt) # Add host name to /etc/host to avoid warnings in openstack images if [[ $CLOUD_ENV != "rackspace" ]] @@ -60,7 +62,7 @@ mv /opt/nbi_serv.sh /etc/init.d update-rc.d nbi_serv.sh defaults # Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | tee /etc/apt/sources.list.d/docker.list +echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list apt-get update apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual apt-get install -y --allow-unauthenticated docker-engine @@ -89,6 +91,18 @@ service docker restart echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head resolvconf -u -# Clone Gerrit repository and run docker containers +# Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes +if [[ $CLOUD_ENV != "rackspace" ]] +then + sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub + grub-mkconfig -o /boot/grub/grub.cfg + sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg + sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules + echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg + echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic + reboot +fi + +# Run docker containers cd /opt ./nbi_vm_init.sh diff --git a/boot/nbi_vm_init.sh b/boot/nbi_vm_init.sh index f50c8986..45cce7c9 100644 --- a/boot/nbi_vm_init.sh +++ b/boot/nbi_vm_init.sh @@ -4,3 +4,19 @@ 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) + +# Fetch the latest docker-compose.yml +cd /opt/nbi +wget https://git.onap.org/externalapi/nbi/tree/docker-compose.yml?h=master + +# Pull the nbi docker image from nexus +# MariaDB and mongoDB will be pulled automatically from docker.io during docker-compose +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO + +docker pull $NEXUS_DOCKER_REPO/onap/externalapi/nbi:$DOCKER_IMAGE_VERSION + +# Change the Clamp docker image name in the docker-compose.yml to match the one downloaded +sed -i "/image: onap\/nbi/c\ image: $NEXUS_DOCKER_REPO\/onap\/nbi:$DOCKER_IMAGE_VERSION" docker-compose.yml + +# Start nbi, MariaDB and MongoDB containers with docker compose and nbi/docker-compose.yml +/opt/docker/docker-compose up -d
\ No newline at end of file |