Upgrade Platforma
Install a new version of the Backend, and return to the old version if the upgrade causes problems.
An upgrade replaces the BackendBackend — The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs. Glossary with a new version, while your projects and results stay where they are. Jobsjob — One run of a tool on data. The Backend starts jobs on the server where it runs, or in a Kubernetes cluster. Glossary that run in the cluster continue, and the Desktop AppDesktop App — The program that each user installs on their own computer to work with Platforma. It is a client of the Backend. Glossary connects again by itself after a short break.
The new version can change the format of the database when it starts for the first time. An older version cannot start on that database again. So a fresh backup and the name of the old version are your way back: you get both in the steps before the upgrade.
Upgrade to the most recent release: you can go to it directly from any older version, and you do not need to install the versions between them. Only the most recent release gets fixes. See Supported versions.
Before the upgrade
-
Read what changes. Read the release notes of the new version, and of each version that you skip: a major version can change the configuration. Check whether it needs a newer Desktop App: if it does, plan to upgrade the Desktop App on the computers of the users at the same time. The Desktop App and the Backend have their own versions.
-
Write down the version that runs now. You need it to go back.
Tool: CloudFormation template
Terminal window kubectl get deployment platforma -n platforma \-o jsonpath='{.spec.template.spec.containers[?(@.name=="platforma")].image}{"\n"}{.metadata.labels.helm\.sh/chart}{"\n"}'Result: the image, for example
quay.io/milaboratories/platforma:4.7.0, and the chart, for exampleplatforma-4.7.0: the chart version is4.7.0.Also save the template of the stack. You need it to go back:
Terminal window aws cloudformation get-template --stack-name <stack-name> \--query TemplateBody --output text > template-before-upgrade.yamlTool: install.sh in Cloud Shell
Terminal window kubectl get deployment platforma -n platforma \-o jsonpath='{.spec.template.spec.containers[?(@.name=="platforma")].image}{"\n"}{.metadata.labels.helm\.sh/chart}{"\n"}'Result: the image and the chart. Also write down the release tag of
platforma-helmthat you installed from,git -C platforma-helm describe --tags, and check that you have the file of the answers that you saved at the installation.Tool: platforma-tf-* modules (cloud and cloud-agnostic)
Terminal window kubectl get deployment platforma -n platforma \-o jsonpath='{.spec.template.spec.containers[?(@.name=="platforma")].image}{"\n"}{.metadata.labels.helm\.sh/chart}{"\n"}'Result: the image and the chart. In the root
services,terraform output releasealso shows the chart version and the app version, andterraform output versionsthe contract version and the chart version. In the rootcluster,terraform output versionsshows the versions of KueueKueue — A Kubernetes add-on that holds jobs in a queue until the cluster has free CPU, memory and GPU for them. Glossary and AppWrapperAppWrapper — A Kubernetes add-on that wraps the pods of one job into a single unit, so that Kueue admits and starts them together. Glossary.Also write down the release tag of platforma-install that you applied, for example with
git -C <platforma-install> describe --tags, and keep this clone until the new version works well.Tool: platforma-backend
Terminal window kubectl get deployment platforma -n platforma \-o jsonpath='{.spec.template.spec.containers[?(@.name=="platforma")].image}{"\n"}{.metadata.labels.helm\.sh/chart}{"\n"}'helm get values platforma -n platforma -o yaml > values-before-upgrade.yamlResult: the image, the chart version, and your current values in
values-before-upgrade.yaml.Tool: platforma binary
Terminal window /opt/platforma/binaries/platforma --versionYou keep the folder of the old version during the upgrade, until the new version works well.
-
Check that the installation is healthy. Do not start an upgrade on an installation that already has problems: after the upgrade, you cannot tell which problems the upgrade caused. Connect with the Desktop App, open a project, and check that its results are there. Then check the Backend:
Tool: CloudFormation template
Terminal window kubectl get pods -n platforma -l app.kubernetes.io/instance=platformakubectl get pods -n kueue-systemkubectl get pods -n appwrapper-systemResult: all pods are
Running, with no recent restarts.Tool: install.sh in Cloud Shell
Terminal window kubectl get pods -n platforma -l app.kubernetes.io/instance=platformakubectl get pods -n kueue-systemkubectl get pods -n appwrapper-systemResult: all pods are
Running, with no recent restarts.Tool: platforma-tf-* modules (cloud and cloud-agnostic)
Terminal window kubectl get pods -n platforma -l app.kubernetes.io/instance=platformakubectl get pods -n kueue-systemkubectl get pods -n appwrapper-systemResult: all pods are
Running, with no recent restarts.Tool: platforma-backend
Terminal window kubectl get pods -n platforma -l app.kubernetes.io/instance=platformakubectl get pods -n kueue-systemkubectl get pods -n appwrapper-systemResult: all pods are
Running, with no recent restarts.Tool: platforma binary
Terminal window sudo systemctl status platformaResult:
active (running), and the service did not restart recently. -
Tell the users. The Backend restarts during the upgrade, and the Desktop App loses its connection for a short time. Choose a time when few people work.
-
Make a fresh backup. Follow Make a backup now, and copy the backup out of the installation. Keep it until you are sure that the new version works well.
Upgrade
Tool: CloudFormation template
Update the stack with a change set from the template of the new release: see Upgrade to a new version on the page “Update an installer installation”.
Tool: install.sh in Cloud Shell
Run install.sh of the new release tag with the answers that you saved: see
Upgrade to a new version on the
page “Update an installer installation”.
Tool: platforma-tf-* modules (cloud and cloud-agnostic)
A release of the modules pins the versions of the charts: platforma-tf-services pins the chart
platforma-backend, whose app version is the version of the Backend, and
platforma-tf-services-cluster pins Kueue and AppWrapper. An input cannot change these versions.
To upgrade, you apply a new release of the modules, root by root, in the order of the
installation. Each module checks its inputs at plan time and stops the plan at a wrong value.
-
Get the new release of platforma-install: its new release tag. See Where the modules are.
Get the new release into the same clone:
Terminal window git -C <platforma-install> fetch --tagsgit -C <platforma-install> checkout <new release tag>The state files, the files
terraform.tfvarsand the hand-off files stay in place: git ignores them.Get the new release into the clone that
chart_repositorypoints to, with the commands of the tab AWS or Google Cloud. Incluster/main.tfandservices/main.tf, change the tag inref=ofsourceto the new release tag. The plan stops when the folder of the charts does not hold the version that the module pins.services/main.tf module "platforma" {source = "git::https://github.com/milaboratory/platforma-install.git//terraform/cloud-agnostic/platforma-tf-services?ref=<new release tag>"namespace = "platforma"infrastructure = jsondecode(file("../handoff/infrastructure.json"))backend_service = {chart_repository = "<platforma-install>/helm/charts"# the other values stay the same}}When the cluster gets the charts and the images from mirrors, copy the new versions into the mirrors first: the README of each module lists the versions that it pins. See Registries mirroring.
If you set
backend_service.backend.image.tag, the Backend stays at that version. Change the tag too, or remove it: then the image has the app version of the new chart. -
Apply the root
cloud. Only for AWS and Google Cloud. Read the plan before you apply it. When the plan changes the nodes of a job pool, apply it when no job runs: see Upgrade the nodes.Terminal window cd <platforma-install>/terraform/<cloud>/examples/cloud # <cloud> is aws or gcpterraform init -upgradeterraform plan -out=upgrade.tfplanterraform apply upgrade.tfplanterraform output -json platforma_infrastructure > ../handoff/platforma-infrastructure.jsonterraform output -json cluster_connection > ../handoff/cluster-connection.json -
Apply the root
cluster. When the new release pins new versions of Kueue and AppWrapper, this apply upgrades them. The jobs that run continue, and the jobs in the queues wait and start when the new controllers are ready. While the controllers restart, the cluster can refuse new jobs for a short time: apply this root when few jobs start. Helm waits up to 10 minutes until each controller is ready, and goes back to the old version if it is not.Terminal window cd ../clusterTerminal window cd clusterTerminal window terraform init -upgradeterraform plan -out=upgrade.tfplanterraform apply upgrade.tfplanterraform output -json infrastructure > ../handoff/infrastructure.jsonterraform output versionsResult:
versionsshows the new versions of Kueue and AppWrapper, and the pods in the namespaceskueue-systemandappwrapper-systemareRunning. -
Apply the root
services. The new chart changes the image of the Backend, so the Backend restarts: see Restart of the Backend. The apply waits until the Backend is ready.Terminal window cd <platforma-install>/terraform/cloud-agnostic/examples/servicesterraform init -upgradeterraform plan -out=upgrade.tfplan \-var infrastructure_file=../../../<cloud>/examples/handoff/infrastructure.json \-var cluster_connection_file=../../../<cloud>/examples/handoff/cluster-connection.jsonterraform apply upgrade.tfplanTerminal window cd ../servicesterraform init -upgradeterraform plan -out=upgrade.tfplanterraform apply upgrade.tfplanResult:
terraform output releaseshows the new chart version and app version.
Each release of a module accepts a fixed list of
contract versions: the README of the new
release lists them. When the new platforma-tf-services accepts the contract version of the old
release, the root services can go first, when the infrastructure is not ready for the new
version. If it does not accept the old one, apply all roots. To change the
inputs of a root after the upgrade, see
Install in cloud with Terraform or
Install in custom infrastructure.
Tool: platforma-backend
helm upgrade platforma oci://ghcr.io/milaboratory/platforma-install/platforma-backend \ --version <new-chart-version> -n platforma -f values-before-upgrade.yamlThe chart is also in the folder helm/charts/platforma-backend of
platforma-install, at each release tag. To
install from a clone of the new release tag, use the path of this folder in place of the OCI
address and remove --version.
Tool: platforma binary
-
Stop the Backend:
sudo systemctl stop platforma. -
Check that the Backend stopped.
Check that the BackendBackend — The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs. Glossary stopped:
Terminal window systemctl is-active platformapgrep -fa /opt/platforma/binaries/platformaResult: the first command prints
inactive, and the second command prints nothing. If a process is still there, wait and run the commands again. Do not continue while the process exists: it can still write to the database. -
Copy
/data/platformato a safe place, if you did not do it in Before the upgrade. -
Replace the program. Move the old program aside, then get the new release as in the installation:
Terminal window sudo mv /opt/platforma /opt/platforma-oldsudo mkdir /opt/platformacurl -fL -o /tmp/platforma.tgz https://dl.platforma.bio/software/platforma-backend/pl-linux-amd64.tgzsudo tar -xzf /tmp/platforma.tgz -C /opt/platforma/opt/platforma/binaries/platforma --versionResult: the command shows the new version. Keep
/opt/platforma-olduntil the new version works well. -
Start the Backend:
sudo systemctl start platforma.
The data in /data/platforma stays in place.
After the upgrade
-
The Backend runs. The first start after an upgrade can take longer, because the Backend converts the database to the new format. Do not restart the Backend during this time.
The same rule applies on all paths when the conversion stops, for example when an apply or a stack update fails, or the server restarts. Do not deploy the old version: it does not start on a converted database. Start the new version again, and the conversion continues from the last step that it finished.
Tool: CloudFormation template
Terminal window kubectl get pods -n platforma -l app.kubernetes.io/instance=platformaResult: the BackendBackend — The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs. Glossary pod is
RunningandReady.If the pod does not become
Ready, read its recent output. This output shows only the failures at start. The full log is in/var/log/platformain the Backend container.Terminal window kubectl logs deployment/platforma -n platforma -c platforma --tail=50Tool: install.sh in Cloud Shell
Terminal window kubectl get pods -n platforma -l app.kubernetes.io/instance=platformaResult: the BackendBackend — The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs. Glossary pod is
RunningandReady.If the pod does not become
Ready, read its recent output. This output shows only the failures at start. The full log is in/var/log/platformain the Backend container.Terminal window kubectl logs deployment/platforma -n platforma -c platforma --tail=50Tool: platforma-tf-* modules (cloud and cloud-agnostic)
Terminal window kubectl get pods -n platforma -l app.kubernetes.io/instance=platformaResult: the BackendBackend — The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs. Glossary pod is
RunningandReady.If the pod does not become
Ready, read its recent output. This output shows only the failures at start. The full log is in/var/log/platformain the Backend container.Terminal window kubectl logs deployment/platforma -n platforma -c platforma --tail=50Tool: platforma-backend
Terminal window kubectl get pods -n platforma -l app.kubernetes.io/instance=platformaResult: the BackendBackend — The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs. Glossary pod is
RunningandReady.If the pod does not become
Ready, read its recent output. This output shows only the failures at start. The full log is in/var/log/platformain the Backend container.Terminal window kubectl logs deployment/platforma -n platforma -c platforma --tail=50Tool: platforma binary
Terminal window sudo systemctl status platformaResult:
active (running). If the Backend does not start, read its recent output:Terminal window sudo journalctl -u platforma -n 50 -
The Backend has the new version. Run the command from Before the upgrade, step 2, again.
-
Your projects are there. In the Desktop App, open an existing project and check its results.
-
Jobs run. Run a small BlockBlock — A small application for one step of an analysis, for example the import of reads or clustering. It can combine several tools. Glossary and check that its job starts and finishes.
Go back to the old version
Contact MiLaboratories support first. Go back to the old version only when support cannot fix the problem quickly, because the database returns to the state of the backup:
- All changes that users made after the backup are lost. Results made after the backup stay in the storage, but no project refers to them.
- Some results that existed at the time of the backup can be gone, because the new version can delete them. Run their Blocks again, or get the files back with the versioning or soft delete of the bucket.
-
Restore the backup.
Tool: CloudFormation template
Follow Restore up to the step “Start the BackendBackend — The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs. Glossary”. In the restore pod, use the old image that you wrote down before the upgrade.
Tool: install.sh in Cloud Shell
Follow Restore up to the step “Start the BackendBackend — The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs. Glossary”. In the restore pod, use the old image that you wrote down before the upgrade.
Tool: platforma-tf-* modules (cloud and cloud-agnostic)
Follow Restore up to the step “Start the BackendBackend — The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs. Glossary”. In the restore pod, use the old image that you wrote down before the upgrade.
Tool: platforma-backend
Follow Restore up to the step “Start the BackendBackend — The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs. Glossary”. In the restore pod, use the old image that you wrote down before the upgrade.
Tool: platforma binary
Follow Restore. Before you start the Backend, put the old program back in place:
sudo rm -rf /opt/platforma && sudo mv /opt/platforma-old /opt/platforma. -
Deploy the old version. This also starts the Backend.
Tool: CloudFormation template
Update the stack with the template that you saved before the upgrade,
template-before-upgrade.yaml. In the console, select Update, then Replace existing template, then Upload a template file. Check that the parameterPlatformaVersionis the chart version that you wrote down.Tool: install.sh in Cloud Shell
In your
platforma-helmfolder, check out the release that you wrote down (git checkout <tag>). Then runbash install.shagain with the same answers. For a later uninstall, use theteardown.shof this release: see Uninstall an installer installation.Tool: platforma-tf-* modules (cloud and cloud-agnostic)
Put every root back to the old release that you wrote down, and apply each root in the order of the installation, with the commands of Upgrade, steps 2 to 4. To apply only the root
serviceswith the old release is not supported. In place of going back, you can also apply a new release with a fix.Get the old release into the clone, for example with
git -C <platforma-install> checkout <old release tag>.Get the old release into the clone, for example with
git -C <platforma-install> checkout <old release tag>, and change the tag inref=back to the old release tag incluster/main.tfandservices/main.tf.Tool: platforma-backend
Terminal window helm upgrade platforma oci://ghcr.io/milaboratory/platforma-install/platforma-backend \--version <old-chart-version> -n platforma -f values-before-upgrade.yamlTool: platforma binary
You did this in step 1.
-
Check the old version with the steps of After the upgrade.
Upgrade the nodes
A job fails when its node stops. Upgrade the nodes of the Platforma pools when no job runs. In a
cluster without an autoscaler, after a change of the nodes of a job pool, apply
platforma-tf-services-cluster again, so that the quotas match the new nodes.