increase start period at RO docker healthcheck
[osm/devops.git] / installers / full_install_osm.sh
index b3df588..c636326 100755 (executable)
@@ -32,7 +32,7 @@ function usage(){
     echo -e "     --vimemu:       additionally deploy the VIM emulator as a docker container"
     echo -e "     --elk_stack:    additionally deploy an ELK docker stack for event logging"
     echo -e "     --pm_stack:     additionally deploy a Prometheus+Grafana stack for performance monitoring (PM)"
-    echo -e "     -m <MODULE>:    install OSM but only rebuild the specified docker images (RO, LCM, NBI, LW-UI, MON, KAFKA, MONGO, NONE)"
+    echo -e "     -m <MODULE>:    install OSM but only rebuild the specified docker images (RO, LCM, NBI, LW-UI, MON, POL, KAFKA, MONGO, PROMETHEUS, KEYSTONE-DB, NONE)"
     echo -e "     -o <ADDON>:     ONLY (un)installs one of the addons (vimemu, elk_stack, pm_stack)"
     echo -e "     -D <devops path> use local devops installation path"
     echo -e "     -w <work dir>   Location to store runtime installation"
@@ -542,8 +542,8 @@ function install_osmclient(){
     sudo add-apt-repository -y "deb [arch=amd64] $CLIENT_REPOSITORY_BASE/$CLIENT_RELEASE $CLIENT_REPOSITORY osmclient"
     sudo apt-get update
     sudo apt-get install -y python-pip
-    sudo -H pip install pip==9.0.3
-    sudo -H pip install python-magic
+    sudo -H LC_ALL=C pip install pip==9.0.3
+    sudo -H LC_ALL=C pip install python-magic
     sudo apt-get install -y python-osmclient
     #sed 's,OSM_SOL005=[^$]*,OSM_SOL005=True,' -i ${HOME}/.bashrc
     #echo 'export OSM_HOSTNAME=localhost' >> ${HOME}/.bashrc
@@ -667,10 +667,14 @@ function generate_docker_images() {
         sg docker -c "docker pull prom/prometheus:${PROMETHEUS_TAG}" || FATAL "cannot get prometheus docker image"
     fi
 
-    if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q KEYSTONE-DB ; then
+    if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q NBI || echo $TO_REBUILD | grep -q KEYSTONE-DB ; then
         sg docker -c "docker pull mariadb:${KEYSTONEDB_TAG}" || FATAL "cannot get keystone-db docker image"
     fi
 
+    if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q RO ; then
+        sg docker -c "docker pull mysql:5" || FATAL "cannot get mysql docker image"
+    fi
+
     if [ -n "$PULL_IMAGES" ]; then
         sg docker -c "docker pull ${DOCKER_USER}/mon:${OSM_DOCKER_TAG}" || FATAL "cannot pull MON docker image"
     elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q MON ; then
@@ -681,10 +685,10 @@ function generate_docker_images() {
 
     if [ -n "$PULL_IMAGES" ]; then
         sg docker -c "docker pull ${DOCKER_USER}/pol:${OSM_DOCKER_TAG}" || FATAL "cannot pull POL docker image"
-    elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q MON ; then
+    elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q POL ; then
         git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/POL
         git -C ${LWTEMPDIR}/POL checkout ${COMMIT_ID}
-        sg docker -c "docker build ${LWTEMPDIR}/POL -f ${LWTEMPDIR}/POL/docker/Dockerfile -t ${DOCKER_USER}/pol --no-cache" || FATAL "cannot build PM docker image"
+        sg docker -c "docker build ${LWTEMPDIR}/POL -f ${LWTEMPDIR}/POL/docker/Dockerfile -t ${DOCKER_USER}/pol --no-cache" || FATAL "cannot build POL docker image"
     fi
 
     if [ -n "$PULL_IMAGES" ]; then
@@ -700,7 +704,6 @@ function generate_docker_images() {
     if [ -n "$PULL_IMAGES" ]; then
         sg docker -c "docker pull ${DOCKER_USER}/ro:${OSM_DOCKER_TAG}" || FATAL "cannot pull RO docker image"
     elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q RO ; then
-        sg docker -c "docker pull mysql:5" || FATAL "cannot get mysql docker image"
         git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/RO
         git -C ${LWTEMPDIR}/RO checkout ${COMMIT_ID}
         sg docker -c "docker build ${LWTEMPDIR}/RO -f ${LWTEMPDIR}/RO/docker/Dockerfile-local -t ${DOCKER_USER}/ro --no-cache" || FATAL "cannot build RO docker image"
@@ -959,7 +962,9 @@ function install_lightweight() {
     [ "${OSM_STACK_NAME}" == "osm" ] || OSM_DOCKER_WORK_DIR="$OSM_WORK_DIR/stack/$OSM_STACK_NAME"
     [ ! -d "$OSM_DOCKER_WORK_DIR" ] && $WORKDIR_SUDO mkdir -p $OSM_DOCKER_WORK_DIR
 
+    track checkingroot
     [ "$USER" == "root" ] && FATAL "You are running the installer as root. The installer is prepared to be executed as a normal user with sudo privileges."
+    track noroot
     [ -z "$ASSUME_YES" ] && ! ask_user "The installation will configure LXD, install juju, install docker CE and init a docker swarm, as pre-requirements. Do you want to proceed (Y/n)? " y && echo "Cancelled!" && exit 1
     track proceed
     echo "Installing lightweight build of OSM"
@@ -987,11 +992,13 @@ function install_lightweight() {
     track prereqok
     [ -z "$INSTALL_NOJUJU" ] && install_juju
 
+    track juju_install
     if [ -z "$OSM_VCA_HOST" ]; then
         juju_createcontroller
         OSM_VCA_HOST=`sg lxd -c "juju show-controller $OSM_STACK_NAME"|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'`
         [ -z "$OSM_VCA_HOST" ] && FATAL "Cannot obtain juju controller IP address"
     fi
+    track juju_controller
     if [ -z "$OSM_VCA_SECRET" ]; then
         OSM_VCA_SECRET=$(parse_juju_password $OSM_STACK_NAME)
         [ -z "$OSM_VCA_SECRET" ] && FATAL "Cannot obtain juju secret"
@@ -1007,6 +1014,7 @@ function install_lightweight() {
     track docker_ce
     #install_docker_compose
     [ -n "$INSTALL_NODOCKER" ] || init_docker_swarm
+    track docker_swarm
     [ -z "$DOCKER_NOBUILD" ] && generate_docker_images
     track docker_build
     generate_docker_env_files