echo -e " -R <release>: use specified release for osm binaries (deb packages, lxd images, ...)"
echo -e " -u <repo base>: use specified repository url for osm packages"
echo -e " -k <repo key>: use specified repository public key url"
- echo -e " -b <refspec>: install OSM from source code using a specific branch (master, v2.0, ...) or tag"
- echo -e " -b master (main dev branch)"
- echo -e " -b v2.0 (v2.0 branch)"
- echo -e " -b tags/v1.1.0 (a specific tag)"
- echo -e " ..."
echo -e " -a <apt proxy url>: use this apt proxy url when downloading apt packages (air-gapped installation)"
echo -e " -c <kubernetes engine>: use a specific kubernetes engine (options: kubeadm, k3s, microk8s), default is kubeadm"
echo -e " -s <namespace> namespace when installed using k8s, default is osm"
echo -e " --pla: install the PLA module for placement support"
echo -e " --old-sa: install old Service Assurance framework (MON, POL); do not install Airflow and Pushgateway"
echo -e " --ng-sa: install new Service Assurance framework (Airflow, AlertManager and Pushgateway) (enabled by default)"
- echo -e " -m <MODULE>: install OSM but only rebuild or pull the specified docker images (NG-UI, NBI, LCM, RO, MON, POL, PLA, KAFKA, MONGO, PROMETHEUS, PROMETHEUS-CADVISOR, KEYSTONE-DB, NONE)"
echo -e " -o <ADDON>: ONLY (un)installs one of the addons (k8s_monitor, ng-sa)"
echo -e " -O <openrc file path/cloud name>: Install OSM to an OpenStack infrastructure. <openrc file/cloud name> is required. If a <cloud name> is used, the clouds.yaml file should be under ~/.config/openstack/ or /etc/openstack/"
echo -e " -N <openstack public network name/ID>: Public network name required to setup OSM to OpenStack"
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)"
echo -e " --nojuju: do not juju, assumes already installed"
- echo -e " --nodockerbuild:do not build docker images (use existing locally cached images)"
echo -e " --nohostports: do not expose docker ports to host (useful for creating multiple instances of osm on the same host)"
echo -e " --nohostclient: do not install the osmclient"
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 " --develop: (deprecated, use '-b master') install OSM from source code using the master branch"
- 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 " --showopts: print chosen options and exit (only for debugging)"
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
}
-function generate_docker_images() {
- [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
- echo "Generating docker images"
- _build_from=$COMMIT_ID
- [ -z "$_build_from" ] && _build_from="latest"
- echo "OSM Docker images generated from $_build_from"
- LWTEMPDIR="$(mktemp -d -q --tmpdir "installosmlight.XXXXXX")"
- trap 'rm -rf "${LWTEMPDIR}"' EXIT
- for module in MON POL NBI KEYSTONE RO LCM NG-UI PLA; do
- if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q ${module} ; then
- module_lower=${module,,}
- if [ $module == "PLA" -a ! -n "$INSTALL_PLA" ]; then
- continue
- fi
- git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/$module
- git -C ${LWTEMPDIR}/${module} checkout ${COMMIT_ID}
- sg docker -c "docker build ${LWTEMPDIR}/${module} -f ${LWTEMPDIR}/${module}/docker/Dockerfile -t ${DOCKER_USER}/${module_lower} --no-cache" || FATAL "cannot build ${module} docker image"
- fi
- done
- if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q osmclient; then
- BUILD_ARGS+=(--build-arg REPOSITORY="$REPOSITORY")
- BUILD_ARGS+=(--build-arg RELEASE="$RELEASE")
- BUILD_ARGS+=(--build-arg REPOSITORY_KEY="$REPOSITORY_KEY")
- BUILD_ARGS+=(--build-arg REPOSITORY_BASE="$REPOSITORY_BASE")
- sg docker -c "docker build -t ${DOCKER_USER}/osmclient ${BUILD_ARGS[@]} -f $OSM_DEVOPS/docker/osmclient ."
- fi
- echo "Finished generation of docker images"
- [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
-}
-
-function cmp_overwrite() {
- [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
- file1="$1"
- 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 && cp -b ${file1} ${file2}
- else
- cp -b ${file1} ${file2}
- fi
- fi
- [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
-}
-
#deploys osm pods and services
function deploy_osm_services() {
[ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
trap ctrl_c INT
-
check_osm_behind_proxy
check_packages "git wget curl tar snapd"
if [ -n "${INSTALL_JUJU}" ]; then
track juju juju_ok
# Deploy OSM services
- [ -z "$DOCKER_NOBUILD" ] && [ -z "$PULL_IMAGES" ] && generate_docker_images
track docker_images docker_images_ok
deploy_mongodb
[ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
echo "APT_PROXY_URL=$APT_PROXY_URL"
echo "K8S_CLUSTER_ENGINE=$K8S_CLUSTER_ENGINE"
- echo "DEVELOP=$DEVELOP"
echo "DEBUG_INSTALL=$DEBUG_INSTALL"
- echo "DOCKER_NOBUILD=$DOCKER_NOBUILD"
echo "DOCKER_PROXY_URL=$DOCKER_PROXY_URL"
echo "DOCKER_REGISTRY_URL=$DOCKER_REGISTRY_URL"
echo "DOCKER_USER=$DOCKER_USER"
echo "INSTALL_CACHELXDIMAGES=$INSTALL_CACHELXDIMAGES"
- echo "INSTALL_FROM_SOURCE=$INSTALL_FROM_SOURCE"
echo "INSTALL_JUJU=$INSTALL_JUJU"
echo "INSTALL_K8S_MONITOR=$INSTALL_K8S_MONITOR"
echo "INSTALL_LXD=$INSTALL_LXD"
echo "REPOSITORY_KEY=$REPOSITORY_KEY"
echo "SHOWOPTS=$SHOWOPTS"
echo "TEST_INSTALLER=$TEST_INSTALLER"
- echo "TO_REBUILD=$TO_REBUILD"
echo "UNINSTALL=$UNINSTALL"
echo "UPDATE=$UPDATE"
- echo "Install from specific refspec (-b): $COMMIT_ID"
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
}
}
UNINSTALL=""
-DEVELOP=""
UPDATE=""
RECONFIGURE=""
TEST_INSTALLER=""
INSTALL_LXD=""
SHOWOPTS=""
-COMMIT_ID=""
ASSUME_YES=""
APT_PROXY_URL=""
K8S_CLUSTER_ENGINE="kubeadm"
-INSTALL_FROM_SOURCE=""
DEBUG_INSTALL=""
RELEASE="testing-daily"
REPOSITORY="testing"
OPENSTACK_VM_NAME="server-osm"
OPENSTACK_PYTHON_VENV="$HOME/.virtual-envs/osm"
INSTALL_ONLY=""
-TO_REBUILD=""
INSTALL_DOCKER=""
INSTALL_JUJU=""
INSTALL_NOHOSTCLIENT=""
OSM_VCA_K8S_CLOUDNAME="k8scloud"
OSM_NAMESPACE=osm
NO_HOST_PORTS=""
-DOCKER_NOBUILD=""
REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg"
REPOSITORY_BASE="https://osm-download.etsi.org/repository/osm/debian"
OSM_WORK_DIR="/etc/osm"
MODULE_DOCKER_TAG=
OSM_INSTALLATION_TYPE="Default"
-while getopts ":a:b:c: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; do
+while getopts ":a:c:r:n:k:u:R:D:o:O:N:H:S:s:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o; do
case "${o}" in
a)
APT_PROXY_URL=${OPTARG}
;;
- b)
- COMMIT_ID=${OPTARG}
- PULL_IMAGES=""
- ;;
c)
K8S_CLUSTER_ENGINE=${OPTARG}
[ "${K8S_CLUSTER_ENGINE}" == "kubeadm" ] && continue
N)
OPENSTACK_PUBLIC_NET_NAME="${OPTARG}"
;;
- m)
- [ "${OPTARG}" == "NG-UI" ] && TO_REBUILD="$TO_REBUILD NG-UI" && continue
- [ "${OPTARG}" == "NBI" ] && TO_REBUILD="$TO_REBUILD NBI" && continue
- [ "${OPTARG}" == "LCM" ] && TO_REBUILD="$TO_REBUILD LCM" && continue
- [ "${OPTARG}" == "RO" ] && TO_REBUILD="$TO_REBUILD RO" && continue
- [ "${OPTARG}" == "MON" ] && TO_REBUILD="$TO_REBUILD MON" && continue
- [ "${OPTARG}" == "POL" ] && TO_REBUILD="$TO_REBUILD POL" && continue
- [ "${OPTARG}" == "PLA" ] && TO_REBUILD="$TO_REBUILD PLA" && continue
- [ "${OPTARG}" == "osmclient" ] && TO_REBUILD="$TO_REBUILD osmclient" && continue
- [ "${OPTARG}" == "KAFKA" ] && TO_REBUILD="$TO_REBUILD KAFKA" && continue
- [ "${OPTARG}" == "MONGO" ] && TO_REBUILD="$TO_REBUILD MONGO" && continue
- [ "${OPTARG}" == "PROMETHEUS" ] && TO_REBUILD="$TO_REBUILD PROMETHEUS" && continue
- [ "${OPTARG}" == "PROMETHEUS-CADVISOR" ] && TO_REBUILD="$TO_REBUILD PROMETHEUS-CADVISOR" && continue
- [ "${OPTARG}" == "KEYSTONE-DB" ] && TO_REBUILD="$TO_REBUILD KEYSTONE-DB" && continue
- [ "${OPTARG}" == "GRAFANA" ] && TO_REBUILD="$TO_REBUILD GRAFANA" && continue
- [ "${OPTARG}" == "NONE" ] && TO_REBUILD="$TO_REBUILD NONE" && continue
- ;;
H)
OSM_VCA_HOST="${OPTARG}"
;;
;;
-)
[ "${OPTARG}" == "help" ] && usage && exit 0
- [ "${OPTARG}" == "source" ] && INSTALL_FROM_SOURCE="y" && PULL_IMAGES="" && continue
[ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="--debug" && continue
- [ "${OPTARG}" == "develop" ] && DEVELOP="y" && continue
[ "${OPTARG}" == "uninstall" ] && UNINSTALL="y" && continue
[ "${OPTARG}" == "update" ] && UPDATE="y" && continue
[ "${OPTARG}" == "reconfigure" ] && RECONFIGURE="y" && continue
[ "${OPTARG}" == "nohostports" ] && NO_HOST_PORTS="y" && continue
[ "${OPTARG}" == "juju" ] && INSTALL_JUJU="y" && continue
[ "${OPTARG}" == "nojuju" ] && INSTALL_JUJU="" && continue
- [ "${OPTARG}" == "nodockerbuild" ] && DOCKER_NOBUILD="y" && continue
[ "${OPTARG}" == "nohostclient" ] && INSTALL_NOHOSTCLIENT="y" && continue
- [ "${OPTARG}" == "pullimages" ] && continue
[ "${OPTARG}" == "k8s_monitor" ] && INSTALL_K8S_MONITOR="y" && continue
[ "${OPTARG}" == "charmed" ] && CHARMED="y" && OSM_INSTALLATION_TYPE="Charmed" && continue
[ "${OPTARG}" == "bundle" ] && continue
exit 0
else
# 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"
[ -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
echo -e " -R <release>: use specified release for osm binaries (deb packages, lxd images, ...)"
echo -e " -u <repo base>: use specified repository url for osm packages"
echo -e " -k <repo key>: use specified repository public key url"
- echo -e " -b <refspec>: install OSM from source code using a specific branch (master, v2.0, ...) or tag"
- echo -e " -b master (main dev branch)"
- echo -e " -b v2.0 (v2.0 branch)"
- echo -e " -b tags/v1.1.0 (a specific tag)"
- echo -e " ..."
echo -e " -a <apt proxy url>: use this apt proxy url when downloading apt packages (air-gapped installation)"
echo -e " -s <namespace> namespace when installed using k8s, default is osm"
echo -e " -H <VCA host> use specific juju host controller IP"
echo -e " --pla: install the PLA module for placement support"
echo -e " --old-sa: install old Service Assurance framework (MON, POL); do not install Airflow and Pushgateway"
echo -e " --ng-sa: install new Service Assurance framework (Airflow, AlertManager and Pushgateway) (enabled by default)"
- echo -e " -m <MODULE>: install OSM but only rebuild or pull the specified docker images (NG-UI, NBI, LCM, RO, MON, POL, PLA, KAFKA, MONGO, PROMETHEUS, PROMETHEUS-CADVISOR, KEYSTONE-DB, NONE)"
echo -e " -o <ADDON>: ONLY (un)installs one of the addons (k8s_monitor, ng-sa)"
echo -e " -O <openrc file path/cloud name>: Install OSM to an OpenStack infrastructure. <openrc file/cloud name> is required. If a <cloud name> is used, the clouds.yaml file should be under ~/.config/openstack/ or /etc/openstack/"
echo -e " -N <openstack public network name/ID>: Public network name required to setup OSM to OpenStack"
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)"
echo -e " --nojuju: do not juju, assumes already installed"
- echo -e " --nodockerbuild:do not build docker images (use existing locally cached images)"
echo -e " --nohostports: do not expose docker ports to host (useful for creating multiple instances of osm on the same host)"
echo -e " --nohostclient: do not install the osmclient"
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 " --develop: (deprecated, use '-b master') install OSM from source code using the master branch"
- 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 " --showopts: print chosen options and exit (only for debugging)"