# Upgrade cnvrg app version

# Requirements

  • kubectl access to the main cluster (where cnvrg app is deployed)

# Pre-requisites

  1. Verify operator is up
kubectl -n cnvrg get pods -l control-plane=cnvrg-operator

example output:

NAME                              READY   STATUS    RESTARTS   AGE
cnvrg-operator-5bc5b84df7-rgb4k   1/1     Running   0          97m
  1. Identify the current cnvrg-operator version.
kubectl -n cnvrg get pods -l control-plane=cnvrg-operator -o jsonpath='{.items[0].spec.containers[0].image}'

example output:

docker.io/cnvrg/cnvrg-operator:4.2.3

means the cnvrg-operator version is 4.2.3

  1. Identify the current app version
kubectl -n cnvrg get pods -l cnvrg-component=webapp -o jsonpath='{.items[0].spec.containers[0].image}'

example output:

docker.io/cnvrg/app:v4.7.100

means the cnvrg-app version is 4.7.100

  1. Verify operator is reconciled at 100%
kubectl -n cnvrg get cnvrgapp

example output:

NAME        VERSION                                        STATUS   MESSAGE
cnvrg-app   app:v4.7.100   READY    successfully reconciled, ready (100%)
  1. Verify migration history, the last one should be in status up
kubectl -n cnvrg exec -it deploy/app -c cnvrg-app -- rails db:migrate:status

example output:

Status   Migration ID    Migration Name
--------------------------------------------------
   up     20160825191637  Devise create users
   up     20160827130520  Create projects
   up     20160827131145  Create posts
   up     20160828080753  Add slug and desc to project
   ....

NOTE

If all is well please reach out to cnvrg personnel (providing the versions above), and check if an update is available. Once the upgrade was approved by cnvrg personnel, and the new app version tag has been provided, you can continue to perform the upgrade.

# Update must be done with cnvrg.io support/delivery team in the following cases

  1. If operator is down
  2. If operator is v3
  3. If some migrations have down status

# Upgrade

  1. Set new app image
CNVRG_APP_VERSION=cnvrg/app:Image chosen form release notes
## for example:
## CNVRG_APP_VERSION=cnvrg/app:v4.7.99
  1. Patch new image in cnvrgapp CRD
kubectl -n cnvrg patch cnvrgapp cnvrg-app --type=merge -p '{"spec": {"controlPlane": {"image": "'$CNVRG_APP_VERSION'"}}}'
  1. Make sure all pods have rolled (old ones terminated, new ones are up)
watch "kubectl -n cnvrg get pods | grep -e app -e kiq"
  1. Check all migrations ran successfully, the last one should be in up status
kc exec -it deploy/app -c cnvrg-app -- rails db:migrate:status

example output:

Status   Migration ID    Migration Name
--------------------------------------------------
   up     20160825191637  Devise create users
   up     20160827130520  Create projects
   up     20160827131145  Create posts
   up     20160828080753  Add slug and desc to project
   ....

# Notes

⚠️ All of the migrations should be with status up
If some are down, find the first one that returned down and take it’s id/VERSION 
and then get someone from the cnvrg.io support team involved ASAP
Last Updated: 4/16/2024, 11:58:26 AM