Merge "Hawkbit installation through docker mode"
[eliot.git] / blueprints / iotgateway / scripts / setup.sh
index 9b2a695..41f845a 100755 (executable)
@@ -18,6 +18,9 @@
 # sshpass needs to be installed before executing this script.                          #
 ########################################################################################
 
+echo "**********************************************************************"
+echo "ELIOT IOT-Gateway Platform Deployment--------------------------STARTED"
+
 # constants
 
 OSPLATFORM=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
@@ -56,9 +59,9 @@ setup_k8sworkers()
   # Install Docker on ELIOT Node
   SETUP_WORKER_COMMON="sudo rm -rf ~/eliot &&\
                        git clone ${ELIOT_REPO} &&\
-                       cd eliot/scripts/ && source common.sh"
+                       cd eliot/blueprints/iotgateway/scripts/ && source common.sh"
   #SETUP_WORKER_COMMON="cd eliot/scripts/ && source common.sh"
-  SETUP_WORKER="cd eliot/scripts/ && source k8sworker.sh"
+  SETUP_WORKER="cd eliot/blueprints/iotgateway/scripts/ && source k8sworker.sh"
 
   KUBEADM_TOKEN=$(kubeadm token create --print-join-command)
   KUBEADM_JOIN="sudo ${KUBEADM_TOKEN}"
@@ -87,8 +90,7 @@ setup_k8smaster_centos()
   # Setup ELIOT Node
   setup_k8sworkers_centos
 
-  kubectl apply -f cni/calico/rbac.yaml
-  kubectl apply -f cni/calico/calico.yaml
+  kubectl apply -f cni/calico/v38/calico.yaml
 
 }
 
@@ -100,7 +102,7 @@ setup_k8sworkers_centos()
 
   SETUP_WORKER_COMMON_CENTOS="sudo rm -rf ~/eliot &&\
                               git clone ${ELIOT_REPO} &&\
-                              cd eliot/scripts/ && source common_centos.sh"
+                              cd eliot/blueprints/iotgateway/scripts/ && source common_centos.sh"
 
   # SETUP_WORKER_COMMON_CENTOS="cd /root/eliot/scripts/ && source common_centos.sh"
 
@@ -132,9 +134,18 @@ install_edgex(){
  cd edgex && source edgexonk8s.sh
 }
 
+# verify installation of edgex platform 
+verify_edgex()
+{
+ set -o xtrace
+ source verifyedgex.sh | tee verifyedgex.log
+
+}
+
+
 install_cadvisor_edge(){
  set -o xtrace
- SETUP_CADVISOR_ATEDGE="cd eliot/scripts/ && source cadvisorsetup.sh"
+ SETUP_CADVISOR_ATEDGE="cd eliot/blueprints/iotgateway/scripts/ && source cadvisorsetup.sh"
  while read line
  do
      nodeinfo="${line}"
@@ -143,11 +154,27 @@ install_cadvisor_edge(){
      nodepaswd=$(echo ${nodeinfo} | cut -d"|" -f3)
      sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${SETUP_CADVISOR_ATEDGE} < /dev/null
  done < nodelist > /dev/null 2>&1
+ echo "CADVISOR Installed in all the ELIOT IOT-GATEWAY Nodes"
 }
 
 install_prometheus(){
-set -o xtrace
-source prometheus.sh | tee install_prometheus.log
+ set -o xtrace
+ source prometheus.sh | tee install_prometheus.log
+ echo "Prometheus deployed successfully on ELIOT Manager Node  and integrated with CAdvisor running on IOT-Gateway Nodes "
+}
+
+install_opcua_centos(){
+ set -o xtrace
+ INSTALL_OPCUA_ATEDGE="cd eliot/blueprints/iotgateway/scripts/opc-ua/ && source install.sh"
+ while read line
+ do
+     nodeinfo="${line}"
+     nodeusr=$(echo ${nodeinfo} | cut -d"|" -f1)
+     nodeip=$(echo ${nodeinfo} | cut -d"|" -f2)
+     nodepaswd=$(echo ${nodeinfo} | cut -d"|" -f3)
+     sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${INSTALL_OPCUA_ATEDGE} < /dev/null
+ done < nodelist > /dev/null 2>&1
+ echo " OPC-UA Server and Client are successfully Deployed on all IOT-Gateway Nodes"
 }
 
 # Start
@@ -159,6 +186,8 @@ then
   exit 0
 fi
 
+setupPath=`pwd`
+
 if [[ $OSPLATFORM = *CentOS* ]]; then
    setup_k8smaster_centos
 else
@@ -175,9 +204,23 @@ sudo docker ps | grep prometheus
 
 install_edgex
 sleep 20
+verify_edgex
+
+
+# Installing hawkbit through docker container
+chmod +x hawkbit.sh
+nohup ./hawkbit.sh
+
+# Installing OPC-UA on IOT Gateway Node
+
+cd ${setupPath}
+if [[ $OSPLATFORM = *CentOS* ]]; then
+   install_opcua_centos
+fi
 
 # Removing the taint from master node
 kubectl taint nodes --all node-role.kubernetes.io/master- || true
 
-echo "ELIOT Setup execution is Completed..."
+echo "**********************************************************************"
+echo "ELIOT IOT-Gateway Platform Deployment--------------------------SUCCESS"