Remove deprecated R1 code
[demo.git] / heat / ONAP / cloud-config / dcae2_install.sh
1 #!/bin/bash
2 #############################################################################
3 #
4 # Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved.
5 #
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
10 #
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.
16 #
17 #############################################################################
18
19 set -ex 
20
21 # Read configuration files
22 EXTERNAL_DNS=$(cat /opt/config/external_dns.txt)
23 MAC_ADDR=$(cat /opt/config/mac_addr.txt)
24 HTTP_PROXY=$(cat /opt/config/http_proxy.txt)
25 HTTPS_PROXY=$(cat /opt/config/https_proxy.txt)
26
27 if [ $HTTP_PROXY != "no_proxy" ]
28 then
29     export http_proxy=$HTTP_PROXY
30     export https_proxy=$HTTPS_PROXY
31 fi
32
33
34 # Download dependencies
35 apt-get update
36 apt-get install -y python python-pip
37
38 # Download scripts from Nexus
39 cp /opt/boot/dcae2_vm_init.sh /opt/dcae2_vm_init.sh
40 chmod +x /opt/dcae2_vm_init.sh
41
42 echo "DOCKER_OPTS=\" $DOCKER_OPTS --raw-logs -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock\" " >> /etc/default/docker
43 sed -i "/ExecStart/s/$/ -H tcp:\/\/0.0.0.0:2376 --raw-logs/g" /etc/systemd/system/docker.service
44 if [ ! -e /etc/docker/daemon.json ]; then
45   REGISTRY="$(cat /opt/config/nexus_docker_repo.txt)"
46   if [[ $REGISTRY != nexus3.onap.org* ]]; then
47     echo "{  \"insecure-registries\" : [\"${REGISTRY}\"] }" > /etc/docker/daemon.json
48   fi
49 fi
50 systemctl daemon-reload
51 service docker restart
52
53 # prepare the configurations needed by DCAEGEN2 installer
54 rm -rf /opt/app/config
55 mkdir -p /opt/app/config
56
57
58 cd /opt
59 ./dcae2_vm_init.sh