key_location=$CLIENT_REPOSITORY_BASE/$CLIENT_RELEASE/$CLIENT_REPOSITORY_KEY
curl $key_location | sudo APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add -
sudo add-apt-repository -y "deb [arch=amd64] $CLIENT_REPOSITORY_BASE/$CLIENT_RELEASE $CLIENT_REPOSITORY osmclient IM"
- sudo apt-get update
- sudo apt-get install -y python3-pip
+ sudo apt-get -y update
+ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3-pip
sudo -H LC_ALL=C python3 -m pip install -U pip
sudo -H LC_ALL=C python3 -m pip install -U python-magic pyangbind verboselogs
- sudo apt-get install -y python3-osm-im python3-osmclient
+ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3-osm-im python3-osmclient
if [ -f /usr/lib/python3/dist-packages/osm_im/requirements.txt ]; then
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 libmagic1
+ sudo DEBIAN_FRONTEND=noninteractive 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}'`
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
}
-function create_k8s_secret_regcred() {
- [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
- echo "Creating K8s secret regcred with the docker registry credentials from $HOME/.docker/config.json"
- kubectl -n osm create secret generic regcred \
- --from-file=.dockerconfigjson=$HOME/.docker/config.json \
- --type=kubernetes.io/dockerconfigjson
- [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
-}
-
function pull_docker_images() {
[ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
echo "Pulling docker images"
- if [ -n "${DOCKER_REGISTRY_URL}" ]; then
- docker_login
- create_k8s_secret_registrycreds
- fi
+ [ -n "${DOCKER_REGISTRY_URL}" ] && docker_login
echo "Pulling non-OSM docker images"
- 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:${KAFKA_TAG}" || FATAL "cannot get kafka 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
-
- if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q PROMETHEUS-CADVISOR ; then
- sg docker -c "docker pull google/cadvisor:${PROMETHEUS_CADVISOR_TAG}" || FATAL "cannot get prometheus cadvisor docker image"
- fi
-
- 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
- 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
-
- list_of_modules="MON NBI KEYSTONE RO LCM NG-UI osmclient"
+ sg docker -c "docker pull wurstmeister/zookeeper" || FATAL "cannot get zookeeper docker image"
+ sg docker -c "docker pull wurstmeister/kafka:${KAFKA_TAG}" || FATAL "cannot get kafka docker image"
+ sg docker -c "docker pull prom/prometheus:${PROMETHEUS_TAG}" || FATAL "cannot get prometheus docker image"
+ sg docker -c "docker pull google/cadvisor:${PROMETHEUS_CADVISOR_TAG}" || FATAL "cannot get prometheus cadvisor docker image"
+ 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"
+ sg docker -c "docker pull mariadb:${KEYSTONEDB_TAG}" || FATAL "cannot get keystone-db docker image"
+ sg docker -c "docker pull mysql:5" || FATAL "cannot get mysql docker image"
+
+ list_of_modules="MON NBI KEYSTONE RO LCM NG-UI osmclient prometheus"
if [ -n "$INSTALL_NGSA" ]; then
list_of_modules="${list_of_modules} Airflow Webhook"
else
# OSM_HELM_OPTS="${OSM_HELM_OPTS} --set nbi.useOsmSecret=false"
OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.image.repositoryBase=${DOCKER_REGISTRY_URL}${DOCKER_USER}"
OSM_HELM_OPTS="${OSM_HELM_OPTS} --set mysql.dbHostPath=${OSM_NAMESPACE_VOL}"
- OSM_HELM_OPTS="${OSM_HELM_OPTS} --set mon.config.OS_NOTIFIER_URI=http://${OSM_DEFAULT_IP}:8662"
OSM_HELM_OPTS="${OSM_HELM_OPTS} --set vca.host=${OSM_VCA_HOST}"
OSM_HELM_OPTS="${OSM_HELM_OPTS} --set vca.secret=${OSM_VCA_SECRET}"
OSM_HELM_OPTS="${OSM_HELM_OPTS} --set vca.cacert=${OSM_VCA_CACERT}"
trap ctrl_c INT
- # TODO: move this under start
- [ -n "$DOCKER_REGISTRY_URL" ] && parse_docker_registry_url
check_osm_behind_proxy
-
check_packages "git wget curl tar snapd"
-
sudo snap install jq || FATAL "Could not install jq (snap package). Make sure that snap works"
-
find_devops_folder
- track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type $OSM_INSTALLATION_TYPE none none
+ track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type $OSM_INSTALLATION_TYPE none none os_info $os_info 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
-
ask_proceed
track checks proceed_ok
echo "Installing OSM"
+ [ -n "$DOCKER_REGISTRY_URL" ] && parse_docker_registry_url
+
echo "Determining IP address of the interface with the default route"
[ -z "$OSM_DEFAULT_IF" ] && OSM_DEFAULT_IF=$(ip route list|awk '$1=="default" {print $5; exit}')
[ -z "$OSM_DEFAULT_IF" ] && OSM_DEFAULT_IF=$(route -n |awk '$1~/^0.0.0.0/ {print $8; exit}')
exit 0
fi
+# Installation starts here
+
+# Get README and create OSM_TRACK_INSTALLATION_ID
+wget -q -O- https://osm-download.etsi.org/ftp/osm-13.0-thirteen/README.txt &> /dev/null
+export OSM_TRACK_INSTALLATION_ID="$(date +%s)-$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16)"
+
+# Get OS info to be tracked
+os_distro=$(lsb_release -i 2>/dev/null | awk '{print $3}')
+echo $os_distro
+os_release=$(lsb_release -r 2>/dev/null | awk '{print $2}')
+echo $os_release
+os_info="${os_distro}_${os_release}"
+os_info="${os_info// /_}"
+
# Charmed installation
if [ -n "$CHARMED" ]; then
sudo snap install jq || FATAL "Could not install jq (snap package). Make sure that snap works"
- 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-13.0-thirteen/README2.txt &> /dev/null
- track end installation_type $OSM_INSTALLATION_TYPE
echo -e "\nDONE"
exit 0
fi
fi
# Community_installer
-
+# Check incompatible options
[ -n "$TO_REBUILD" ] && [ "$TO_REBUILD" != " NONE" ] && echo $TO_REBUILD | grep -q NONE && FATAL "Incompatible option: -m NONE cannot be used with other -m options"
[ -n "$TO_REBUILD" ] && [ "$TO_REBUILD" == " PLA" ] && [ -z "$INSTALL_PLA" ] && FATAL "Incompatible option: -m PLA cannot be used without --pla option"
+# Special cases go first
# if develop, we force master
[ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master"
-OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_NAMESPACE}"
[ -n "$INSTALL_ONLY" ] && [ -n "$INSTALL_K8S_MONITOR" ] && install_k8s_monitoring
[ -n "$INSTALL_ONLY" ] && [ -n "$INSTALL_NGSA" ] && install_osm_ngsa_service
[ -n "$INSTALL_ONLY" ] && echo -e "\nDONE" && exit 0
-
-#Installation starts here
-wget -q -O- https://osm-download.etsi.org/ftp/osm-13.0-thirteen/README.txt &> /dev/null
-export OSM_TRACK_INSTALLATION_ID="$(date +%s)-$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16)"
+# This is where installation starts
install_osm
echo -e "\nDONE"
exit 0