X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Ffull_install_osm.sh;h=d2f5e5248210625f3d50f22794731a772875bd1a;hb=e38e8b15aee8668b14530152a3683e8f1cb79a86;hp=75949846a3e29652e80b96c4ead152731b5bdb6a;hpb=4aad47b0f1921b272746c7ab5e4a4d740f2a6112;p=osm%2Fdevops.git diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index 75949846..d2f5e524 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -67,13 +67,12 @@ function usage(){ echo -e " --pullimages: pull/run osm images from docker.io/opensourcemano" echo -e " --k8s_monitor: install the OSM kubernetes monitoring with prometheus and grafana" echo -e " --volume: create a VM volume when installing to OpenStack" -# echo -e " --reconfigure: reconfigure the modules (DO NOT change NAT rules)" -# 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 " --charmed: Deploy and operate OSM with Charms on k8s" echo -e " [--bundle ]: Specify with which bundle to deploy OSM with charms (--charmed option)" echo -e " [--k8s ]: Specify with which kubernetes to deploy OSM with charms (--charmed option)" echo -e " [--vca ]: Specifies the name of the controller to use - The controller must be already bootstrapped (--charmed option)" + echo -e " [--small-profile]: Do not install and configure LXD which aims to use only K8s Clouds (--charmed option)" echo -e " [--lxd ]: Takes a YAML file as a parameter with the LXD Cloud information (--charmed option)" echo -e " [--lxd-cred ]: Takes a YAML file as a parameter with the LXD Credentials information (--charmed option)" echo -e " [--microstack]: Installs microstack as a vim. (--charmed option)" @@ -143,10 +142,12 @@ function check_packages() { NEEDED_PACKAGES="$1" echo -e "Checking required packages: ${NEEDED_PACKAGES}" for PACKAGE in ${NEEDED_PACKAGES} ; do - dpkg -L ${PACKAGE} &>/dev/null + dpkg -L ${PACKAGE} if [ $? -ne 0 ]; then - echo -e "Package ${PACKAGE} is not installed. Updating apt" + echo -e "Package ${PACKAGE} is not installed." + echo -e "Updating apt-cache ..." sudo apt-get update + echo -e "Installing ${PACKAGE} ..." sudo apt-get install -y ${PACKAGE} || FATAL "failed to install ${PACKAGE}" fi done @@ -161,7 +162,12 @@ function install_lxd() { # Install LXD snap sudo apt-get remove --purge -y liblxc1 lxc-common lxcfs lxd lxd-client - sudo snap install lxd --channel $LXD_VERSION/stable + snap info lxd | grep installed > /dev/null + if [ $? -eq 0 ]; then + sudo snap refresh lxd --channel $LXD_VERSION/stable + else + sudo snap install lxd --channel $LXD_VERSION/stable + fi # Configure LXD sudo usermod -a -G lxd `whoami` @@ -214,7 +220,7 @@ function install_osmclient(){ python3 -m pip install -r /usr/lib/python3/dist-packages/osm_im/requirements.txt fi if [ -f /usr/lib/python3/dist-packages/osmclient/requirements.txt ]; then - sudo apt-get install -y libcurl4-openssl-dev libssl-dev + sudo apt-get install -y libcurl4-openssl-dev libssl-dev libmagic1 python3 -m pip install -r /usr/lib/python3/dist-packages/osmclient/requirements.txt fi [ -z "$INSTALL_LIGHTWEIGHT" ] && export OSM_HOSTNAME=`lxc list | awk '($2=="SO-ub"){print $6}'` @@ -253,10 +259,6 @@ function generate_docker_images() { sg docker -c "docker pull wurstmeister/kafka:${KAFKA_TAG}" || FATAL "cannot get kafka docker image" fi - if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q MONGO ; then - sg docker -c "docker pull mongo" || FATAL "cannot get mongo docker image" - fi - if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q PROMETHEUS ; then sg docker -c "docker pull prom/prometheus:${PROMETHEUS_TAG}" || FATAL "cannot get prometheus docker image" fi @@ -267,6 +269,7 @@ function generate_docker_images() { if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q GRAFANA ; then sg docker -c "docker pull grafana/grafana:${GRAFANA_TAG}" || FATAL "cannot get grafana docker image" + sg docker -c "docker pull kiwigrid/k8s-sidecar:${KIWIGRID_K8S_SIDECAR_TAG}" || FATAL "cannot get kiwigrid k8s-sidecar docker image" fi if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q NBI || echo $TO_REBUILD | grep -q KEYSTONE-DB ; then @@ -340,7 +343,6 @@ function generate_k8s_manifest_files() { [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function #Kubernetes resources sudo cp -bR ${OSM_DEVOPS}/installers/docker/osm_pods $OSM_DOCKER_WORK_DIR - sudo rm -f $OSM_K8S_WORK_DIR/mongo.yaml [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } @@ -571,7 +573,7 @@ function update_manifest_files() { list_of_services="$list_of_services $module" fi done - if [ ! "$OSM_DOCKER_TAG" == "11" ]; then + if [ ! "$OSM_DOCKER_TAG" == "12" ]; then parse_yaml $OSM_DOCKER_TAG $list_of_services fi if [ -n "$MODULE_DOCKER_TAG" ]; then @@ -627,6 +629,10 @@ EOF" function install_osm() { [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function + + trap ctrl_c INT + track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type $OSM_INSTALLATION_TYPE none none + track checks checkingroot_ok [ "$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 checks noroot_ok @@ -655,7 +661,6 @@ function install_osm() { # if no host is passed in, we need to install lxd/juju, unless explicilty asked not to if [ -z "$OSM_VCA_HOST" ] && [ -z "$INSTALL_NOLXD" ] && [ -z "$LXD_CLOUD_FILE" ]; then - check_packages "snapd" install_lxd fi @@ -735,7 +740,7 @@ function install_osm() { add_local_k8scluster track final_ops add_local_k8scluster_ok - wget -q -O- https://osm-download.etsi.org/ftp/osm-11.0-eleven/README2.txt &> /dev/null + wget -q -O- https://osm-download.etsi.org/ftp/osm-12.0-twelve/README2.txt &> /dev/null track end sudo find /etc/osm [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function @@ -834,6 +839,8 @@ function dump_vars(){ echo "OPENSTACK_VM_NAME"="$OPENSTACK_VM_NAME" echo "OSM_DEVOPS=$OSM_DEVOPS" echo "OSM_DOCKER_TAG=$OSM_DOCKER_TAG" + echo "OSM_DOCKER_WORK_DIR=$OSM_DOCKER_WORK_DIR" + echo "OSM_K8S_WORK_DIR=$OSM_K8S_WORK_DIR" echo "OSM_STACK_NAME=$OSM_STACK_NAME" echo "OSM_VCA_HOST=$OSM_VCA_HOST" echo "OSM_VCA_PUBKEY=$OSM_VCA_PUBKEY" @@ -862,9 +869,16 @@ function parse_docker_registry_url() { [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } -LXD_VERSION=4.0 +function ctrl_c() { + [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function + echo "** Trapped CTRL-C" + FATAL "User stopped the installation" + [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function +} + +LXD_VERSION=5.0 JUJU_VERSION=2.9 -JUJU_AGENT_VERSION=2.9.17 +JUJU_AGENT_VERSION=2.9.29 UNINSTALL="" DEVELOP="" UPDATE="" @@ -920,8 +934,9 @@ OSM_DOCKER_TAG=latest DOCKER_USER=opensourcemano PULL_IMAGES="y" KAFKA_TAG=2.11-1.0.2 -PROMETHEUS_TAG=v2.4.3 -GRAFANA_TAG=latest +KIWIGRID_K8S_SIDECAR_TAG="1.15.6" +PROMETHEUS_TAG=v2.28.1 +GRAFANA_TAG=8.1.1 PROMETHEUS_NODE_EXPORTER_TAG=0.18.1 PROMETHEUS_CADVISOR_TAG=latest KEYSTONEDB_TAG=10 @@ -1070,6 +1085,7 @@ while getopts ":a:b:r:n:k:u:R:D:o:O:m:N:H:S:s:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o; [ "${OPTARG}" == "microstack" ] && continue [ "${OPTARG}" == "overlay" ] && continue [ "${OPTARG}" == "only-vca" ] && continue + [ "${OPTARG}" == "small-profile" ] && continue [ "${OPTARG}" == "vca" ] && continue [ "${OPTARG}" == "ha" ] && continue [ "${OPTARG}" == "tag" ] && continue @@ -1109,7 +1125,6 @@ source $OSM_DEVOPS/common/all_funcs # Uninstall if "--uninstall" if [ -n "$UNINSTALL" ]; then if [ -n "$CHARMED" ]; then - track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type $OSM_INSTALLATION_TYPE none none ${OSM_DEVOPS}/installers/charmed_uninstall.sh -R $RELEASE -r $REPOSITORY -u $REPOSITORY_BASE -D $OSM_DEVOPS -t $DOCKER_TAG "$@" || \ FATAL_TRACK charmed_uninstall "charmed_uninstall.sh failed" else @@ -1122,8 +1137,12 @@ fi # Charmed installation if [ -n "$CHARMED" ]; then - ${OSM_DEVOPS}/installers/charmed_install.sh -R $RELEASE -r $REPOSITORY -u $REPOSITORY_BASE -D $OSM_DEVOPS -t $DOCKER_TAG "$@" || \ + export OSM_TRACK_INSTALLATION_ID="$(date +%s)-$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16)" + track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type $OSM_INSTALLATION_TYPE none none + ${OSM_DEVOPS}/installers/charmed_install.sh --tag $OSM_DOCKER_TAG "$@" || \ FATAL_TRACK charmed_install "charmed_install.sh failed" + wget -q -O- https://osm-download.etsi.org/ftp/osm-12.0-twelve/README2.txt &> /dev/null + track end installation_type $OSM_INSTALLATION_TYPE echo -e "\nDONE" exit 0 fi @@ -1143,7 +1162,7 @@ fi # if develop, we force master [ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master" -check_packages "git wget curl tar" +check_packages "git wget curl tar snapd" sudo snap install jq if [ -z "$OSM_DEVOPS" ]; then @@ -1177,12 +1196,8 @@ OSM_K8S_WORK_DIR="$OSM_DOCKER_WORK_DIR/osm_pods" && OSM_NAMESPACE_VOL="${OSM_HOS [ -n "$INSTALL_ONLY" ] && echo -e "\nDONE" && exit 0 #Installation starts here -wget -q -O- https://osm-download.etsi.org/ftp/osm-11.0-eleven/README.txt &> /dev/null +wget -q -O- https://osm-download.etsi.org/ftp/osm-12.0-twelve/README.txt &> /dev/null export OSM_TRACK_INSTALLATION_ID="$(date +%s)-$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16)" - -track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type $OSM_INSTALLATION_TYPE none none - install_osm echo -e "\nDONE" exit 0 -