X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Ffull_install_osm.sh;h=93a111282e497cf8fae7864b8b4c30295d42522f;hb=ee374147ebe6269991d885cc8b6a3d8bd7d0f9a2;hp=d680f9b8e563ffb2f43f230fcd5a016d3d10f905;hpb=e2aebfe8b270dd78cfed20f7358b574c5aaee6d9;p=osm%2Fdevops.git diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index d680f9b8..93a11128 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -30,7 +30,7 @@ function usage(){ 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 : install OSM but only rebuild the specified docker images (RO, LCM, NBI, LW-UI, MON, KAFKA, MONGO, NONE)" - echo -e " -o : do not install OSM, but ONLY one of the addons (vimemu, elk_stack, pm_stack) (assumes OSM is already installed)" + echo -e " -o : ONLY (un)installs one of the addons (vimemu, elk_stack, pm_stack)" echo -e " -D use local devops installation path" echo -e " --nolxd: do not install and configure LXD, allowing unattended installations (assumes LXD is already installed and confifured)" echo -e " --nodocker: do not install docker, do not initialize a swarm (assumes docker is already installed and a swarm has been initialized)" @@ -98,24 +98,43 @@ function remove_stack() { #Uninstall lightweight OSM: remove dockers function uninstall_lightweight() { - echo -e "\nUninstalling lightweight OSM" - remove_stack osm - echo "Now osm docker images and volumes will be deleted" - newgrp docker << EONG - docker image rm osm/ro - docker image rm osm/lcm - docker image rm osm/light-ui - docker image rm osm/nbi - docker image rm osm/mon - docker image rm osm/pm - docker volume rm osm_mon_db - docker volume rm osm_mongo_db - docker volume rm osm_osm_packages - docker volume rm osm_ro_db + if [ -n "$INSTALL_ONLY" ]; then + if [ -n "$INSTALL_ELK" ]; then + echo -e "\nUninstalling OSM ELK stack" + remove_stack osm_elk + sudo rm -rf /etc/osm/docker/osm_elk + fi + if [ -n "$INSTALL_PERFMON" ]; then + echo -e "\nUninstalling OSM Performance Monitoring stack" + remove_stack osm_metrics + sg docker -c "docker image rm osm/kafka-exporter" + sudo rm -rf /etc/osm/docker/osm_metrics + fi + else + echo -e "\nUninstalling OSM" + remove_stack osm + remove_stack osm_elk + remove_stack osm_metrics + echo "Now osm docker images and volumes will be deleted" + newgrp docker << EONG + docker image rm osm/ro + docker image rm osm/lcm + docker image rm osm/light-ui + docker image rm osm/nbi + docker image rm osm/mon + docker image rm osm/pm + docker image rm osm/kafka-exporter + docker volume rm osm_mon_db + docker volume rm osm_mongo_db + docker volume rm osm_osm_packages + docker volume rm osm_ro_db EONG - echo "Removing /etc/osm and /var/log/osm files" - rm -rf /etc/osm - rm -rf /var/log/osm + echo "Removing /etc/osm and /var/log/osm files" + sudo rm -rf /etc/osm + sudo rm -rf /var/log/osm + fi + echo "Some docker images will be kept in case they are used by other docker stacks" + echo "To remove them, just run 'docker image prune' in a terminal" return 0 } @@ -567,6 +586,11 @@ function install_juju() { function generate_docker_images() { echo "Pulling and generating docker images" + _build_from=$COMMIT_ID + [ -z "$_build_from" ] && _build_from="master" + + echo "OSM Docker images generated from $_build_from" + if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q KAFKA ; then sg docker -c "docker pull wurstmeister/zookeeper" || FATAL "cannot get zookeeper docker image" sg docker -c "docker pull wurstmeister/kafka" || FATAL "cannot get kafka docker image" @@ -979,20 +1003,6 @@ fi # if develop, we force master [ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master" -# forcing source from master removed. Now only install from source when explicit -# [ -n "$COMMIT_ID" ] && [ "$COMMIT_ID" == "master" ] && INSTALL_FROM_SOURCE="y" - -if [ -z "$OSM_DEVOPS" ]; then - if [ -n "$TEST_INSTALLER" ]; then - echo -e "\nUsing local devops repo for OSM installation" - TEMPDIR="$(dirname $(realpath $(dirname $0)))" - else - echo -e "\nCreating temporary dir for OSM installation" - TEMPDIR="$(mktemp -d -q --tmpdir "installosm.XXXXXX")" - trap 'rm -rf "$TEMPDIR"' EXIT - fi -fi - need_packages="git jq wget curl tar" echo -e "Checking required packages: $need_packages" dpkg -l $need_packages &>/dev/null \ @@ -1005,25 +1015,28 @@ dpkg -l $need_packages &>/dev/null \ || FATAL "failed to install $need_packages" if [ -z "$OSM_DEVOPS" ]; then - if [ -z "$TEST_INSTALLER" ]; then - echo -e "\nCloning devops repo temporarily" - git clone https://osm.etsi.org/gerrit/osm/devops.git $TEMPDIR - RC_CLONE=$? - fi + if [ -n "$TEST_INSTALLER" ]; then + echo -e "\nUsing local devops repo for OSM installation" + OSM_DEVOPS="$(dirname $(realpath $(dirname $0)))" + else + echo -e "\nCreating temporary dir for OSM installation" + OSM_DEVOPS="$(mktemp -d -q --tmpdir "installosm.XXXXXX")" + trap 'rm -rf "$OSM_DEVOPS"' EXIT + + git clone https://osm.etsi.org/gerrit/osm/devops.git $OSM_DEVOPS - echo -e "\nGuessing the current stable release" - LATEST_STABLE_DEVOPS=`git -C $TEMPDIR tag -l v[0-9].* | sort -V | tail -n1` - [ -z "$COMMIT_ID" ] && [ -z "$LATEST_STABLE_DEVOPS" ] && echo "Could not find the current latest stable release" && exit 0 - echo "Latest tag in devops repo: $LATEST_STABLE_DEVOPS" - [ -z "$COMMIT_ID" ] && [ -n "$LATEST_STABLE_DEVOPS" ] && COMMIT_ID="tags/$LATEST_STABLE_DEVOPS" - - if [ -n "$RELEASE_DAILY" ]; then - echo "Using master/HEAD devops" - git -C $TEMPDIR checkout master - elif [ -z "$TEST_INSTALLER" ]; then - git -C $TEMPDIR checkout tags/$LATEST_STABLE_DEVOPS + if [ -z "$COMMIT_ID" ]; then + echo -e "\nGuessing the current stable release" + LATEST_STABLE_DEVOPS=`git -C $OSM_DEVOPS tag -l v[0-9].* | sort -V | tail -n1` + [ -z "$LATEST_STABLE_DEVOPS" ] && echo "Could not find the current latest stable release" && exit 0 + + echo "Latest tag in devops repo: $LATEST_STABLE_DEVOPS" + COMMIT_ID="tags/$LATEST_STABLE_DEVOPS" + else + echo -e "\nDEVOPS Using commit $COMMIT_ID" + fi + git -C $OSM_DEVOPS checkout $COMMIT_ID fi - OSM_DEVOPS=$TEMPDIR fi OSM_JENKINS="$OSM_DEVOPS/jenkins"