X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Ffull_install_osm.sh;h=3e675e166ccd73a55ee9ebf2920f9a708f4289ec;hb=refs%2Fchanges%2F75%2F6275%2F1;hp=43da95a5271c68e860e25093b6cd92669ff7cec2;hpb=0e596bce6c0da59a2d2b176e5edd456dca35f2ad;p=osm%2Fdevops.git diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index 43da95a5..3e675e16 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -33,6 +33,7 @@ function usage(){ 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 " --nodocker: do not install docker, do not initialize a swarm (assumes docker is already installed and a swarm has been initialized)" 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" @@ -639,8 +640,7 @@ function generate_docker_env_files() { echo "Finished generation of docker env files" } -function deploy_lightweight() { - echo "Deploying lightweight build" +function init_docker_swarm() { if [ "${DEFAULT_MTU}" != "1500" ]; then DOCKER_NETS=`sg docker -c "docker network list" | awk '{print $2}' | egrep -v "^ID$" | paste -d " " -s` DOCKER_GW_NET=`sg docker -c "docker network inspect ${DOCKER_NETS}" | grep Subnet | awk -F\" '{print $4}' | egrep "^172" | sort -u | tail -1 | awk -F\. '{if ($2 != 255) print $1"."$2+1"."$3"."$4; else print "-1";}'` @@ -648,6 +648,12 @@ function deploy_lightweight() { fi sg docker -c "docker swarm init --advertise-addr ${DEFAULT_IP}" sg docker -c "docker network create --driver=overlay --attachable --opt com.docker.network.driver.mtu=${DEFAULT_MTU} netOSM" + return 0 +} + +function deploy_lightweight() { + echo "Deploying lightweight build" + [ -n "$INSTALL_NODOCKER" ] || init_docker_swarm remove_stack osm sg docker -c "docker stack deploy -c /etc/osm/docker/docker-compose.yaml osm" #docker-compose -f /etc/osm/docker/docker-compose.yaml up -d @@ -713,6 +719,7 @@ function deploy_perfmon() { function install_lightweight() { [ "$USER" == "root" ] && FATAL "You are running the installer as root. The installer is prepared to be executed as a normal user with sudo privileges." + [ -z "$ASSUME_YES" ] && ! ask_user "The installation will configure LXD, install juju, install docker CE and init a docker swarm, as pre-requirements. Do you want to proceed (Y/n)? " y && echo "Cancelled!" && exit 1 echo "Installing lightweight build of OSM" LWTEMPDIR="$(mktemp -d -q --tmpdir "installosmlight.XXXXXX")" trap 'rm -rf "${LWTEMPDIR}"' EXIT @@ -737,7 +744,7 @@ function install_lightweight() { [ -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 + [ -n "$INSTALL_NODOCKER" ] || install_docker_ce track docker_ce #install_docker_compose generate_docker_images @@ -770,10 +777,10 @@ function install_vimemu() { echo "Starting vim-emu Docker container 'vim-emu' ..." if [ -n "$INSTALL_LIGHTWEIGHT" ]; then # in lightweight mode, the emulator needs to be attached to netOSM - sudo docker run --name vim-emu -t -d --rm --privileged --pid='host' --network=netOSM -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py + sudo docker run --name vim-emu -t -d --restart always --privileged --pid='host' --network=netOSM -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py else # classic build mode - sudo docker run --name vim-emu -t -d --rm --privileged --pid='host' -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py + sudo docker run --name vim-emu -t -d --restart always --privileged --pid='host' -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py fi echo "Waiting for 'vim-emu' container to start ..." sleep 5 @@ -805,6 +812,7 @@ function dump_vars(){ echo "INSTALL_PERFMON=$INSTALL_PERFMON" echo "TO_REBUILD=$TO_REBUILD" echo "INSTALL_NOLXD=$INSTALL_NOLXD" + echo "INSTALL_NODOCKER=$INSTALL_NODOCKER" echo "RELEASE=$RELEASE" echo "REPOSITORY=$REPOSITORY" echo "REPOSITORY_BASE=$REPOSITORY_BASE" @@ -851,6 +859,7 @@ INSTALL_ELK="" INSTALL_PERFMON="" TO_REBUILD="" INSTALL_NOLXD="" +INSTALL_NODOCKER="" NOCONFIGURE="" RELEASE_DAILY="" SESSION_ID=`date +%s` @@ -912,6 +921,7 @@ while getopts ":hy-:b:r:k:u:R:l:p:D:o:m:" o; do [ "${OPTARG}" == "test" ] && TEST_INSTALLER="y" && continue [ "${OPTARG}" == "lxdinstall" ] && INSTALL_LXD="y" && continue [ "${OPTARG}" == "nolxd" ] && INSTALL_NOLXD="y" && continue + [ "${OPTARG}" == "nodocker" ] && INSTALL_NODOCKER="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 @@ -942,6 +952,7 @@ done [ -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" +[ -n "$INSTALL_NODOCKER" ] && [ -z "$INSTALL_LIGHTWEIGHT" ] && FATAL "Incompatible option: --nodocker cannot be used with --soui" [ -n "$TO_REBUILD" ] && [ -z "$INSTALL_LIGHTWEIGHT" ] && FATAL "Incompatible option: -m cannot be used with --soui" [ -n "$TO_REBUILD" ] && [ "$TO_REBUILD" != " NONE" ] && echo $TO_REBUILD | grep -q NONE && FATAL "Incompatible option: -m NONE cannot be used with other -m options"