diff --git a/19-lts-upgrade.md b/19-lts-upgrade.md index 1153235ec1221d167bfc9698854a28aa0162b29a..119064c74fd70887900d528c68cb8c220086ee67 100644 --- a/19-lts-upgrade.md +++ b/19-lts-upgrade.md @@ -4,6 +4,118 @@ Starting with version 10.1.0 of OSM, every even numbered release will receive two years of community support. This document covers the steps needed for upgrading OSM. Depending on the installation method, there are two methods for upgrading OSM to an LTS version. +## Upgrade of 10.1.0 to 10.1.1 LTS + +This procedure covers both the upgrade of 10.1.0 to 10.1.1 LTS. There are two installation methods, each with its own set of procedures: + +* [Kubernetes Installation Option](#kubernetes-installation-to-1011) +* [Charmed Installation Option](#charmed-installation-to-1011) + +### Kubernetes Installation to 10.1.1 + +#### Back up the Databases + +If desired, the databases can be backed up using the following commands: + +```bash +mysql_pod=$(kubectl get pod -n osm | grep -i mysql | tail -1 | awk -F" " '{print $1}') +kubectl exec -n osm -it $mysql_pod -- bash -c \ + 'mysqldump -u root -p$MYSQL_ROOT_PASSWORD --single-transaction --all-databases' \ + | gzip > backup.sql.gz + +mongodb_unit=$(juju status | grep -i mongodb | tail -1 | awk -F" " '{print $1}'| tr -d '[*]') +mongodb_pod=$(kubectl get pod -n osm | grep -i mongodb | grep -v operator | tail -1 | awk -F" " '{print $1}') +juju run-action $mongodb_unit backup --wait -m osm +kubectl cp osm/$mongodb_pod:/data/backup.archive backup.archive +``` + +#### Upgrade Juju + +The following commands will upgrade the OSM controller. + +```bash +sudo snap refresh juju --channel 2.9/stable +juju upgrade-controller +``` + +Next, for any native or proxy charms, upgrade each model. + +```bash +for model in $(juju models --format json | jq .models[].name | tr -d \") ; do + juju switch $model + juju upgrade-model +done +``` + +#### Upgrade OSM Application + +```bash +OSM_VERSION="10.1.1" +for module in lcm mon nbi ng-ui pla pol ro; do + kubectl -n osm patch deployment ${module} --patch '{"spec": {"template": {"spec": {"containers": [{"name": "${module}", "image": "opensourcemano/${module}:${OSM_VERSION}"}]}}}}' + kubectl -n osm scale deployment ${module} --replicas=0 + kubectl -n osm scale deployment ${module} --replicas=1 +done +# In order to make this change persistent after reboots, +# you will have to update the files under /etc/osm/docker/osm_pods to reflect the changes +for module in lcm mon nbi ng-ui pol ro; do + sudo sed -i "s/opensourcemano\/${module}:.*/opensourcemano\/${module}:${OSM_VERSION}/g" /etc/osm/docker/osm_pods/${module}.yaml +done +sudo sed -i "s/opensourcemano\/pla:.*/opensourcemano\/pla:${OSM_VERSION}/g" /etc/osm/docker/osm_pods/osm_pla/${module}.yaml +``` + +At this point, OSM has been upgraded. + +### Charmed Installation to 10.1.1 + +#### Back up the Databases + +If desired, the databases can be backed up using the following commands: + +```bash +mariadb_unit=$(juju status | grep -i mariadb | tail -1 | awk -F" " '{print $1}' | tr -d '[*]') +mariadb_pod=$(microk8s.kubectl get pod -n osm | grep -i mariadb | tail -1 | awk -F" " '{print $1}') +juju run-action $mariadb_unit backup --wait -m osm +microk8s.kubectl cp osm/$mariadb_pod:/var/lib/mysql/backup.sql.gz backup.sql.gz + +mongodb_unit=$(juju status | grep -i mongodb | tail -1 | awk -F" " '{print $1}'| tr -d '[*]') +mongodb_pod=$(microk8s.kubectl get pod -n osm | grep -i mongodb | tail -1 | awk -F" " '{print $1}') +microk8s.kubectl exec -n osm -it $mongodb_pod -- mongodump --gzip --archive=/data/backup.archive +microk8s.kubectl cp osm/$mongodb_pod:/data/backup.archive backup.archive +``` + +#### Upgrade Juju + +The following commands will upgrade the OSM controller. + +```bash +sudo snap refresh juju --channel 2.9/stable +juju upgrade-controller +``` + +Next, for any native or proxy charms, upgrade each model. + +```bash +for model in $(juju models --format json | jq .models[].name | tr -d \") ; do + juju switch $model + juju upgrade-model +done +``` + +#### Upgrade OSM Application + +```bash +juju attach-resource -m osm lcm image=opensourcemano/lcm:10.1.1 +juju attach-resource -m osm mon image=opensourcemano/mon:10.1.1 +juju attach-resource -m osm nbi image=opensourcemano/nbi:10.1.1 +juju attach-resource -m osm ng-ui image=opensourcemano/ng-ui:10.1.1 +juju attach-resource -m osm pla image=opensourcemano/pla:10.1.1 +juju attach-resource -m osm pol image=opensourcemano/pol:10.1.1 +juju attach-resource -m osm ro image=opensourcemano/ro:10.1.1 +``` + +At this point, OSM has been upgraded. + ## Upgrade of Pre-LTS to 10.1.0 LTS This procedure covers both upgrade from 9.1.5 or 10.0.3 to 10.1.0 LTS. Where necessary, additional steps for 9.1.5 are shown. There are two installation methods, each with its own set of procedures: