> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/tposs/latest/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/tposs/latest/installation/upgrade-tposs.md).

# Upgrading TPOSS

This document describes how to upgrade a TPOSS deployment to a new version and how to roll it back. For the placeholders used in the commands below, see the [Placeholders](https://docs.cennso.com/components/tposs/latest/installation/installation.md#placeholders) section of the installation document.

## Upgrade TPOSS

> [!IMPORTANT]
> For more detailed information, read the release notes and the migration guide. While it is sufficient for some applications to be simply upgraded and restarted, others might need some more specific actions to work properly after an update (for example, configuration changes or database migrations).

To upgrade TPOSS, run `helm upgrade` with the new chart version and image tag:

```bash
helm upgrade {HELM_RELEASE_NAME} oci://{REGISTRY_HOST}/charts/tposs --version {NEW_CHART_VERSION} -f values.yaml --set image.tag={NEW_TPOSS_IMAGE_TAG} -n {NAMESPACE}
```

Pass the same values file you used during installation. Helm replaces the whole value set on every upgrade, so the options missing from the file fall back to the chart defaults.

If you changed only the configuration and not the image, the pods keep running with the old values. TPOSS reads its configuration from a ConfigMap, and updating that ConfigMap leaves the pod specification unchanged, so Kubernetes does not recreate the pods.

Restart the pods to apply the new configuration:

```bash
kubectl rollout restart statefulset {HELM_RELEASE_NAME}-tposs -n {NAMESPACE}
```

## Roll back TPOSS

If an upgrade does not work as expected, roll the Helm release back to one of the previous revisions. To list the revisions of the release, use this command:

```bash
helm history {HELM_RELEASE_NAME} -n {NAMESPACE}
```

To roll back to the given revision, use this command:

```bash
helm rollback {HELM_RELEASE_NAME} {REVISION} -n {NAMESPACE}
```

> [!CAUTION]
> Helm rolls back the chart and its configuration, but not the TPOSS database schema. If the upgrade applied database migrations, read the migration guide in the release notes before you roll back.

To revert the last applied database migration, use this command:

```bash
kubectl exec {HELM_RELEASE_NAME}-tposs-0 -n {NAMESPACE} -- ./run.sh downgrade
```

Each run of this command reverts one migration.
