Improve the way to deploy onap via proxy
[demo.git] / boot / aaf_install.sh
index 0378a4e..ab7bcf7 100644 (file)
@@ -1,13 +1,21 @@
 #!/bin/bash
 
 # Read configuration files
-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)
+HTTP_PROXY=$(cat /opt/config/http_proxy.txt)
+HTTPS_PROXY=$(cat /opt/config/https_proxy.txt)
+
+if [ $HTTP_PROXY != " " ]
+then
+    export http_proxy=$HTTP_PROXY
+    export https_proxy=$HTTPS_PROXY
+fi
+
 
 # Add host name to /etc/host to avoid warnings in openstack images
 if [[ $CLOUD_ENV != "rackspace" ]]
@@ -54,8 +62,10 @@ apt-get update
 apt-get install --allow-unauthenticated -y apt-transport-https ca-certificates wget openjdk-8-jdk git ntp ntpdate make maven
 
 # Download scripts from Nexus
-curl -k $NEXUS_REPO/org.onap.demo/boot/$ARTIFACTS_VERSION/aaf_vm_init.sh -o /opt/aaf_vm_init.sh
-curl -k $NEXUS_REPO/org.onap.demo/boot/$ARTIFACTS_VERSION/aaf_serv.sh -o /opt/aaf_serv.sh
+unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip aaf_vm_init.sh > /opt/aaf_vm_init.sh
+unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip aaf_serv.sh > /opt/aaf_serv.sh
+unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh
+chmod +x /opt/imagetest.sh
 chmod +x /opt/aaf_vm_init.sh
 chmod +x /opt/aaf_serv.sh
 mv /opt/aaf_serv.sh /etc/init.d
@@ -85,6 +95,11 @@ echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker
 
 cp /lib/systemd/system/docker.service /etc/systemd/system
 sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service
+if [ $HTTP_PROXY != "no_proxy" ]
+then
+cd /opt
+./imagetest.sh
+fi
 service docker restart
 
 # DNS IP address configuration
@@ -95,8 +110,13 @@ resolvconf -u
 cd /opt
 git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO
 chmod +x /opt/authz/auth/auth-cass/docker/dinstall.sh
+chmod +x /opt/authz/auth/auth-cass/docker/backup/backup.sh
+chmod +x /opt/authz/auth/docker/dbuild.sh
 chmod +x /opt/authz/auth/docker/drun.sh
-chmod +x /opt/authz/auth/docker/d.props
+chmod +x /opt/authz/auth/docker/dstart.sh
+chmod +x /opt/authz/auth/docker/dstop.sh
+# d.props is not a startable shell
+# chmod +x /opt/authz/auth/docker/d.props
 
 #Update maven settings
 cat > /usr/share/maven/conf/settings.xml << EOF
@@ -190,22 +210,29 @@ under the License.
    | specification in this list marked as active will be used.
    |-->
   <proxies>
-    <!-- proxy
-     | Specification for one proxy, to be used in connecting to the network.
-     |
     <proxy>
       <id>optional</id>
       <active>true</active>
       <protocol>http</protocol>
       <username>proxyuser</username>
       <password>proxypass</password>
-      <host>proxy.host.net</host>
-      <port>80</port>
+      <host>$(cat /opt/config/http_proxy.txt | cut -d ':' -f1)</host>
+      <port>$(cat /opt/config/http_proxy.txt | cut -d ':' -f2)</port>
+      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
+    </proxy>
+    <proxy>
+      <id>optional</id>
+      <active>true</active>
+      <protocol>https</protocol>
+      <username>proxyuser</username>
+      <password>proxypass</password>
+      <host>$(cat /opt/config/https_proxy.txt | cut -d ':' -f1)</host>
+      <port>$(cat /opt/config/https_proxy.txt | cut -d ':' -f2)</port>
       <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
     </proxy>
-    -->
   </proxies>
 
+
   <!-- servers
    | This is a list of authentication profiles, keyed by the server-id used within the system.
    | Authentication profiles can be used whenever maven must make a connection to a remote server.
@@ -513,4 +540,4 @@ then
 fi
 
 cd /opt
-./aaf_vm_init.sh
\ No newline at end of file
+./aaf_vm_init.sh