X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Ffull_install_osm.sh;h=0573759cf4e6ce438c17caf6c067300d583005ff;hb=70502ad95df25efa50b3e086d700bfd48106f10d;hp=2f124011b85cffa0c6151e2b9d44e0432f2d071f;hpb=c119fb304ecd4d1085fa14b5f2ef288d4713a379;p=osm%2Fdevops.git diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index 2f124011..0573759c 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -31,16 +31,17 @@ function usage(){ echo -e " --pm_stack: additionally deploy a Prometheus+Grafana stack for performance monitoring (PM)" 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 " -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 " --uninstall: uninstall OSM: remove the containers and delete NAT rules" echo -e " --source: install OSM from source code using the latest stable tag" - echo -e " --lxdimages: download lxd images from OSM repository instead of creating them from scratch" - echo -e " -l : use specified repository url for lxd images" - echo -e " -p : use specified repository path for lxd images" - echo -e " --soui: install classic build of OSM (Rel THREE v3.1, based on LXD containers, with SO and UI)" echo -e " --develop: (deprecated, use '-b master') install OSM from source code using the master branch" + echo -e " --soui: install classic build of OSM (Rel THREE v3.1, based on LXD containers, with SO and UI)" + echo -e " --lxdimages: (only for Rel THREE with --soui) download lxd images from OSM repository instead of creating them from scratch" + echo -e " -l : (only for Rel THREE with --soui) use specified repository url for lxd images" + echo -e " -p : (only for Rel THREE with --soui) use specified repository path for lxd images" # echo -e " --reconfigure: reconfigure the modules (DO NOT change NAT rules)" - echo -e " --nat: install only NAT rules" - echo -e " --noconfigure: DO NOT install osmclient, DO NOT install NAT rules, DO NOT configure modules" + echo -e " --nat: (only for Rel THREE with --soui) install only NAT rules" + echo -e " --noconfigure: (only for Rel THREE with --soui) DO NOT install osmclient, DO NOT install NAT rules, DO NOT configure modules" # echo -e " --update: update to the latest stable release or to the latest commit if using a specific branch" echo -e " --showopts: print chosen options and exit (only for debugging)" echo -e " -y: do not prompt for confirmation, assumes yes" @@ -110,6 +111,9 @@ function uninstall_lightweight() { 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 return 0 } @@ -553,7 +557,7 @@ function install_docker_compose() { function install_juju() { echo "Installing juju" sudo snap install juju --classic - sudo dpkg-reconfigure -p medium lxd + [ -z "$INSTALL_NOLXD" ] && sudo dpkg-reconfigure -p medium lxd sg lxd -c "juju bootstrap --bootstrap-series=xenial localhost osm" [ $(sg lxd -c "juju status" |grep "osm" |wc -l) -eq 1 ] || FATAL "Juju installation failed" echo "Finished installation of juju" @@ -591,9 +595,9 @@ function cmp_overwrite() { file2="$2" if ! $(cmp "${file1}" "${file2}" >/dev/null 2>&1); then if [ -f "${file2}" ]; then - ask_user "The file ${file2} already exists. Overwrite (y/N)? " n && sudo cp -f ${file1} ${file2} + ask_user "The file ${file2} already exists. Overwrite (y/N)? " n && sudo cp -b ${file1} ${file2} else - sudo cp ${file1} ${file2} + sudo cp -b ${file1} ${file2} fi fi } @@ -601,15 +605,13 @@ function cmp_overwrite() { function generate_config_log_folders() { echo "Generating config and log folders" sudo mkdir -p /etc/osm/docker - sudo cp ${DEVOPS}/installers/docker/docker-compose.yaml /etc/osm/docker/docker-compose.yaml + sudo cp -b ${DEVOPS}/installers/docker/docker-compose.yaml /etc/osm/docker/docker-compose.yaml sudo mkdir -p /var/log/osm echo "Finished generation of config and log folders" } function generate_docker_env_files() { echo "Generating docker env files" - OSMLCM_VCA_HOST=`sg lxd -c "juju show-controller"|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'` - OSMLCM_VCA_SECRET=`grep password ${HOME}/.local/share/juju/accounts.yaml |awk '{print $2}'` echo "OSMLCM_VCA_HOST=${OSMLCM_VCA_HOST}" |sudo tee /etc/osm/docker/lcm.env echo "OSMLCM_VCA_SECRET=${OSMLCM_VCA_SECRET}" |sudo tee -a /etc/osm/docker/lcm.env MYSQL_ROOT_PASSWORD=`date +%s | sha256sum | base64 | head -c 32` @@ -641,7 +643,7 @@ function deploy_lightweight() { function deploy_elk() { sudo mkdir -p /etc/osm/docker/osm_elk - sudo cp ${DEVOPS}/installers/docker/osm_elk/* /etc/osm/docker/osm_elk + sudo cp -b ${DEVOPS}/installers/docker/osm_elk/* /etc/osm/docker/osm_elk remove_stack osm_elk echo "Deploying ELK stack" sg docker -c "docker stack deploy -c /etc/osm/docker/osm_elk/docker-compose.yml osm_elk" @@ -687,8 +689,8 @@ function deploy_perfmon() { sg docker -c "docker build ${OSM_DEVOPS}/installers/docker/osm_metrics/kafka-exporter -f ${OSM_DEVOPS}/installers/docker/osm_metrics/kafka-exporter/Dockerfile -t osm/kafka-exporter --no-cache" || FATAL "cannot build kafka-exporter docker image" echo "Finished generation of osm/kafka-exporter docker image" sudo mkdir -p /etc/osm/docker/osm_metrics - sudo cp ${DEVOPS}/installers/docker/osm_metrics/*.yml /etc/osm/docker/osm_metrics - sudo cp ${DEVOPS}/installers/docker/osm_metrics/*.json /etc/osm/docker/osm_metrics + sudo cp -b ${DEVOPS}/installers/docker/osm_metrics/*.yml /etc/osm/docker/osm_metrics + sudo cp -b ${DEVOPS}/installers/docker/osm_metrics/*.json /etc/osm/docker/osm_metrics remove_stack osm_metrics echo "Deploying PM stack (Kafka exporter + Prometheus + Grafana)" sg docker -c "docker stack deploy -c /etc/osm/docker/osm_metrics/docker-compose.yml osm_metrics" @@ -704,17 +706,23 @@ function install_lightweight() { DEFAULT_IF=`route -n |awk '$1~/^0.0.0.0/ {print $8}'` DEFAULT_IP=`ip -o -4 a |grep ${DEFAULT_IF}|awk '{split($4,a,"/"); print a[1]}'` DEFAULT_MTU=$(ip addr show ${DEFAULT_IF} | perl -ne 'if (/mtu\s(\d+)/) {print $1;}') - need_packages_lw="lxd" - echo -e "Checking required packages: $need_packages_lw" - dpkg -l $need_packages_lw &>/dev/null \ - || ! echo -e "One or several required packages are not installed. Updating apt cache requires root privileges." \ - || sudo apt-get update \ - || FATAL "failed to run apt-get update" - dpkg -l $need_packages_lw &>/dev/null \ - || ! echo -e "Installing $need_packages_lw requires root privileges." \ - || sudo apt-get install -y $need_packages_lw \ - || FATAL "failed to install $need_packages_lw" + if [ -z "$INSTALL_NOLXD" ]; then + need_packages_lw="lxd" + echo -e "Checking required packages: $need_packages_lw" + dpkg -l $need_packages_lw &>/dev/null \ + || ! echo -e "One or several required packages are not installed. Updating apt cache requires root privileges." \ + || sudo apt-get update \ + || FATAL "failed to run apt-get update" + dpkg -l $need_packages_lw &>/dev/null \ + || ! echo -e "Installing $need_packages_lw requires root privileges." \ + || sudo apt-get install -y $need_packages_lw \ + || FATAL "failed to install $need_packages_lw" + fi install_juju + OSMLCM_VCA_HOST=`sg lxd -c "juju show-controller"|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'` + OSMLCM_VCA_SECRET=`grep password ${HOME}/.local/share/juju/accounts.yaml |awk '{print $2}'` + [ -z "$OSMLCM_VCA_HOST" ] && FATAL "Cannot obtain juju controller IP address" + [ -z "$OSMLCM_VCA_SECRET" ] && FATAL "Cannot obtain juju secret" track juju install_docker_ce track docker_ce @@ -781,6 +789,7 @@ function dump_vars(){ echo "INSTALL_ONLY=$INSTALL_ONLY" echo "INSTALL_ELK=$INSTALL_ELK" echo "INSTALL_PERFMON=$INSTALL_PERFMON" + echo "INSTALL_NOLXD=$INSTALL_NOLXD" echo "RELEASE=$RELEASE" echo "REPOSITORY=$REPOSITORY" echo "REPOSITORY_BASE=$REPOSITORY_BASE" @@ -815,7 +824,7 @@ SHOWOPTS="" COMMIT_ID="" ASSUME_YES="" INSTALL_FROM_SOURCE="" -RELEASE="-R ReleaseTHREE" +RELEASE="-R ReleaseFOUR" REPOSITORY="-r stable" INSTALL_VIMEMU="" INSTALL_FROM_LXDIMAGES="" @@ -825,6 +834,7 @@ INSTALL_LIGHTWEIGHT="y" INSTALL_ONLY="" INSTALL_ELK="" INSTALL_PERFMON="" +INSTALL_NOLXD="" NOCONFIGURE="" RELEASE_DAILY="" SESSION_ID=`date +%s` @@ -875,6 +885,7 @@ while getopts ":hy-:b:r:k:u:R:l:p:D:o:" o; do [ "${OPTARG}" == "reconfigure" ] && RECONFIGURE="y" && continue [ "${OPTARG}" == "test" ] && TEST_INSTALLER="y" && continue [ "${OPTARG}" == "lxdinstall" ] && INSTALL_LXD="y" && continue + [ "${OPTARG}" == "nolxd" ] && INSTALL_NOLXD="y" && continue [ "${OPTARG}" == "lxdimages" ] && INSTALL_FROM_LXDIMAGES="y" && continue [ "${OPTARG}" == "lightweight" ] && INSTALL_LIGHTWEIGHT="y" && continue [ "${OPTARG}" == "soui" ] && INSTALL_LIGHTWEIGHT="" && RELEASE="-R ReleaseTHREE" && REPOSITORY="-r stable" && continue @@ -903,6 +914,8 @@ done [ -n "$INSTALL_FROM_LXDIMAGES" ] && [ -n "$INSTALL_LIGHTWEIGHT" ] && FATAL "Incompatible options: --lxd can only be used with --soui" [ -n "$NAT" ] && [ -n "$INSTALL_LIGHTWEIGHT" ] && FATAL "Incompatible options: --nat can only be used with --soui" [ -n "$NOCONFIGURE" ] && [ -n "$INSTALL_LIGHTWEIGHT" ] && FATAL "Incompatible options: --noconfigure can only be used with --soui" +[ -n "$RELEASE_DAILY" ] && [ -n "$INSTALL_LIGHTWEIGHT" ] && FATAL "Incompatible options: --daily can only be used with --soui" +[ -n "$INSTALL_NOLXD" ] && [ -z "$INSTALL_LIGHTWEIGHT" ] && FATAL "Incompatible option: --nolxd cannot be used with --soui" if [ -n "$SHOWOPTS" ]; then dump_vars