Feature 8839: Modified Installation script to install OSM with 45/8845/6
authorvijaynag <vijaynag.bs@tataelxsi.co.in>
Sat, 2 May 2020 12:11:10 +0000 (12:11 +0000)
committerbeierlm <mark.beierl@canonical.com>
Fri, 22 May 2020 16:27:16 +0000 (18:27 +0200)
NGUI. Default installation is with light-ui.
-n ngui will install OSM with NGUI.
Resolved merge conflict.
Added NG-UI to ci_stage_3.

Change-Id: I5fc9d036427d078ac52f5cc5e43f7a02d509b482
Signed-off-by: vijaynag <vijaynag.bs@tataelxsi.co.in>
installers/docker/docker-compose-ngui.yaml [new file with mode: 0644]
installers/docker/osm_pods/ng-ui.yaml [new file with mode: 0644]
installers/full_install_osm.sh
installers/install_osm.sh
jenkins/ci-pipelines/ci_stage_3.groovy

diff --git a/installers/docker/docker-compose-ngui.yaml b/installers/docker/docker-compose-ngui.yaml
new file mode 100644 (file)
index 0000000..23fa9e8
--- /dev/null
@@ -0,0 +1,274 @@
+##
+# Copyright 2019 ETSI
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+##
+
+########################################################################
+
+version: '3'
+volumes:
+  ro:
+  ro_db:
+  mongo_db:
+  mon_db:
+  pol_db:
+  osm_packages:
+  prom_db:
+networks:
+  netOSM:
+    external:
+      name: ${OSM_NETWORK:-netosm}
+    #driver: overlay
+    #driver_opts:
+    #  com.docker.network.driver.mtu: "1446"
+services:
+  zookeeper:
+    image: wurstmeister/zookeeper:${ZOOKEEPER_TAG:-latest}
+#    ports:
+#      - "2181:2181"
+    networks:
+      - netOSM
+    healthcheck:
+      test: echo stat | nc localhost 2181
+      interval: 10s
+      timeout: 10s
+      retries: 3
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "100m"
+        max-file: "2"
+  kafka:
+    image: wurstmeister/kafka:${KAFKA_TAG:-latest}
+    ports:
+      - "9092"
+    networks:
+      - netOSM
+    environment:
+      KAFKA_ADVERTISED_HOST_NAME: kafka
+      KAFKA_ADVERTISED_PORT: 9092
+      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
+      KAFKA_LOG_RETENTION_HOURS: 24
+    volumes:
+      - /var/run/docker.sock:/var/run/docker.sock
+    healthcheck:
+      test: zookeeper-shell.sh zookeeper:2181 ls /brokers/ids 2>&1 | grep "Node does not exist" && exit 1 || exit 0
+      interval: 20s
+      timeout: 10s
+      retries: 5
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "100m"
+        max-file: "2"
+    #depends_on:
+    #  - zookeeper
+  mongo:
+    image: mongo
+#    ports:
+#      - "27017:27017"
+    networks:
+      - netOSM
+    volumes:
+      - mongo_db:/data/db
+  prometheus:
+    image: prom/prometheus:${PROMETHEUS_TAG:-latest}
+    hostname: prometheus
+    ports:
+      - "${OSM_PROM_PORTS:-9091:9090}"
+    volumes:
+      - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
+      - prom_db:/prometheus
+    networks:
+      - netOSM
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "100m"
+        max-file: "2"
+  prometheus-cadvisor:
+    image: google/cadvisor:${PROMETHEUS_CADVISOR_TAG:-latest}
+    ports:
+      - "${OSM_PROM_CADVISOR_PORTS:-8080:8080}"
+    volumes:
+      - /:/rootfs:ro
+      - /var/run:/var/run:ro
+      - /sys:/sys:ro
+      - /var/lib/docker/:/var/lib/docker:ro
+      - /dev/disk/:/dev/disk:ro
+    networks:
+      - netOSM
+  keystone:
+    image: ${DOCKER_USER:-opensourcemano}/keystone:${TAG:-7}
+    networks:
+      - netOSM
+    environment:
+      DB_HOST: mysql
+    env_file:
+      - ./keystone.env
+    ports:
+      - "${OSM_KEYSTONE_PORTS:-5000:5000}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "100m"
+        max-file: "2"
+  nbi:
+    image: ${DOCKER_USER:-opensourcemano}/nbi:${TAG:-7}
+    networks:
+      - netOSM
+    volumes:
+      - osm_packages:/app/storage
+    environment:
+      OSMNBI_DATABASE_HOST: mongo
+      OSMNBI_MESSAGE_HOST: kafka
+    env_file:
+      - ./nbi.env
+    ports:
+      - "${OSM_NBI_PORTS:-9999:9999}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "100m"
+        max-file: "2"
+    #depends_on:
+    #  - kafka
+    #  - mongo
+  lcm:
+    image: ${DOCKER_USER:-opensourcemano}/lcm:${TAG:-7}
+    networks:
+      - netOSM
+    volumes:
+      - osm_packages:/app/storage
+    environment:
+      OSMLCM_RO_HOST: ro
+      OSMLCM_DATABASE_HOST: mongo
+      OSMLCM_MESSAGE_HOST: kafka
+    env_file:
+      - ./lcm.env
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "100m"
+        max-file: "2"
+    #depends_on:
+    #  - kafka
+    #  - mongo
+    #  - ro
+  mysql:
+    image: mysql:5
+    networks:
+      netOSM:
+        aliases:
+          - ro-db
+    volumes:
+      - ro_db:/var/lib/mysql
+    env_file:
+      - ./ro-db.env
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "100m"
+        max-file: "2"
+#    ports:
+#      - "3306:3306"
+  ro:
+    image: ${DOCKER_USER:-opensourcemano}/ro:${TAG:-7}
+    networks:
+      - netOSM
+    environment:
+      RO_DB_HOST: mysql
+    env_file:
+      - ./ro.env
+    #depends_on:
+    #  - mysql
+    volumes:
+      - ro:/var/log/osm
+    ports:
+      - "${OSM_RO_PORTS:-9090:9090}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "100m"
+        max-file: "2"
+  mon:
+    image: ${DOCKER_USER:-opensourcemano}/mon:${TAG:-7}
+    networks:
+      - netOSM
+    volumes:
+      - mon_db:/app/database
+    environment:
+      OSMMON_MESSAGE_HOST: kafka
+      OSMMON_MESSAGE_PORT: 9092
+    env_file:
+      - ./mon.env
+    ports:
+      - "${OSM_MON_PORTS:-8662:8662}"
+    #depends_on:
+    #  - kafka
+    logging:
+        driver: "json-file"
+        options:
+            max-file: 5
+            max-size: 10m
+  pol:
+    image: ${DOCKER_USER:-opensourcemano}/pol:${TAG:-7}
+    networks:
+      - netOSM
+    volumes:
+      - pol_db:/app/database
+    environment:
+      OSMPOL_MESSAGE_HOST: kafka
+      OSMPOL_MESSAGE_PORT: 9092
+    env_file:
+      - ./pol.env
+    #depends_on:
+    #  - kafka
+    #  - mon
+    logging:
+      driver: "json-file"
+      options:
+        max-file: 5
+        max-size: 10m
+  ng-ui:
+    image: ${DOCKER_USER:-opensourcemano}/ng-ui:${TAG:-7}
+    networks:
+      - netOSM
+    #depends_on:
+    #  - nbi
+    ports:
+      - "${OSM_UI_PORTS:-80:80}"
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "100m"
+        max-file: "2"
+  grafana:
+    image: grafana/grafana
+    volumes:
+      - ./files/dashboards-osm.yml:/etc/grafana/provisioning/dashboards/dashboards-osm.yml
+      - ./files/osm-sample-dashboard.json:/etc/grafana/provisioning/dashboards/osm-sample-dashboard.json
+      - ./files/osm-system-dashboard.json:/etc/grafana/provisioning/dashboards/osm-system-dashboard.json
+      - ./files/datasource-prometheus.yml:/etc/grafana/provisioning/datasources/datasource-prometheus.yml
+    hostname: grafana
+    ports:
+      - "${OSM_GRAFANA_PORTS:-3000:3000}"
+    networks:
+      - netOSM
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "100m"
+        max-file: "2"
+
diff --git a/installers/docker/osm_pods/ng-ui.yaml b/installers/docker/osm_pods/ng-ui.yaml
new file mode 100644 (file)
index 0000000..4461c3b
--- /dev/null
@@ -0,0 +1,52 @@
+# Copyright 2019 TATA ELXSI
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+# Author: Vijay Nag B S (vijaynag.bs@tataelxsi.co.in)
+
+apiVersion: v1
+kind: Service
+metadata:
+  name: ng-ui
+spec:
+  ports:
+  - nodePort: 80
+    port: 80
+    protocol: TCP
+    targetPort: 80
+  selector:
+    app: ng-ui
+  type: NodePort
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: ng-ui
+  labels:
+    app: ng-ui
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: ng-ui
+  template:
+    metadata:
+      labels:
+        app: ng-ui
+    spec:
+      containers:
+      - name: ng-ui
+        image: opensourcemano/ng-ui:7
+        ports:
+        - containerPort: 80
+          protocol: TCP
index eaf79d7..69c3a63 100755 (executable)
@@ -27,6 +27,7 @@ function usage(){
     echo -e "                     -b tags/v1.1.0     (a specific tag)"
     echo -e "                     ..."
     echo -e "     -c <orchestrator> deploy osm services using container <orchestrator>. Valid values are <k8s> or <swarm>.  If -c is not used then osm will be deployed using default orchestrator. When used with --uninstall, osm services deployed by the orchestrator will be uninstalled"
+    echo -e "     -n <ui> install OSM with Next Gen UI. Valid values are <lwui> or <ngui>. If -n is not specified osm will be installed with light-ui. When used with uninstall, osm along with the UI specified will be uninstalled"
     echo -e "     -s <stack name> or <namespace>  user defined stack name when installed using swarm or namespace when installed using k8s, default is osm"
     echo -e "     -H <VCA host>   use specific juju host controller IP"
     echo -e "     -S <VCA secret> use VCA/juju secret key"
@@ -198,7 +199,6 @@ function uninstall_lightweight() {
         newgrp docker << EONG
         docker image rm ${DOCKER_USER}/ro:${OSM_DOCKER_TAG}
         docker image rm ${DOCKER_USER}/lcm:${OSM_DOCKER_TAG}
-        docker image rm ${DOCKER_USER}/light-ui:${OSM_DOCKER_TAG}
         docker image rm ${DOCKER_USER}/keystone:${OSM_DOCKER_TAG}
         docker image rm ${DOCKER_USER}/nbi:${OSM_DOCKER_TAG}
         docker image rm ${DOCKER_USER}/mon:${OSM_DOCKER_TAG}
@@ -206,6 +206,15 @@ function uninstall_lightweight() {
         docker image rm ${DOCKER_USER}/pla:${OSM_DOCKER_TAG}
         docker image rm ${DOCKER_USER}/osmclient:${OSM_DOCKER_TAG}
 EONG
+        if [ -n "$NGUI" ]; then
+            newgrp docker << EONG
+            docker image rm ${DOCKER_USER}/ng-ui:${OSM_DOCKER_TAG}
+EONG
+        else
+            newgrp docker << EONG
+            docker image rm ${DOCKER_USER}/light-ui:${OSM_DOCKER_TAG}
+EONG
+         fi
 
         if [ -n "$KUBERNETES" ]; then
             OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_STACK_NAME}"
@@ -500,13 +509,23 @@ function generate_docker_images() {
         sg docker -c "docker build ${LWTEMPDIR}/LCM -f ${LWTEMPDIR}/LCM/Dockerfile.local -t ${DOCKER_USER}/lcm --no-cache" || FATAL "cannot build LCM docker image"
     fi
 
-    if [ -n "$PULL_IMAGES" ]; then
-        sg docker -c "docker pull ${DOCKER_USER}/light-ui:${OSM_DOCKER_TAG}" || FATAL "cannot pull light-ui docker image"
-    elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q LW-UI ; then
-        git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LW-UI
-        git -C ${LWTEMPDIR}/LW-UI checkout ${COMMIT_ID}
-        sg docker -c "docker build ${LWTEMPDIR}/LW-UI -f ${LWTEMPDIR}/LW-UI/docker/Dockerfile -t ${DOCKER_USER}/light-ui --no-cache" || FATAL "cannot build LW-UI docker image"
-    fi
+    if [ -n "$NGUI" ]; then
+        if [ -n "$PULL_IMAGES" ]; then
+            sg docker -c "docker pull ${DOCKER_USER}/ng-ui:${OSM_DOCKER_TAG}" || FATAL "cannot pull ng-ui docker image"
+        elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q NG-UI ; then
+            git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/NG-UI
+            git -C ${LWTEMPDIR}/NG-UI checkout ${COMMIT_ID}
+            sg docker -c "docker build ${LWTEMPDIR}/NG-UI -f ${LWTEMPDIR}/NG-UI/docker/Dockerfile -t ${DOCKER_USER}/ng-ui --no-cache" || FATAL "cannot build NG-UI docker image"
+        fi
+    else
+        if [ -n "$PULL_IMAGES" ]; then
+            sg docker -c "docker pull ${DOCKER_USER}/light-ui:${OSM_DOCKER_TAG}" || FATAL "cannot pull light-ui docker image"
+        elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q LW-UI ; then
+            git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LW-UI
+            git -C ${LWTEMPDIR}/LW-UI checkout ${COMMIT_ID}
+            sg docker -c "docker build ${LWTEMPDIR}/LW-UI -f ${LWTEMPDIR}/LW-UI/docker/Dockerfile -t ${DOCKER_USER}/light-ui --no-cache" || FATAL "cannot build LW-UI docker image"
+        fi
+     fi
 
     if [ -n "$PULL_IMAGES" ]; then
         sg docker -c "docker pull ${DOCKER_USER}/osmclient:${OSM_DOCKER_TAG}" || FATAL "cannot pull osmclient docker image"
@@ -516,7 +535,7 @@ function generate_docker_images() {
 
     if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q PROMETHEUS ; then
         sg docker -c "docker pull google/cadvisor:${PROMETHEUS_CADVISOR_TAG}" || FATAL "cannot get prometheus cadvisor docker image"
-    fi    
+    fi
 
     echo "Finished generation of docker images"
 }
@@ -549,9 +568,15 @@ function generate_docker_env_files() {
     if [ -n "$KUBERNETES" ]; then
         #Kubernetes resources
         $WORKDIR_SUDO cp -bR ${OSM_DEVOPS}/installers/docker/osm_pods $OSM_DOCKER_WORK_DIR
+        [ -n "$NGUI" ] && $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/osm_pods/ng-ui.yaml $OSM_K8S_WORK_DIR/ng-ui.yaml && $WORKDIR_SUDO rm $OSM_K8S_WORK_DIR/light-ui.yaml
     else
-        # Docker-compose
-        $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/docker-compose.yaml $OSM_DOCKER_WORK_DIR/docker-compose.yaml
+        if [ -n "$NGUI" ]; then
+            # For NG-UI
+            $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/docker-compose-ngui.yaml $OSM_DOCKER_WORK_DIR/docker-compose.yaml
+        else
+            # Docker-compose
+            $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/docker-compose.yaml $OSM_DOCKER_WORK_DIR/docker-compose.yaml
+        fi
         if [ -n "$INSTALL_PLA" ]; then
             $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/osm_pla/docker-compose.yaml $OSM_DOCKER_WORK_DIR/osm_pla/docker-compose.yaml
         fi
@@ -762,10 +787,10 @@ function deploy_osm_pla_service() {
 }
 
 function parse_yaml() {
-    osm_services="nbi lcm ro pol mon light-ui keystone"
+    osm_services="nbi lcm ro pol mon light-ui ng-ui keystone"
     TAG=$1
     for osm in $osm_services; do
-        $WORKDIR_SUDO sed -i "s/opensourcemano\/$osm:.*/opensourcemano\/$osm:$TAG/g" $OSM_K8S_WORK_DIR/$osm.yaml
+        $WORKDIR_SUDO sed -i "s/opensourcemano\/$osm:.*/$DOCKER_USER\/$osm:$TAG/g" $OSM_K8S_WORK_DIR/$osm.yaml
     done
 }
 
@@ -1181,6 +1206,7 @@ function dump_vars(){
     echo "OSM_STACK_NAME=$OSM_STACK_NAME"
     echo "PULL_IMAGES=$PULL_IMAGES"
     echo "KUBERNETES=$KUBERNETES"
+    echo "NGUI=$NGUI"
     echo "SHOWOPTS=$SHOWOPTS"
     echo "Install from specific refspec (-b): $COMMIT_ID"
 }
@@ -1223,6 +1249,7 @@ INSTALL_NOLXD=""
 INSTALL_NODOCKER=""
 INSTALL_NOJUJU=""
 KUBERNETES=""
+NGUI=""
 INSTALL_K8S_MONITOR=""
 INSTALL_NOHOSTCLIENT=""
 SESSION_ID=`date +%s`
@@ -1258,7 +1285,7 @@ POD_NETWORK_CIDR=10.244.0.0/16
 K8S_MANIFEST_DIR="/etc/kubernetes/manifests"
 RE_CHECK='^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'
 
-while getopts ":b:r:c:k:u:R:D:o:m:H:S:s:w:t:U:P:A:l:L:K:-: hy" o; do
+while getopts ":b:r:c:n:k:u:R:D:o:m:H:S:s:w:t:U:P:A:l:L:K:-: hy" o; do
     case "${o}" in
         b)
             COMMIT_ID=${OPTARG}
@@ -1274,6 +1301,12 @@ while getopts ":b:r:c:k:u:R:D:o:m:H:S:s:w:t:U:P:A:l:L:K:-: hy" o; do
             echo -e "Invalid argument for -i : ' $OPTARG'\n" >&2
             usage && exit 1
             ;;
+        n)
+            [ "${OPTARG}" == "lwui" ] && continue
+            [ "${OPTARG}" == "ngui" ] && NGUI="y" && continue
+            echo -e "Invalid argument for -n : ' $OPTARG'\n" >&2
+            usage && exit 1
+            ;;
         k)
             REPOSITORY_KEY="${OPTARG}"
             REPO_ARGS+=(-k "$REPOSITORY_KEY")
index 740ce4c..476ee42 100755 (executable)
@@ -30,6 +30,7 @@ function usage(){
     echo -e "                     -b v2.0            (v2.0 branch)"
     echo -e "                     -b tags/v1.1.0     (a specific tag)"
     echo -e "                     ..."
+    echo -e "     -n <ui> install OSM with Next Gen UI. Valid values are <lwui> or <ngui>. If -n is not specified osm will be installed with light-ui. When used with uninstall, osm along with the UI specified will be uninstalled"
     echo -e "     -s <stack name> user defined stack name, default is osm"
     echo -e "     -H <VCA host>   use specific juju host controller IP"
     echo -e "     -S <VCA secret> use VCA/juju secret key"
@@ -109,7 +110,7 @@ if [ $? -eq 0 ]; then
 fi
 }
 
-while getopts ":b:r:c:k:u:R:l:L:K:p:D:o:m:H:S:s:w:t:U:P:A:-: hy" o; do
+while getopts ":b:r:c:n:k:u:R:l:L:K:p:D:o:m:H:S:s:w:t:U:P:A:-: hy" o; do
     case "${o}" in
         r)
             REPOSITORY="${OPTARG}"
index 153abcb..0dfea86 100644 (file)
@@ -135,7 +135,7 @@ node("${params.NODE}") {
             // grab all stable upstream builds based on the
 
             dir("${RELEASE}") {
-                def list = ["RO", "openvim", "osmclient", "IM", "devops", "MON", "N2VC", "NBI", "common", "LCM", "POL", "LW-UI"]
+                def list = ["RO", "openvim", "osmclient", "IM", "devops", "MON", "N2VC", "NBI", "common", "LCM", "POL", "LW-UI","NG-UI"]
                 for (component in list) {
                     step ([$class: 'CopyArtifact',
                            projectName: "${component}${upstream_main_job}/${GERRIT_BRANCH}"])