2 #############################################################################
4 # Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 #############################################################################
21 # add well-known DCAE hostname aliases
22 echo "$(cat /opt/config/dcae_ip_addr.txt) consul" >>/etc/hosts
23 echo "$(cat /opt/config/dcae_ip_addr.txt) dockerhost" >>/etc/hosts
25 # Read configuration files
26 EXTERNAL_DNS=$(cat /opt/config/external_dns.txt)
27 MAC_ADDR=$(cat /opt/config/mac_addr.txt)
28 HTTP_PROXY=$(cat /opt/config/http_proxy.txt)
29 HTTPS_PROXY=$(cat /opt/config/https_proxy.txt)
31 if [ $HTTP_PROXY != "no_proxy" ]
33 export http_proxy=$HTTP_PROXY
34 export https_proxy=$HTTPS_PROXY
38 # Download dependencies
40 apt-get install -y python python-pip
42 # Download scripts from Nexus
43 cp /opt/boot/dcae2_vm_init.sh /opt/dcae2_vm_init.sh
44 chmod +x /opt/dcae2_vm_init.sh
46 DOCKER_OPTS=$(cat /etc/default/docker | grep ^DOCKER_OPTS)
47 DOCKER_OPTS=${DOCKER_OPTS::-1}" --raw-logs -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock\""
48 sed -i "s|DOCKER_OPTS=.*|DOCKER_OPTS=$DOCKER_OPTS|g" /etc/default/docker
50 #echo "DOCKER_OPTS=\" $DOCKER_OPTS --raw-logs -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock\" " >> /etc/default/docker
51 sed -i "/ExecStart/s/$/ -H tcp:\/\/0.0.0.0:2376 --raw-logs/g" /etc/systemd/system/docker.service
52 if [ ! -e /etc/docker/daemon.json ]; then
53 REGISTRY="$(cat /opt/config/nexus_docker_repo.txt)"
54 if [[ $REGISTRY != nexus3.onap.org* ]]; then
55 echo "{ \"insecure-registries\" : [\"${REGISTRY}\"] }" > /etc/docker/daemon.json
58 systemctl daemon-reload
59 service docker restart
61 # prepare the configurations needed by DCAEGEN2 installer
62 rm -rf /opt/app/config
63 mkdir -p /opt/app/config
67 ./dcae2_vm_init.sh &>/dev/null &disown