| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # Copyright 2016 Telefónica Investigación y Desarrollo S.A.U. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | function usage(){ |
| 17 | echo -e "usage: $0 [OPTIONS]" |
| 18 | echo -e "Install OSM from binaries or source code (by default, from binaries)" |
| 19 | echo -e " OPTIONS" |
| 20 | echo -e " --uninstall: uninstall OSM: remove the containers and delete NAT rules" |
| 21 | echo -e " --source: install OSM from source code using the latest stable tag" |
| 22 | echo -e " -r <repo>: use specified repository name for osm packages" |
| 23 | echo -e " -R <release>: use specified release for osm binaries (deb packages, lxd images, ...)" |
| 24 | echo -e " -u <repo base>: use specified repository url for osm packages" |
| 25 | echo -e " -k <repo key>: use specified repository public key url" |
| 26 | echo -e " -b <refspec>: install OSM from source code using a specific branch (master, v2.0, ...) or tag" |
| 27 | echo -e " -b master (main dev branch)" |
| 28 | echo -e " -b v2.0 (v2.0 branch)" |
| 29 | echo -e " -b tags/v1.1.0 (a specific tag)" |
| 30 | echo -e " ..." |
| 31 | echo -e " --lxdimages: download lxd images from OSM repository instead of creating them from scratch" |
| 32 | echo -e " -l <lxd_repo>: use specified repository url for lxd images" |
| 33 | echo -e " -p <path>: use specified repository path for lxd images" |
| 34 | echo -e " --lightweight: install lightweight build of OSM (default installation)" |
| garciadeblas | 432bcb2 | 2018-05-10 13:33:23 +0200 | [diff] [blame] | 35 | echo -e " --soui: install classic build of OSM (Rel THREE v3.1, based on LXD containers, with SO and UI)" |
| garciadeblas | 6c66abf | 2018-05-16 14:46:19 +0200 | [diff] [blame] | 36 | echo -e " --vimemu: additionally deploy the VIM emulator as a docker container" |
| 37 | echo -e " --elk_stack: additionally deploy an ELK docker stack for event logging" |
| 38 | echo -e " --pm_stack: additionally deploy a Prometheus+Grafana stack for performance monitoring (PM)" |
| 39 | echo -e " -o <ADDON>: do not install OSM, but ONLY one of the addons (vimemu, elk_stack, pm_stack) (assumes OSM is already installed)" |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 40 | echo -e " --develop: (deprecated, use '-b master') install OSM from source code using the master branch" |
| 41 | # echo -e " --reconfigure: reconfigure the modules (DO NOT change NAT rules)" |
| 42 | echo -e " --nat: install only NAT rules" |
| 43 | echo -e " --noconfigure: DO NOT install osmclient, DO NOT install NAT rules, DO NOT configure modules" |
| 44 | # echo -e " --update: update to the latest stable release or to the latest commit if using a specific branch" |
| 45 | echo -e " --showopts: print chosen options and exit (only for debugging)" |
| 46 | echo -e " -y: do not prompt for confirmation, assumes yes" |
| 47 | echo -e " -D <devops path> use local devops installation path" |
| 48 | echo -e " -h / --help: print this help" |
| 49 | } |
| 50 | |
| 51 | #Uninstall OSM: remove containers |
| 52 | function uninstall(){ |
| 53 | echo -e "\nUninstalling OSM" |
| 54 | if [ $RC_CLONE ] || [ -n "$TEST_INSTALLER" ]; then |
| 55 | $OSM_DEVOPS/jenkins/host/clean_container RO |
| 56 | $OSM_DEVOPS/jenkins/host/clean_container VCA |
| 57 | $OSM_DEVOPS/jenkins/host/clean_container MON |
| 58 | $OSM_DEVOPS/jenkins/host/clean_container SO |
| 59 | #$OSM_DEVOPS/jenkins/host/clean_container UI |
| 60 | else |
| 61 | lxc stop RO && lxc delete RO |
| 62 | lxc stop VCA && lxc delete VCA |
| 63 | lxc stop MON && lxc delete MON |
| 64 | lxc stop SO-ub && lxc delete SO-ub |
| 65 | fi |
| 66 | echo -e "\nDeleting imported lxd images if they exist" |
| 67 | lxc image show osm-ro &>/dev/null && lxc image delete osm-ro |
| 68 | lxc image show osm-vca &>/dev/null && lxc image delete osm-vca |
| 69 | lxc image show osm-soui &>/dev/null && lxc image delete osm-soui |
| 70 | return 0 |
| 71 | } |
| 72 | |
| 73 | #Uninstall lightweight OSM: remove dockers |
| 74 | function uninstall_lightweight(){ |
| 75 | echo -e "\nUninstalling lightweight OSM" |
| 76 | docker stack rm osm |
| 77 | COUNTER=0 |
| 78 | result=11 |
| 79 | while [ ${COUNTER} -lt 30 ]; do |
| 80 | sleep 1 |
| 81 | result=$(docker stack ps osm | wc -l) |
| 82 | #echo "Dockers running: $result" |
| 83 | if [ "${result}" == "0" ]; then |
| 84 | break |
| 85 | fi |
| 86 | let COUNTER=COUNTER+1 |
| 87 | done |
| 88 | if [ "${result}" == "0" ]; then |
| 89 | echo "All dockers of the stack osm were removed" |
| 90 | else |
| 91 | FATAL "Some dockers of the stack osm could not be removed. Could not uninstall OSM in single shot. Try to uninstall again" |
| 92 | fi |
| 93 | sleep 5 |
| 94 | docker image rm osm/ro |
| 95 | docker image rm osm/lcm |
| 96 | docker image rm osm/light-ui |
| 97 | docker image rm osm/nbi |
| 98 | docker image rm osm/mon |
| 99 | docker image rm osm/pm |
| 100 | return 0 |
| 101 | } |
| 102 | |
| 103 | #Configure NAT rules, based on the current IP addresses of containers |
| 104 | function nat(){ |
| 105 | echo -e "\nChecking required packages: iptables-persistent" |
| 106 | dpkg -l iptables-persistent &>/dev/null || ! echo -e " Not installed.\nInstalling iptables-persistent requires root privileges" || \ |
| 107 | sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install iptables-persistent |
| 108 | echo -e "\nConfiguring NAT rules" |
| 109 | echo -e " Required root privileges" |
| 110 | sudo $OSM_DEVOPS/installers/nat_osm |
| 111 | } |
| 112 | |
| 113 | function FATAL(){ |
| 114 | echo "FATAL error: Cannot install OSM due to \"$1\"" |
| 115 | exit 1 |
| 116 | } |
| 117 | |
| 118 | #Update RO, SO and UI: |
| 119 | function update(){ |
| 120 | echo -e "\nUpdating components" |
| 121 | |
| 122 | echo -e " Updating RO" |
| 123 | CONTAINER="RO" |
| 124 | MDG="RO" |
| 125 | INSTALL_FOLDER="/opt/openmano" |
| 126 | echo -e " Fetching the repo" |
| 127 | lxc exec $CONTAINER -- git -C $INSTALL_FOLDER fetch --all |
| 128 | BRANCH="" |
| 129 | BRANCH=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status -sb | head -n1 | sed -n 's/^## \(.*\).*/\1/p'|awk '{print $1}' |sed 's/\(.*\)\.\.\..*/\1/'` |
| 130 | [ -z "$BRANCH" ] && FATAL "Could not find the current branch in use in the '$MDG'" |
| 131 | CURRENT=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status |head -n1` |
| 132 | CURRENT_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse HEAD` |
| 133 | echo " FROM: $CURRENT ($CURRENT_COMMIT_ID)" |
| 134 | # COMMIT_ID either was previously set with -b option, or is an empty string |
| 135 | CHECKOUT_ID=$COMMIT_ID |
| 136 | [ -z "$CHECKOUT_ID" ] && [ "$BRANCH" == "HEAD" ] && CHECKOUT_ID="tags/$LATEST_STABLE_DEVOPS" |
| 137 | [ -z "$CHECKOUT_ID" ] && [ "$BRANCH" != "HEAD" ] && CHECKOUT_ID="$BRANCH" |
| 138 | if [[ $CHECKOUT_ID == "tags/"* ]]; then |
| 139 | REMOTE_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-list -n 1 $CHECKOUT_ID` |
| 140 | else |
| 141 | REMOTE_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse origin/$CHECKOUT_ID` |
| 142 | fi |
| 143 | echo " TO: $CHECKOUT_ID ($REMOTE_COMMIT_ID)" |
| 144 | if [ "$CURRENT_COMMIT_ID" == "$REMOTE_COMMIT_ID" ]; then |
| 145 | echo " Nothing to be done." |
| 146 | else |
| 147 | echo " Update required." |
| 148 | lxc exec $CONTAINER -- service osm-ro stop |
| 149 | lxc exec $CONTAINER -- git -C /opt/openmano stash |
| 150 | lxc exec $CONTAINER -- git -C /opt/openmano pull --rebase |
| 151 | lxc exec $CONTAINER -- git -C /opt/openmano checkout $CHECKOUT_ID |
| 152 | lxc exec $CONTAINER -- git -C /opt/openmano stash pop |
| 153 | lxc exec $CONTAINER -- /opt/openmano/database_utils/migrate_mano_db.sh |
| 154 | lxc exec $CONTAINER -- service osm-ro start |
| 155 | fi |
| 156 | echo |
| 157 | |
| 158 | echo -e " Updating SO and UI" |
| 159 | CONTAINER="SO-ub" |
| 160 | MDG="SO" |
| 161 | INSTALL_FOLDER="" # To be filled in |
| 162 | echo -e " Fetching the repo" |
| 163 | lxc exec $CONTAINER -- git -C $INSTALL_FOLDER fetch --all |
| 164 | BRANCH="" |
| 165 | BRANCH=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status -sb | head -n1 | sed -n 's/^## \(.*\).*/\1/p'|awk '{print $1}' |sed 's/\(.*\)\.\.\..*/\1/'` |
| 166 | [ -z "$BRANCH" ] && FATAL "Could not find the current branch in use in the '$MDG'" |
| 167 | CURRENT=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status |head -n1` |
| 168 | CURRENT_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse HEAD` |
| 169 | echo " FROM: $CURRENT ($CURRENT_COMMIT_ID)" |
| 170 | # COMMIT_ID either was previously set with -b option, or is an empty string |
| 171 | CHECKOUT_ID=$COMMIT_ID |
| 172 | [ -z "$CHECKOUT_ID" ] && [ "$BRANCH" == "HEAD" ] && CHECKOUT_ID="tags/$LATEST_STABLE_DEVOPS" |
| 173 | [ -z "$CHECKOUT_ID" ] && [ "$BRANCH" != "HEAD" ] && CHECKOUT_ID="$BRANCH" |
| 174 | if [[ $CHECKOUT_ID == "tags/"* ]]; then |
| 175 | REMOTE_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-list -n 1 $CHECKOUT_ID` |
| 176 | else |
| 177 | REMOTE_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse origin/$CHECKOUT_ID` |
| 178 | fi |
| 179 | echo " TO: $CHECKOUT_ID ($REMOTE_COMMIT_ID)" |
| 180 | if [ "$CURRENT_COMMIT_ID" == "$REMOTE_COMMIT_ID" ]; then |
| 181 | echo " Nothing to be done." |
| 182 | else |
| 183 | echo " Update required." |
| 184 | # Instructions to be added |
| 185 | # lxc exec SO-ub -- ... |
| 186 | fi |
| 187 | echo |
| 188 | echo -e "Updating MON Container" |
| 189 | CONTAINER="MON" |
| 190 | MDG="MON" |
| 191 | INSTALL_FOLDER="/root/MON" |
| 192 | echo -e " Fetching the repo" |
| 193 | lxc exec $CONTAINER -- git -C $INSTALL_FOLDER fetch --all |
| 194 | BRANCH="" |
| 195 | BRANCH=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status -sb | head -n1 | sed -n 's/^## \(.*\).*/\1/p'|awk '{print $1}' |sed 's/\(.*\)\.\.\..*/\1/'` |
| 196 | [ -z "$BRANCH" ] && FATAL "Could not find the current branch in use in the '$MDG'" |
| 197 | CURRENT=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status |head -n1` |
| 198 | CURRENT_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse HEAD` |
| 199 | echo " FROM: $CURRENT ($CURRENT_COMMIT_ID)" |
| 200 | # COMMIT_ID either was previously set with -b option, or is an empty string |
| 201 | CHECKOUT_ID=$COMMIT_ID |
| 202 | [ -z "$CHECKOUT_ID" ] && [ "$BRANCH" == "HEAD" ] && CHECKOUT_ID="tags/$LATEST_STABLE_DEVOPS" |
| 203 | [ -z "$CHECKOUT_ID" ] && [ "$BRANCH" != "HEAD" ] && CHECKOUT_ID="$BRANCH" |
| 204 | if [[ $CHECKOUT_ID == "tags/"* ]]; then |
| 205 | REMOTE_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-list -n 1 $CHECKOUT_ID` |
| 206 | else |
| 207 | REMOTE_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse origin/$CHECKOUT_ID` |
| 208 | fi |
| 209 | echo " TO: $CHECKOUT_ID ($REMOTE_COMMIT_ID)" |
| 210 | if [ "$CURRENT_COMMIT_ID" == "$REMOTE_COMMIT_ID" ]; then |
| 211 | echo " Nothing to be done." |
| 212 | else |
| 213 | echo " Update required." |
| 214 | fi |
| 215 | echo |
| 216 | } |
| 217 | |
| 218 | function so_is_up() { |
| 219 | if [ -n "$1" ]; then |
| 220 | SO_IP=$1 |
| 221 | else |
| 222 | SO_IP=`lxc list SO-ub -c 4|grep eth0 |awk '{print $2}'` |
| 223 | fi |
| 224 | time=0 |
| 225 | step=5 |
| 226 | timelength=300 |
| 227 | while [ $time -le $timelength ] |
| 228 | do |
| 229 | if [[ `curl -k -X GET https://$SO_IP:8008/api/operational/vcs/info \ |
| 230 | -H 'accept: application/vnd.yang.data+json' \ |
| 231 | -H 'authorization: Basic YWRtaW46YWRtaW4=' \ |
| 232 | -H 'cache-control: no-cache' 2> /dev/null | jq '.[].components.component_info[] | select(.component_name=="RW.Restconf")' 2>/dev/null | grep "RUNNING" | wc -l` -eq 1 ]] |
| 233 | then |
| 234 | echo "RW.Restconf running....SO is up" |
| 235 | return 0 |
| 236 | fi |
| 237 | |
| 238 | sleep $step |
| 239 | echo -n "." |
| 240 | time=$((time+step)) |
| 241 | done |
| 242 | |
| 243 | FATAL "OSM Failed to startup. SO failed to startup" |
| 244 | } |
| 245 | |
| 246 | function vca_is_up() { |
| 247 | if [[ `lxc exec VCA -- juju status | grep "osm" | wc -l` -eq 1 ]]; then |
| 248 | echo "VCA is up and running" |
| 249 | return 0 |
| 250 | fi |
| 251 | |
| 252 | FATAL "OSM Failed to startup. VCA failed to startup" |
| 253 | } |
| 254 | |
| 255 | function mon_is_up() { |
| 256 | if [[ `curl http://$RO_IP:9090/openmano/ | grep "works" | wc -l` -eq 1 ]]; then |
| 257 | echo "MON is up and running" |
| 258 | return 0 |
| 259 | fi |
| 260 | |
| 261 | FATAL "OSM Failed to startup. MON failed to startup" |
| 262 | } |
| 263 | |
| 264 | function ro_is_up() { |
| 265 | if [ -n "$1" ]; then |
| 266 | RO_IP=$1 |
| 267 | else |
| 268 | RO_IP=`lxc list RO -c 4|grep eth0 |awk '{print $2}'` |
| 269 | fi |
| 270 | time=0 |
| 271 | step=2 |
| 272 | timelength=20 |
| 273 | while [ $time -le $timelength ]; do |
| 274 | if [[ `curl http://$RO_IP:9090/openmano/ | grep "works" | wc -l` -eq 1 ]]; then |
| 275 | echo "RO is up and running" |
| 276 | return 0 |
| 277 | fi |
| 278 | sleep $step |
| 279 | echo -n "." |
| 280 | time=$((time+step)) |
| 281 | done |
| 282 | |
| 283 | FATAL "OSM Failed to startup. RO failed to startup" |
| 284 | } |
| 285 | |
| 286 | |
| 287 | function configure_RO(){ |
| 288 | . $OSM_DEVOPS/installers/export_ips |
| 289 | echo -e " Configuring RO" |
| 290 | lxc exec RO -- sed -i -e "s/^\#\?log_socket_host:.*/log_socket_host: $SO_CONTAINER_IP/g" /etc/osm/openmanod.cfg |
| 291 | lxc exec RO -- service osm-ro restart |
| 292 | |
| 293 | ro_is_up |
| 294 | |
| 295 | lxc exec RO -- openmano tenant-delete -f osm >/dev/null |
| 296 | lxc exec RO -- openmano tenant-create osm > /dev/null |
| 297 | lxc exec RO -- sed -i '/export OPENMANO_TENANT=osm/d' .bashrc |
| 298 | lxc exec RO -- sed -i '$ i export OPENMANO_TENANT=osm' .bashrc |
| 299 | lxc exec RO -- sh -c 'echo "export OPENMANO_TENANT=osm" >> .bashrc' |
| 300 | } |
| 301 | |
| 302 | function configure_VCA(){ |
| 303 | echo -e " Configuring VCA" |
| 304 | JUJU_PASSWD=`date +%s | sha256sum | base64 | head -c 32` |
| 305 | echo -e "$JUJU_PASSWD\n$JUJU_PASSWD" | lxc exec VCA -- juju change-user-password |
| 306 | } |
| 307 | |
| 308 | function configure_SOUI(){ |
| 309 | . $OSM_DEVOPS/installers/export_ips |
| 310 | JUJU_CONTROLLER_IP=`lxc exec VCA -- lxc list -c 4 |grep eth0 |awk '{print $2}'` |
| 311 | RO_TENANT_ID=`lxc exec RO -- openmano tenant-list osm |awk '{print $1}'` |
| 312 | |
| 313 | echo -e " Configuring MON" |
| 314 | #Information to be added about SO socket for logging |
| 315 | |
| 316 | echo -e " Configuring SO" |
| 317 | sudo route add -host $JUJU_CONTROLLER_IP gw $VCA_CONTAINER_IP |
| garciadeblas | 818fa5a | 2018-05-10 13:39:10 +0200 | [diff] [blame] | 318 | sudo ip route add 10.44.127.0/24 via $VCA_CONTAINER_IP |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 319 | sudo sed -i "$ i route add -host $JUJU_CONTROLLER_IP gw $VCA_CONTAINER_IP" /etc/rc.local |
| garciadeblas | 818fa5a | 2018-05-10 13:39:10 +0200 | [diff] [blame] | 320 | sudo sed -i "$ i ip route add 10.44.127.0/24 via $VCA_CONTAINER_IP" /etc/rc.local |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 321 | # make journaling persistent |
| 322 | lxc exec SO-ub -- mkdir -p /var/log/journal |
| 323 | lxc exec SO-ub -- systemd-tmpfiles --create --prefix /var/log/journal |
| 324 | lxc exec SO-ub -- systemctl restart systemd-journald |
| 325 | |
| 326 | echo RIFT_EXTERNAL_ADDRESS=$DEFAULT_IP | lxc exec SO-ub -- tee -a /usr/rift/etc/default/launchpad |
| 327 | |
| 328 | lxc exec SO-ub -- systemctl restart launchpad |
| 329 | |
| 330 | so_is_up $SO_CONTAINER_IP |
| 331 | |
| 332 | #delete existing config agent (could be there on reconfigure) |
| 333 | curl -k --request DELETE \ |
| 334 | --url https://$SO_CONTAINER_IP:8008/api/config/config-agent/account/osmjuju \ |
| 335 | --header 'accept: application/vnd.yang.data+json' \ |
| 336 | --header 'authorization: Basic YWRtaW46YWRtaW4=' \ |
| 337 | --header 'cache-control: no-cache' \ |
| 338 | --header 'content-type: application/vnd.yang.data+json' &> /dev/null |
| 339 | |
| 340 | result=$(curl -k --request POST \ |
| 341 | --url https://$SO_CONTAINER_IP:8008/api/config/config-agent \ |
| 342 | --header 'accept: application/vnd.yang.data+json' \ |
| 343 | --header 'authorization: Basic YWRtaW46YWRtaW4=' \ |
| 344 | --header 'cache-control: no-cache' \ |
| 345 | --header 'content-type: application/vnd.yang.data+json' \ |
| 346 | --data '{"account": [ { "name": "osmjuju", "account-type": "juju", "juju": { "ip-address": "'$JUJU_CONTROLLER_IP'", "port": "17070", "user": "admin", "secret": "'$JUJU_PASSWD'" } } ]}') |
| 347 | [[ $result =~ .*success.* ]] || FATAL "Failed config-agent configuration: $result" |
| 348 | |
| 349 | #R1/R2 config line |
| 350 | #result=$(curl -k --request PUT \ |
| 351 | # --url https://$SO_CONTAINER_IP:8008/api/config/resource-orchestrator \ |
| 352 | # --header 'accept: application/vnd.yang.data+json' \ |
| 353 | # --header 'authorization: Basic YWRtaW46YWRtaW4=' \ |
| 354 | # --header 'cache-control: no-cache' \ |
| 355 | # --header 'content-type: application/vnd.yang.data+json' \ |
| 356 | # --data '{ "openmano": { "host": "'$RO_CONTAINER_IP'", "port": "9090", "tenant-id": "'$RO_TENANT_ID'" }, "name": "osmopenmano", "account-type": "openmano" }') |
| 357 | |
| 358 | result=$(curl -k --request PUT \ |
| 359 | --url https://$SO_CONTAINER_IP:8008/api/config/project/default/ro-account/account \ |
| 360 | --header 'accept: application/vnd.yang.data+json' \ |
| 361 | --header 'authorization: Basic YWRtaW46YWRtaW4=' \ |
| 362 | --header 'cache-control: no-cache' \ |
| 363 | --header 'content-type: application/vnd.yang.data+json' \ |
| 364 | --data '{"rw-ro-account:account": [ { "openmano": { "host": "'$RO_CONTAINER_IP'", "port": "9090", "tenant-id": "'$RO_TENANT_ID'"}, "name": "osmopenmano", "ro-account-type": "openmano" }]}') |
| 365 | [[ $result =~ .*success.* ]] || FATAL "Failed resource-orchestrator configuration: $result" |
| 366 | |
| 367 | result=$(curl -k --request PATCH \ |
| 368 | --url https://$SO_CONTAINER_IP:8008/v2/api/config/openidc-provider-config/rw-ui-client/redirect-uri \ |
| 369 | --header 'accept: application/vnd.yang.data+json' \ |
| 370 | --header 'authorization: Basic YWRtaW46YWRtaW4=' \ |
| 371 | --header 'cache-control: no-cache' \ |
| 372 | --header 'content-type: application/vnd.yang.data+json' \ |
| 373 | --data '{"redirect-uri": "https://'$DEFAULT_IP':8443/callback" }') |
| 374 | [[ $result =~ .*success.* ]] || FATAL "Failed redirect-uri configuration: $result" |
| 375 | |
| 376 | result=$(curl -k --request PATCH \ |
| 377 | --url https://$SO_CONTAINER_IP:8008/v2/api/config/openidc-provider-config/rw-ui-client/post-logout-redirect-uri \ |
| 378 | --header 'accept: application/vnd.yang.data+json' \ |
| 379 | --header 'authorization: Basic YWRtaW46YWRtaW4=' \ |
| 380 | --header 'cache-control: no-cache' \ |
| 381 | --header 'content-type: application/vnd.yang.data+json' \ |
| 382 | --data '{"post-logout-redirect-uri": "https://'$DEFAULT_IP':8443/?api_server=https://'$DEFAULT_IP'" }') |
| 383 | [[ $result =~ .*success.* ]] || FATAL "Failed post-logout-redirect-uri configuration: $result" |
| 384 | |
| 385 | lxc exec SO-ub -- tee /etc/network/interfaces.d/60-rift.cfg <<EOF |
| 386 | auto lo:1 |
| 387 | iface lo:1 inet static |
| 388 | address $DEFAULT_IP |
| 389 | netmask 255.255.255.255 |
| 390 | EOF |
| 391 | lxc exec SO-ub ifup lo:1 |
| 392 | } |
| 393 | |
| 394 | #Configure RO, VCA, and SO with the initial configuration: |
| 395 | # RO -> tenant:osm, logs to be sent to SO |
| 396 | # VCA -> juju-password |
| 397 | # SO -> route to Juju Controller, add RO account, add VCA account |
| 398 | function configure(){ |
| 399 | #Configure components |
| 400 | echo -e "\nConfiguring components" |
| 401 | configure_RO |
| 402 | configure_VCA |
| 403 | configure_SOUI |
| 404 | } |
| 405 | |
| 406 | function install_lxd() { |
| 407 | sudo apt-get update |
| 408 | sudo apt-get install -y lxd |
| 409 | newgrp lxd |
| 410 | lxd init --auto |
| 411 | lxd waitready |
| 412 | lxc network create lxdbr0 ipv4.address=auto ipv4.nat=true ipv6.address=none ipv6.nat=false |
| 413 | DEFAULT_INTERFACE=$(route -n | awk '$1~/^0.0.0.0/ {print $8}') |
| 414 | DEFAULT_MTU=$(ip addr show $DEFAULT_INTERFACE | perl -ne 'if (/mtu\s(\d+)/) {print $1;}') |
| 415 | lxc profile device set default eth0 mtu $DEFAULT_MTU |
| 416 | #sudo systemctl stop lxd-bridge |
| 417 | #sudo systemctl --system daemon-reload |
| 418 | #sudo systemctl enable lxd-bridge |
| 419 | #sudo systemctl start lxd-bridge |
| 420 | } |
| 421 | |
| 422 | function ask_user(){ |
| 423 | # ask to the user and parse a response among 'y', 'yes', 'n' or 'no'. Case insensitive |
| 424 | # Params: $1 text to ask; $2 Action by default, can be 'y' for yes, 'n' for no, other or empty for not allowed |
| 425 | # Return: true(0) if user type 'yes'; false (1) if user type 'no' |
| 426 | read -e -p "$1" USER_CONFIRMATION |
| 427 | while true ; do |
| 428 | [ -z "$USER_CONFIRMATION" ] && [ "$2" == 'y' ] && return 0 |
| 429 | [ -z "$USER_CONFIRMATION" ] && [ "$2" == 'n' ] && return 1 |
| 430 | [ "${USER_CONFIRMATION,,}" == "yes" ] || [ "${USER_CONFIRMATION,,}" == "y" ] && return 0 |
| 431 | [ "${USER_CONFIRMATION,,}" == "no" ] || [ "${USER_CONFIRMATION,,}" == "n" ] && return 1 |
| 432 | read -e -p "Please type 'yes' or 'no': " USER_CONFIRMATION |
| 433 | done |
| 434 | } |
| 435 | |
| 436 | function launch_container_from_lxd(){ |
| 437 | export OSM_MDG=$1 |
| 438 | OSM_load_config |
| 439 | export OSM_BASE_IMAGE=$2 |
| 440 | if ! container_exists $OSM_BUILD_CONTAINER; then |
| 441 | CONTAINER_OPTS="" |
| 442 | [[ "$OSM_BUILD_CONTAINER_PRIVILEGED" == yes ]] && CONTAINER_OPTS="$CONTAINER_OPTS -c security.privileged=true" |
| 443 | [[ "$OSM_BUILD_CONTAINER_ALLOW_NESTED" == yes ]] && CONTAINER_OPTS="$CONTAINER_OPTS -c security.nesting=true" |
| 444 | create_container $OSM_BASE_IMAGE $OSM_BUILD_CONTAINER $CONTAINER_OPTS |
| 445 | wait_container_up $OSM_BUILD_CONTAINER |
| 446 | fi |
| 447 | } |
| 448 | |
| 449 | function install_osmclient(){ |
| 450 | CLIENT_RELEASE=${RELEASE#"-R "} |
| 451 | CLIENT_REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg" |
| 452 | CLIENT_REPOSITORY=${REPOSITORY#"-r "} |
| 453 | [ -z "$REPOSITORY_BASE" ] && REPOSITORY_BASE="-u https://osm-download.etsi.org/repository/osm/debian" |
| 454 | CLIENT_REPOSITORY_BASE=${REPOSITORY_BASE#"-u "} |
| 455 | key_location=$CLIENT_REPOSITORY_BASE/$CLIENT_RELEASE/$CLIENT_REPOSITORY_KEY |
| 456 | curl $key_location | sudo apt-key add - |
| 457 | sudo add-apt-repository -y "deb [arch=amd64] $CLIENT_REPOSITORY_BASE/$CLIENT_RELEASE $CLIENT_REPOSITORY osmclient" |
| 458 | sudo apt-get update |
| 459 | sudo apt-get install -y python-pip |
| 460 | sudo -H pip install pip==9.0.3 |
| 461 | sudo -H pip install python-magic |
| 462 | sudo apt-get install -y python-osmclient |
| 463 | #sed 's,OSM_SOL005=[^$]*,OSM_SOL005=True,' -i ${HOME}/.bashrc |
| 464 | #echo 'export OSM_HOSTNAME=localhost' >> ${HOME}/.bashrc |
| 465 | #echo 'export OSM_SOL005=True' >> ${HOME}/.bashrc |
| 466 | [ -z "$INSTALL_LIGHTWEIGHT" ] && export OSM_HOSTNAME=`lxc list | awk '($2=="SO-ub"){print $6}'` |
| 467 | [ -z "$INSTALL_LIGHTWEIGHT" ] && export OSM_RO_HOSTNAME=`lxc list | awk '($2=="RO"){print $6}'` |
| garciadeblas | 8e6bc15 | 2018-05-14 11:36:11 +0200 | [diff] [blame] | 468 | [ -n "$INSTALL_LIGHTWEIGHT" ] && export OSM_HOSTNAME=127.0.0.1 |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 469 | echo -e "\nOSM client installed" |
| 470 | echo -e "You might be interested in adding the following OSM client env variables to your .bashrc file:" |
| 471 | echo " export OSM_HOSTNAME=${OSM_HOSTNAME}" |
| 472 | [ -n "$INSTALL_LIGHTWEIGHT" ] && echo " export OSM_SOL005=True" |
| 473 | [ -z "$INSTALL_LIGHTWEIGHT" ] && echo " export OSM_RO_HOSTNAME=${OSM_RO_HOSTNAME}" |
| 474 | return 0 |
| 475 | } |
| 476 | |
| 477 | function install_from_lxdimages(){ |
| 478 | LXD_RELEASE=${RELEASE#"-R "} |
| 479 | if [ -n "$LXD_REPOSITORY_PATH" ]; then |
| 480 | LXD_IMAGE_DIR="$LXD_REPOSITORY_PATH" |
| 481 | else |
| 482 | LXD_IMAGE_DIR="$(mktemp -d -q --tmpdir "osmimages.XXXXXX")" |
| 483 | trap 'rm -rf "$LXD_IMAGE_DIR"' EXIT |
| 484 | fi |
| 485 | echo -e "\nDeleting previous lxd images if they exist" |
| 486 | lxc image show osm-ro &>/dev/null && lxc image delete osm-ro |
| 487 | lxc image show osm-vca &>/dev/null && lxc image delete osm-vca |
| 488 | lxc image show osm-soui &>/dev/null && lxc image delete osm-soui |
| 489 | echo -e "\nImporting osm-ro" |
| 490 | [ -z "$LXD_REPOSITORY_PATH" ] && wget -O $LXD_IMAGE_DIR/osm-ro.tar.gz $LXD_REPOSITORY_BASE/$LXD_RELEASE/osm-ro.tar.gz |
| 491 | lxc image import $LXD_IMAGE_DIR/osm-ro.tar.gz --alias osm-ro |
| 492 | rm -f $LXD_IMAGE_DIR/osm-ro.tar.gz |
| 493 | echo -e "\nImporting osm-vca" |
| 494 | [ -z "$LXD_REPOSITORY_PATH" ] && wget -O $LXD_IMAGE_DIR/osm-vca.tar.gz $LXD_REPOSITORY_BASE/$LXD_RELEASE/osm-vca.tar.gz |
| 495 | lxc image import $LXD_IMAGE_DIR/osm-vca.tar.gz --alias osm-vca |
| 496 | rm -f $LXD_IMAGE_DIR/osm-vca.tar.gz |
| 497 | echo -e "\nImporting osm-soui" |
| 498 | [ -z "$LXD_REPOSITORY_PATH" ] && wget -O $LXD_IMAGE_DIR/osm-soui.tar.gz $LXD_REPOSITORY_BASE/$LXD_RELEASE/osm-soui.tar.gz |
| 499 | lxc image import $LXD_IMAGE_DIR/osm-soui.tar.gz --alias osm-soui |
| 500 | rm -f $LXD_IMAGE_DIR/osm-soui.tar.gz |
| 501 | launch_container_from_lxd RO osm-ro |
| 502 | ro_is_up && track RO |
| 503 | launch_container_from_lxd VCA osm-vca |
| 504 | vca_is_up && track VCA |
| 505 | launch_container_from_lxd MON osm-mon |
| 506 | mon_is_up && track MON |
| 507 | launch_container_from_lxd SO osm-soui |
| 508 | #so_is_up && track SOUI |
| 509 | track SOUI |
| 510 | } |
| 511 | |
| 512 | function install_docker_ce() { |
| 513 | # installs and configures Docker CE |
| 514 | echo "Installing Docker CE ..." |
| 515 | sudo apt-get -qq update |
| 516 | sudo apt-get install -y apt-transport-https ca-certificates software-properties-common |
| 517 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
| 518 | sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" |
| 519 | sudo apt-get -qq update |
| 520 | sudo apt-get install -y docker-ce |
| 521 | echo "Adding user to group 'docker'" |
| 522 | sudo groupadd -f docker |
| 523 | sudo usermod -aG docker $USER |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 524 | sleep 2 |
| 525 | sudo service docker restart |
| 526 | echo "... restarted Docker service" |
| garciadeblas | 67ce97c | 2018-05-18 10:22:09 +0200 | [diff] [blame^] | 527 | sg docker -c "docker version" || FATAL "Docker installation failed" |
| 528 | echo "... Docker CE installation done" |
| 529 | return 0 |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 530 | } |
| 531 | |
| 532 | function install_docker_compose() { |
| 533 | # installs and configures docker-compose |
| 534 | echo "Installing Docker Compose ..." |
| 535 | sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose |
| 536 | sudo chmod +x /usr/local/bin/docker-compose |
| 537 | echo "... Docker Compose installation done" |
| 538 | } |
| 539 | |
| 540 | function install_juju() { |
| 541 | echo "Installing juju" |
| 542 | sudo snap install juju --classic |
| 543 | sudo dpkg-reconfigure -p medium lxd |
| 544 | sg lxd -c "juju bootstrap localhost osm" |
| garciadeblas | 67ce97c | 2018-05-18 10:22:09 +0200 | [diff] [blame^] | 545 | [ $(juju status |grep "osm" |wc -l) -eq 1 ] || FATAL "Juju installation failed" |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 546 | echo "Finished installation of juju" |
| 547 | } |
| 548 | |
| 549 | function generate_docker_images() { |
| 550 | echo "Pulling and generating docker images" |
| 551 | newgrp docker << EONG |
| 552 | docker pull wurstmeister/kafka |
| 553 | docker pull wurstmeister/zookeeper |
| 554 | docker pull mongo |
| 555 | docker pull mysql:5 |
| 556 | git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/MON |
| 557 | docker build ${LWTEMPDIR}/MON -f ${LWTEMPDIR}/MON/docker/Dockerfile -t osm/mon || ! echo "cannot build MON docker image" >&2 |
| 558 | docker build ${LWTEMPDIR}/MON/policy_module -f ${LWTEMPDIR}/MON/policy_module/Dockerfile -t osm/pm || ! echo "cannot build PM docker image" >&2 |
| 559 | git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/NBI |
| 560 | docker build ${LWTEMPDIR}/NBI -f ${LWTEMPDIR}/NBI/Dockerfile.local -t osm/nbi || ! echo "cannot build NBI docker image" >&2 |
| 561 | git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/RO |
| 562 | docker build ${LWTEMPDIR}/RO -f ${LWTEMPDIR}/RO/docker/Dockerfile-local -t osm/ro || ! echo "cannot build RO docker image" >&2 |
| tierno | 940a34c | 2018-05-11 12:27:10 +0200 | [diff] [blame] | 563 | git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LCM |
| 564 | docker build ${LWTEMPDIR}/LCM -f ${LWTEMPDIR}/LCM/Dockerfile.local -t osm/lcm || ! echo "cannot build LCM docker image" >&2 |
| garciadeblas | 41f3897 | 2018-05-10 08:43:00 +0200 | [diff] [blame] | 565 | # git -C ${LWTEMPDIR} clone https://github.com/superfluidity/osm-light-ui.git |
| 566 | # docker build ${LWTEMPDIR}/osm-light-ui -t osm/light-ui -f ${LWTEMPDIR}/osm-light-ui/code/docker/Dockerfile |
| 567 | git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LW-UI |
| 568 | docker build ${LWTEMPDIR}/LW-UI -t osm/light-ui -f ${LWTEMPDIR}/LW-UI/Dockerfile |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 569 | EONG |
| 570 | echo "Finished generation of docker images" |
| 571 | } |
| 572 | |
| 573 | function generate_docker_env_files() { |
| 574 | echo "Generating docker env files" |
| 575 | OSMLCM_VCA_HOST=`juju show-controller|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'` |
| 576 | OSMLCM_VCA_SECRET=`grep password ${HOME}/.local/share/juju/accounts.yaml |awk '{print $2}'` |
| 577 | MYSQL_ROOT_PASSWORD=`date +%s | sha256sum | base64 | head -c 32` |
| 578 | echo "OSMLCM_VCA_HOST=${OSMLCM_VCA_HOST}" |sudo tee ${OSM_DEVOPS}/installers/docker/lcm.env |
| 579 | echo "OSMLCM_VCA_SECRET=${OSMLCM_VCA_SECRET}" |sudo tee -a ${OSM_DEVOPS}/installers/docker/lcm.env |
| 580 | echo "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}" |sudo tee ${OSM_DEVOPS}/installers/docker/ro-db.env |
| 581 | echo "RO_DB_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}" |sudo tee ${OSM_DEVOPS}/installers/docker/ro.env |
| 582 | echo "OS_NOTIFIER_URI=http://${DEFAULT_IP}:8662" |sudo tee ${OSM_DEVOPS}/installers/docker/mon.env |
| 583 | echo "Finished generation of docker env files" |
| 584 | } |
| 585 | |
| 586 | function deploy_lightweight() { |
| 587 | echo "Deploying lightweight build" |
| 588 | if [ "${DEFAULT_MTU}" != "1500" ]; then |
| 589 | DOCKER_NETS=`sg docker -c "docker network list" | awk '{print $2}' | egrep -v "^ID$" | paste -d " " -s` |
| 590 | 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";}'` |
| 591 | sg docker -c "docker network create --subnet ${DOCKER_GW_NET} --opt com.docker.network.bridge.name=docker_gwbridge --opt com.docker.network.bridge.enable_icc=false --opt com.docker.network.bridge.enable_ip_masquerade=true --opt com.docker.network.driver.mtu=${DEFAULT_MTU} docker_gwbridge" |
| 592 | fi |
| 593 | newgrp docker << EONG |
| 594 | docker swarm init --advertise-addr ${DEFAULT_IP} |
| 595 | docker network create --driver=overlay --attachable --opt com.docker.network.driver.mtu=${DEFAULT_MTU} netOSM |
| 596 | docker stack deploy -c ${OSM_DEVOPS}/installers/docker/docker-compose.yaml osm |
| 597 | #docker-compose -f /usr/share/osm-devops/installers/docker/docker-compose.yaml up -d |
| 598 | EONG |
| 599 | echo "Finished deployment of lightweight build" |
| 600 | } |
| 601 | |
| garciadeblas | 6c66abf | 2018-05-16 14:46:19 +0200 | [diff] [blame] | 602 | function deploy_elk() { |
| 603 | echo "Deploying ELK stack" |
| 604 | sg docker -c "docker stack deploy -c ${OSM_DEVOPS}/installers/docker/osm_elk/docker-compose.yml osm_elk" |
| 605 | echo "Waiting for ELK stack to be up and running" |
| 606 | time=0 |
| 607 | step=2 |
| 608 | timelength=20 |
| 609 | elk_is_up=1 |
| 610 | while [ $time -le $timelength ]; do |
| 611 | if [[ $(curl -XGET http://localhost:5601/status -I | grep "HTTP/1.1 200 OK" | wc -l ) -eq 1 ]]; then |
| 612 | elk_is_up=0 |
| 613 | break |
| 614 | fi |
| 615 | sleep $step |
| 616 | time=$((time+step)) |
| 617 | done |
| 618 | if [ $elk_is_up -eq 0 ]; then |
| 619 | echo "ELK is up and running. Trying to create index pattern..." |
| 620 | #Create index pattern |
| 621 | curl -f -XPOST -H "Content-Type: application/json" -H "kbn-xsrf: anything" \ |
| 622 | "http://localhost:5601/api/saved_objects/index-pattern/logstash-*" \ |
| 623 | -d"{\"attributes\":{\"title\":\"logstash-*\",\"timeFieldName\":\"@timestamp\"}}" |
| 624 | #Make it the default index |
| 625 | curl -XPOST -H "Content-Type: application/json" -H "kbn-xsrf: anything" \ |
| 626 | "http://localhost:5601/api/kibana/settings/defaultIndex" \ |
| 627 | -d"{\"value\":\"logstash-*\"}" |
| 628 | else |
| 629 | echo "Cannot connect to Kibana to create index pattern." |
| 630 | echo "Once Kibana is running, you can use the following instructions to create index pattern:" |
| 631 | echo 'curl -f -XPOST -H "Content-Type: application/json" -H "kbn-xsrf: anything" \ |
| 632 | "http://localhost:5601/api/saved_objects/index-pattern/logstash-*" \ |
| 633 | -d"{\"attributes\":{\"title\":\"logstash-*\",\"timeFieldName\":\"@timestamp\"}}"' |
| 634 | echo 'curl -XPOST -H "Content-Type: application/json" -H "kbn-xsrf: anything" \ |
| 635 | "http://localhost:5601/api/kibana/settings/defaultIndex" \ |
| 636 | -d"{\"value\":\"logstash-*\"}"' |
| 637 | fi |
| 638 | echo "Finished deployment of ELK stack" |
| 639 | return 0 |
| 640 | } |
| 641 | |
| 642 | function deploy_perfmon() { |
| 643 | echo "Generating osm/kafka-exporter docker image" |
| 644 | 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 || ! echo 'cannot build kafka-exporter docker image' >&2" |
| 645 | echo "Finished generation of osm/kafka-exporter docker image" |
| 646 | echo "Deploying PM stack (Kafka exporter + Prometheus + Grafana)" |
| 647 | sg docker -c "docker stack deploy -c ${OSM_DEVOPS}/installers/docker/osm_metrics/docker-compose.yml osm_metrics" |
| 648 | echo "Finished deployment of PM stack" |
| 649 | return 0 |
| 650 | } |
| 651 | |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 652 | function install_lightweight() { |
| 653 | echo "Installing lightweight build of OSM" |
| 654 | LWTEMPDIR="$(mktemp -d -q --tmpdir "installosmlight.XXXXXX")" |
| 655 | trap 'rm -rf "${LWTEMPDIR}"' EXIT |
| 656 | DEFAULT_IF=`route -n |awk '$1~/^0.0.0.0/ {print $8}'` |
| 657 | DEFAULT_IP=`ip -o -4 a |grep ${DEFAULT_IF}|awk '{split($4,a,"/"); print a[1]}'` |
| 658 | DEFAULT_MTU=$(ip addr show ${DEFAULT_IF} | perl -ne 'if (/mtu\s(\d+)/) {print $1;}') |
| 659 | need_packages_lw="lxd" |
| 660 | echo -e "Checking required packages: $need_packages_lw" |
| 661 | dpkg -l $need_packages_lw &>/dev/null \ |
| 662 | || ! echo -e "One or several required packages are not installed. Updating apt cache requires root privileges." \ |
| 663 | || sudo apt-get update \ |
| 664 | || FATAL "failed to run apt-get update" |
| 665 | dpkg -l $need_packages_lw &>/dev/null \ |
| 666 | || ! echo -e "Installing $need_packages_lw requires root privileges." \ |
| 667 | || sudo apt-get install -y $need_packages_lw \ |
| 668 | || FATAL "failed to install $need_packages_lw" |
| 669 | install_juju |
| garciadeblas | 6c66abf | 2018-05-16 14:46:19 +0200 | [diff] [blame] | 670 | track juju |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 671 | install_docker_ce |
| garciadeblas | 6c66abf | 2018-05-16 14:46:19 +0200 | [diff] [blame] | 672 | track docker_ce |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 673 | #install_docker_compose |
| 674 | generate_docker_images |
| garciadeblas | 6c66abf | 2018-05-16 14:46:19 +0200 | [diff] [blame] | 675 | track docker_build |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 676 | generate_docker_env_files |
| 677 | deploy_lightweight |
| garciadeblas | 6c66abf | 2018-05-16 14:46:19 +0200 | [diff] [blame] | 678 | track docker_deploy |
| 679 | [ -n "$INSTALL_VIMEMU" ] && install_vimemu && track vimemu |
| 680 | [ -n "$INSTALL_ELK" ] && deploy_elk && track elk |
| 681 | [ -n "$INSTALL_PERFMON" ] && deploy_perfmon && track perfmon |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 682 | install_osmclient |
| garciadeblas | 6c66abf | 2018-05-16 14:46:19 +0200 | [diff] [blame] | 683 | track osmclient |
| 684 | wget -q -O- https://osm-download.etsi.org/ftp/osm-4.0-four/README2.txt &> /dev/null |
| 685 | track end |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 686 | return 0 |
| 687 | } |
| 688 | |
| 689 | function install_vimemu() { |
| peusterm | 76353e4 | 2018-05-08 13:56:05 +0200 | [diff] [blame] | 690 | echo "\nInstalling vim-emu" |
| 691 | EMUTEMPDIR="$(mktemp -d -q --tmpdir "installosmvimemu.XXXXXX")" |
| 692 | trap 'rm -rf "${EMUTEMPDIR}"' EXIT |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 693 | # clone vim-emu repository (attention: branch is currently master only) |
| 694 | echo "Cloning vim-emu repository ..." |
| peusterm | 76353e4 | 2018-05-08 13:56:05 +0200 | [diff] [blame] | 695 | git clone https://osm.etsi.org/gerrit/osm/vim-emu.git $EMUTEMPDIR |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 696 | # build vim-emu docker |
| 697 | echo "Building vim-emu Docker container..." |
| peusterm | 76353e4 | 2018-05-08 13:56:05 +0200 | [diff] [blame] | 698 | sudo docker build -t vim-emu-img -f $EMUTEMPDIR/Dockerfile $EMUTEMPDIR/ |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 699 | # start vim-emu container as daemon |
| 700 | echo "Starting vim-emu Docker container 'vim-emu' ..." |
| peusterm | 76353e4 | 2018-05-08 13:56:05 +0200 | [diff] [blame] | 701 | if [ -n "$INSTALL_LIGHTWEIGHT" ]; then |
| 702 | # in lightweight mode, the emulator needs to be attached to netOSM |
| 703 | 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 |
| 704 | else |
| 705 | # classic build mode |
| 706 | 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 |
| 707 | fi |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 708 | echo "Waiting for 'vim-emu' container to start ..." |
| 709 | sleep 5 |
| 710 | export VIMEMU_HOSTNAME=$(sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vim-emu) |
| 711 | echo "vim-emu running at ${VIMEMU_HOSTNAME} ..." |
| peusterm | 76353e4 | 2018-05-08 13:56:05 +0200 | [diff] [blame] | 712 | # print vim-emu connection info |
| 713 | echo -e "\nYou might be interested in adding the following vim-emu env variables to your .bashrc file:" |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 714 | echo " export VIMEMU_HOSTNAME=${VIMEMU_HOSTNAME}" |
| peusterm | 76353e4 | 2018-05-08 13:56:05 +0200 | [diff] [blame] | 715 | echo -e "To add the emulated VIM to OSM you should do:" |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 716 | echo " osm vim-create --name emu-vim1 --user username --password password --auth_url http://${VIMEMU_HOSTNAME}:6001/v2.0 --tenant tenantName --account_type openstack" |
| 717 | } |
| 718 | |
| 719 | function dump_vars(){ |
| 720 | echo "DEVELOP=$DEVELOP" |
| 721 | echo "INSTALL_FROM_SOURCE=$INSTALL_FROM_SOURCE" |
| 722 | echo "UNINSTALL=$UNINSTALL" |
| 723 | echo "NAT=$NAT" |
| 724 | echo "UPDATE=$UPDATE" |
| 725 | echo "RECONFIGURE=$RECONFIGURE" |
| 726 | echo "TEST_INSTALLER=$TEST_INSTALLER" |
| 727 | echo "INSTALL_VIMEMU=$INSTALL_VIMEMU" |
| 728 | echo "INSTALL_LXD=$INSTALL_LXD" |
| 729 | echo "INSTALL_FROM_LXDIMAGES=$INSTALL_FROM_LXDIMAGES" |
| 730 | echo "LXD_REPOSITORY_BASE=$LXD_REPOSITORY_BASE" |
| 731 | echo "LXD_REPOSITORY_PATH=$LXD_REPOSITORY_PATH" |
| 732 | echo "INSTALL_LIGHTWEIGHT=$INSTALL_LIGHTWEIGHT" |
| garciadeblas | 6c66abf | 2018-05-16 14:46:19 +0200 | [diff] [blame] | 733 | echo "INSTALL_ONLY=$INSTALL_ONLY" |
| 734 | echo "INSTALL_ELK=$INSTALL_ELK" |
| 735 | echo "INSTALL_PERFMON=$INSTALL_PERFMON" |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 736 | echo "RELEASE=$RELEASE" |
| 737 | echo "REPOSITORY=$REPOSITORY" |
| 738 | echo "REPOSITORY_BASE=$REPOSITORY_BASE" |
| 739 | echo "REPOSITORY_KEY=$REPOSITORY_KEY" |
| 740 | echo "NOCONFIGURE=$NOCONFIGURE" |
| 741 | echo "SHOWOPTS=$SHOWOPTS" |
| 742 | echo "Install from specific refspec (-b): $COMMIT_ID" |
| 743 | } |
| 744 | |
| 745 | function track(){ |
| 746 | ctime=`date +%s` |
| 747 | duration=$((ctime - SESSION_ID)) |
| 748 | url="http://www.woopra.com/track/ce?project=osm.etsi.org&cookie=${SESSION_ID}" |
| 749 | #url="${url}&ce_campaign_name=${CAMPAIGN_NAME}" |
| 750 | event_name="bin" |
| garciadeblas | 6c66abf | 2018-05-16 14:46:19 +0200 | [diff] [blame] | 751 | [ -z "$INSTALL_LIGHTWEIGHT" ] && [ -n "$INSTALL_FROM_SOURCE" ] && event_name="binsrc" |
| 752 | [ -z "$INSTALL_LIGHTWEIGHT" ] && [ -n "$INSTALL_FROM_LXDIMAGES" ] && event_name="lxd" |
| 753 | [ -n "$INSTALL_LIGHTWEIGHT" ] && event_name="lw" |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 754 | event_name="${event_name}_$1" |
| 755 | url="${url}&event=${event_name}&ce_duration=${duration}" |
| 756 | wget -q -O /dev/null $url |
| 757 | } |
| 758 | |
| 759 | UNINSTALL="" |
| 760 | DEVELOP="" |
| 761 | NAT="" |
| 762 | UPDATE="" |
| 763 | RECONFIGURE="" |
| 764 | TEST_INSTALLER="" |
| 765 | INSTALL_LXD="" |
| 766 | SHOWOPTS="" |
| 767 | COMMIT_ID="" |
| 768 | ASSUME_YES="" |
| 769 | INSTALL_FROM_SOURCE="" |
| 770 | RELEASE="-R ReleaseTHREE" |
| 771 | REPOSITORY="-r stable" |
| 772 | INSTALL_VIMEMU="" |
| 773 | INSTALL_FROM_LXDIMAGES="" |
| 774 | LXD_REPOSITORY_BASE="https://osm-download.etsi.org/repository/osm/lxd" |
| 775 | LXD_REPOSITORY_PATH="" |
| 776 | INSTALL_LIGHTWEIGHT="y" |
| garciadeblas | 6c66abf | 2018-05-16 14:46:19 +0200 | [diff] [blame] | 777 | INSTALL_ONLY="" |
| 778 | INSTALL_ELK="" |
| 779 | INSTALL_PERFMON="" |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 780 | NOCONFIGURE="" |
| 781 | RELEASE_DAILY="" |
| 782 | SESSION_ID=`date +%s` |
| 783 | OSM_DEVOPS= |
| 784 | |
| garciadeblas | 6c66abf | 2018-05-16 14:46:19 +0200 | [diff] [blame] | 785 | while getopts ":hy-:b:r:k:u:R:l:p:D:o:" o; do |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 786 | case "${o}" in |
| 787 | h) |
| 788 | usage && exit 0 |
| 789 | ;; |
| 790 | b) |
| 791 | COMMIT_ID=${OPTARG} |
| 792 | ;; |
| 793 | r) |
| 794 | REPOSITORY="-r ${OPTARG}" |
| 795 | ;; |
| 796 | R) |
| 797 | RELEASE="-R ${OPTARG}" |
| 798 | ;; |
| 799 | k) |
| 800 | REPOSITORY_KEY="-k ${OPTARG}" |
| 801 | ;; |
| 802 | u) |
| 803 | REPOSITORY_BASE="-u ${OPTARG}" |
| 804 | ;; |
| 805 | l) |
| 806 | LXD_REPOSITORY_BASE="${OPTARG}" |
| 807 | ;; |
| 808 | p) |
| 809 | LXD_REPOSITORY_PATH="${OPTARG}" |
| 810 | ;; |
| 811 | D) |
| 812 | OSM_DEVOPS="${OPTARG}" |
| 813 | ;; |
| garciadeblas | 6c66abf | 2018-05-16 14:46:19 +0200 | [diff] [blame] | 814 | o) |
| 815 | INSTALL_ONLY="y" |
| 816 | [ "${OPTARG}" == "vimemu" ] && INSTALL_VIMEMU="y" && continue |
| 817 | [ "${OPTARG}" == "elk_stack" ] && INSTALL_ELK="y" && continue |
| 818 | [ "${OPTARG}" == "pm_stack" ] && INSTALL_PERFMON="y" && continue |
| 819 | ;; |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 820 | -) |
| 821 | [ "${OPTARG}" == "help" ] && usage && exit 0 |
| 822 | [ "${OPTARG}" == "source" ] && INSTALL_FROM_SOURCE="y" && continue |
| 823 | [ "${OPTARG}" == "develop" ] && DEVELOP="y" && continue |
| 824 | [ "${OPTARG}" == "uninstall" ] && UNINSTALL="y" && continue |
| 825 | [ "${OPTARG}" == "nat" ] && NAT="y" && continue |
| 826 | [ "${OPTARG}" == "update" ] && UPDATE="y" && continue |
| 827 | [ "${OPTARG}" == "reconfigure" ] && RECONFIGURE="y" && continue |
| 828 | [ "${OPTARG}" == "test" ] && TEST_INSTALLER="y" && continue |
| 829 | [ "${OPTARG}" == "lxdinstall" ] && INSTALL_LXD="y" && continue |
| 830 | [ "${OPTARG}" == "lxdimages" ] && INSTALL_FROM_LXDIMAGES="y" && continue |
| 831 | [ "${OPTARG}" == "lightweight" ] && INSTALL_LIGHTWEIGHT="y" && continue |
| garciadeblas | ef09186 | 2018-05-14 16:37:04 +0200 | [diff] [blame] | 832 | [ "${OPTARG}" == "soui" ] && INSTALL_LIGHTWEIGHT="" && RELEASE="-R ReleaseTHREE-Classic" && REPOSITORY="-r testing" && continue |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 833 | [ "${OPTARG}" == "vimemu" ] && INSTALL_VIMEMU="y" && continue |
| garciadeblas | 6c66abf | 2018-05-16 14:46:19 +0200 | [diff] [blame] | 834 | [ "${OPTARG}" == "elk_stack" ] && INSTALL_ELK="y" && continue |
| 835 | [ "${OPTARG}" == "pm_stack" ] && INSTALL_PERFMON="y" && continue |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 836 | [ "${OPTARG}" == "noconfigure" ] && NOCONFIGURE="y" && continue |
| 837 | [ "${OPTARG}" == "showopts" ] && SHOWOPTS="y" && continue |
| 838 | [ "${OPTARG}" == "daily" ] && RELEASE_DAILY="y" && continue |
| 839 | echo -e "Invalid option: '--$OPTARG'\n" >&2 |
| 840 | usage && exit 1 |
| 841 | ;; |
| 842 | \?) |
| 843 | echo -e "Invalid option: '-$OPTARG'\n" >&2 |
| 844 | usage && exit 1 |
| 845 | ;; |
| 846 | y) |
| 847 | ASSUME_YES="y" |
| 848 | ;; |
| 849 | *) |
| 850 | usage && exit 1 |
| 851 | ;; |
| 852 | esac |
| 853 | done |
| 854 | |
| garciadeblas | 6c66abf | 2018-05-16 14:46:19 +0200 | [diff] [blame] | 855 | [ -n "$INSTALL_FROM_LXDIMAGES" ] && [ -n "$INSTALL_LIGHTWEIGHT" ] && FATAL "Incompatible options: --lxd can only be used with --soui" |
| 856 | |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 857 | if [ -n "$SHOWOPTS" ]; then |
| 858 | dump_vars |
| 859 | exit 0 |
| 860 | fi |
| 861 | |
| 862 | [ -n "$RELEASE_DAILY" ] && echo -e "\nInstalling from daily build repo" && RELEASE="-R ReleaseTHREE-daily" && REPOSITORY="-r testing" && COMMIT_ID="master" |
| 863 | |
| 864 | # if develop, we force master |
| 865 | [ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master" |
| 866 | |
| 867 | # forcing source from master removed. Now only install from source when explicit |
| 868 | # [ -n "$COMMIT_ID" ] && [ "$COMMIT_ID" == "master" ] && INSTALL_FROM_SOURCE="y" |
| 869 | |
| 870 | if [ -z "$OSM_DEVOPS" ]; then |
| 871 | if [ -n "$TEST_INSTALLER" ]; then |
| 872 | echo -e "\nUsing local devops repo for OSM installation" |
| 873 | TEMPDIR="$(dirname $(realpath $(dirname $0)))" |
| 874 | else |
| 875 | echo -e "\nCreating temporary dir for OSM installation" |
| 876 | TEMPDIR="$(mktemp -d -q --tmpdir "installosm.XXXXXX")" |
| 877 | trap 'rm -rf "$TEMPDIR"' EXIT |
| 878 | fi |
| 879 | fi |
| 880 | |
| 881 | need_packages="git jq wget curl tar" |
| 882 | echo -e "Checking required packages: $need_packages" |
| 883 | dpkg -l $need_packages &>/dev/null \ |
| 884 | || ! echo -e "One or several required packages are not installed. Updating apt cache requires root privileges." \ |
| 885 | || sudo apt-get update \ |
| 886 | || FATAL "failed to run apt-get update" |
| 887 | dpkg -l $need_packages &>/dev/null \ |
| 888 | || ! echo -e "Installing $need_packages requires root privileges." \ |
| 889 | || sudo apt-get install -y $need_packages \ |
| 890 | || FATAL "failed to install $need_packages" |
| 891 | |
| 892 | if [ -z "$OSM_DEVOPS" ]; then |
| 893 | if [ -z "$TEST_INSTALLER" ]; then |
| 894 | echo -e "\nCloning devops repo temporarily" |
| 895 | git clone https://osm.etsi.org/gerrit/osm/devops.git $TEMPDIR |
| 896 | RC_CLONE=$? |
| 897 | fi |
| 898 | |
| 899 | echo -e "\nGuessing the current stable release" |
| 900 | LATEST_STABLE_DEVOPS=`git -C $TEMPDIR tag -l v[0-9].* | sort -V | tail -n1` |
| 901 | [ -z "$COMMIT_ID" ] && [ -z "$LATEST_STABLE_DEVOPS" ] && echo "Could not find the current latest stable release" && exit 0 |
| 902 | echo "Latest tag in devops repo: $LATEST_STABLE_DEVOPS" |
| 903 | [ -z "$COMMIT_ID" ] && [ -n "$LATEST_STABLE_DEVOPS" ] && COMMIT_ID="tags/$LATEST_STABLE_DEVOPS" |
| 904 | |
| 905 | if [ -n "$RELEASE_DAILY" ]; then |
| 906 | echo "Using master/HEAD devops" |
| 907 | git -C $TEMPDIR checkout master |
| 908 | elif [ -z "$TEST_INSTALLER" ]; then |
| 909 | git -C $TEMPDIR checkout tags/$LATEST_STABLE_DEVOPS |
| 910 | fi |
| 911 | OSM_DEVOPS=$TEMPDIR |
| 912 | fi |
| 913 | |
| 914 | OSM_JENKINS="$OSM_DEVOPS/jenkins" |
| 915 | . $OSM_JENKINS/common/all_funcs |
| 916 | |
| 917 | [ -n "$INSTALL_LIGHTWEIGHT" ] && [ -n "$UNINSTALL" ] && uninstall_lightweight && echo -e "\nDONE" && exit 0 |
| 918 | [ -n "$UNINSTALL" ] && uninstall && echo -e "\nDONE" && exit 0 |
| 919 | [ -n "$NAT" ] && nat && echo -e "\nDONE" && exit 0 |
| 920 | [ -n "$UPDATE" ] && update && echo -e "\nDONE" && exit 0 |
| 921 | [ -n "$RECONFIGURE" ] && configure && echo -e "\nDONE" && exit 0 |
| garciadeblas | 6c66abf | 2018-05-16 14:46:19 +0200 | [diff] [blame] | 922 | [ -n "$INSTALL_ONLY" ] && [ -n "$INSTALL_ELK" ] && deploy_elk |
| 923 | [ -n "$INSTALL_ONLY" ] && [ -n "$INSTALL_PERFMON" ] && deploy_perfmon |
| 924 | [ -n "$INSTALL_ONLY" ] && [ -n "$INSTALL_VIMEMU" ] && install_vimemu |
| 925 | [ -n "$INSTALL_ONLY" ] && echo -e "\nDONE" && exit 0 |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 926 | |
| 927 | #Installation starts here |
| garciadeblas | 6c66abf | 2018-05-16 14:46:19 +0200 | [diff] [blame] | 928 | wget -q -O- https://osm-download.etsi.org/ftp/osm-4.0-four/README.txt &> /dev/null |
| 929 | track start |
| 930 | |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 931 | [ -n "$INSTALL_LIGHTWEIGHT" ] && install_lightweight && echo -e "\nDONE" && exit 0 |
| 932 | echo -e "\nInstalling OSM from refspec: $COMMIT_ID" |
| 933 | if [ -n "$INSTALL_FROM_SOURCE" ] && [ -z "$ASSUME_YES" ]; then |
| 934 | ! ask_user "The installation will take about 75-90 minutes. Continue (Y/n)? " y && echo "Cancelled!" && exit 1 |
| 935 | fi |
| 936 | |
| 937 | echo -e "Checking required packages: lxd" |
| 938 | lxd --version &>/dev/null || FATAL "lxd not present, exiting." |
| 939 | [ -n "$INSTALL_LXD" ] && echo -e "\nInstalling and configuring lxd" && install_lxd |
| 940 | |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 941 | # use local devops for containers |
| 942 | export OSM_USE_LOCAL_DEVOPS=true |
| 943 | if [ -n "$INSTALL_FROM_SOURCE" ]; then #install from source |
| 944 | echo -e "\nCreating the containers and building from source ..." |
| 945 | $OSM_DEVOPS/jenkins/host/start_build RO --notest checkout $COMMIT_ID || FATAL "RO container build failed (refspec: '$COMMIT_ID')" |
| 946 | ro_is_up && track RO |
| 947 | $OSM_DEVOPS/jenkins/host/start_build VCA || FATAL "VCA container build failed" |
| 948 | vca_is_up && track VCA |
| 949 | $OSM_DEVOPS/jenkins/host/start_build MON || FATAL "MON install failed" |
| 950 | mon_is_up && track MON |
| 951 | $OSM_DEVOPS/jenkins/host/start_build SO checkout $COMMIT_ID || FATAL "SO container build failed (refspec: '$COMMIT_ID')" |
| 952 | $OSM_DEVOPS/jenkins/host/start_build UI checkout $COMMIT_ID || FATAL "UI container build failed (refspec: '$COMMIT_ID')" |
| 953 | #so_is_up && track SOUI |
| 954 | track SOUI |
| 955 | elif [ -n "$INSTALL_FROM_LXDIMAGES" ]; then #install from LXD images stored in OSM repo |
| 956 | echo -e "\nInstalling from lxd images ..." |
| 957 | install_from_lxdimages |
| 958 | else #install from binaries |
| 959 | echo -e "\nCreating the containers and installing from binaries ..." |
| 960 | $OSM_DEVOPS/jenkins/host/install RO $REPOSITORY $RELEASE $REPOSITORY_KEY $REPOSITORY_BASE || FATAL "RO install failed" |
| 961 | ro_is_up && track RO |
| 962 | $OSM_DEVOPS/jenkins/host/start_build VCA || FATAL "VCA install failed" |
| 963 | vca_is_up && track VCA |
| 964 | $OSM_DEVOPS/jenkins/host/install MON || FATAL "MON build failed" |
| 965 | mon_is_up && track MON |
| 966 | $OSM_DEVOPS/jenkins/host/install SO $REPOSITORY $RELEASE $REPOSITORY_KEY $REPOSITORY_BASE || FATAL "SO install failed" |
| 967 | $OSM_DEVOPS/jenkins/host/install UI $REPOSITORY $RELEASE $REPOSITORY_KEY $REPOSITORY_BASE || FATAL "UI install failed" |
| 968 | #so_is_up && track SOUI |
| 969 | track SOUI |
| 970 | fi |
| 971 | |
| 972 | #Install iptables-persistent and configure NAT rules |
| 973 | [ -z "$NOCONFIGURE" ] && nat |
| 974 | |
| 975 | #Configure components |
| 976 | [ -z "$NOCONFIGURE" ] && configure |
| 977 | |
| 978 | #Install osmclient |
| 979 | [ -z "$NOCONFIGURE" ] && install_osmclient |
| 980 | |
| 981 | #Install vim-emu (optional) |
| peusterm | 76353e4 | 2018-05-08 13:56:05 +0200 | [diff] [blame] | 982 | [ -n "$INSTALL_VIMEMU" ] && install_docker_ce && install_vimemu |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 983 | |
| 984 | wget -q -O- https://osm-download.etsi.org/ftp/osm-4.0-four/README2.txt &> /dev/null |
| 985 | track end |
| 986 | echo -e "\nDONE" |
| 987 | |