> For the complete documentation index, see [llms.txt](https://docs.openg2p.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.openg2p.org/products/open-agri-stack/deployment/upgrades-and-uninstall.md).

# Upgrades and Uninstall

Upgrading and uninstalling.

## Upgrading

Each install is upgraded on its own, in Rancher (**Apps → Installed Apps → ⋮ → Edit/Upgrade**): pick the new chart version, keep the values, **Upgrade**. The Exchange and each department can upgrade on their own schedules. There is no upgrade script and no Agri Stack-wide version yet.

| Install                        | On upgrade                                                                                            | Notes                                                                                                                                                                                                                                                                                                                             |
| ------------------------------ | ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Commons Base, Commons Services | Each component's own Jobs and sanity checks run again                                                 | [Commons Helm chart](https://docs.openg2p.org/operations/deployment/infrastructure-setup/environment-setup-multi-node/openg2p-commons-helm-chart.md); the CM's sanity suite runs on every upgrade ([CM deployment](https://docs.openg2p.org/platform/platform-services/consent-management/deployment.md#sanity-tests-in-cluster)) |
| Farmer Registry                | The db-seed and sanity hook Jobs run again                                                            | [Data seeding](https://docs.openg2p.org/products/registry/farmer-registry/deployment/data-seeding.md#install-sequence)                                                                                                                                                                                                            |
| Crop Sown Registry             | The seed runs again (idempotent); activity types, indicators and the ODK mapping are updated in place | [Crop Sown Registry → Deployment](https://docs.openg2p.org/products/registry/crop-sown-registry/deployment.md); [upgrading an early install](https://docs.openg2p.org/products/registry/crop-sown-registry/versions.md#upgrading-an-early-install)                                                                                |
| Composite                      | The console's database Job (idempotent), its IAM registration and the sanity hook run again           | Below                                                                                                                                                                                                                                                                                                                             |

**Composite.**

* **Image versions:** **Image Tag** and **Console UI Image Tag**. The chart's default `develop` moves (pulled on every pod start); pin a released version in production.
* **Use cases:** a change to `composite.useCases` (or your own ConfigMap) is picked up by running pods within the reload interval, without a restart or a chart upgrade.
* **Registries and other settings** are environment variables: changing them rolls the pods.
* **Signing key:** kept on every upgrade (the chart reads its Secret back).
* **After a use case with new data scopes or purposes,** each department decides whether to widen the Composite's scope policy ([Releasing Registry Data to the Composite](https://docs.openg2p.org/products/open-agri-stack/administration/releasing-data-to-the-composite.md#when-use-cases-change)).

After any upgrade, check the Composite, the CMs and the registries' partner APIs together: run the [test](https://docs.openg2p.org/products/open-agri-stack/deployment/testing.md).

**Upgrading an install from before the generated key.** The Exchange questions of Commons Services moved under `global.agriStackExchange` (so Partner Management sees the role too). On the upgrade form, set **Exchange Role** again (and **Exchange Domain** where used): left at `none`, it overrides the earlier answer. Such an install keeps its Composite key and Partner Management entries; rotating it later: [Keys: an older install](https://docs.openg2p.org/products/open-agri-stack/administration/keys.md#an-older-install).

Rotating keys: [Keys](https://docs.openg2p.org/products/open-agri-stack/administration/keys.md).

## Uninstalling

`helm uninstall` leaves databases, IAM rows and some Secrets behind. Use each product's script, with `--dry-run` first.

| What               | Script                                                                                                                                                                                                                                                       | Notes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Composite          | [`scripts/uninstall-agri-composite.sh`](https://github.com/openg2p/agri-stack/blob/develop/scripts/uninstall-agri-composite.sh) `--namespace <ns> [--release agri-composite] [--keep-db] [--keep-iam] [--drop-signing-secret] [--force] [--dry-run] [--yes]` | Removes the release, leftover Jobs, and the ConfigMaps and Secrets labelled with the release; drops the console's database `agri_composite` and its role in `commons-postgresql` (unless `--keep-db`) and deletes the console's IAM rows (unless `--keep-iam`); the signing Secret only with `--drop-signing-secret`. Other options: `--console-db`, `--console-db-user`, `--console-mnemonic`, `--iam-db`, `--postgres-release`, `--postgres-namespace`, `--signing-secret`. `--force` runs while a Helm operation is in progress. Leaves the console's Keycloak client. No PVCs |
| Crop Sown Registry | [`scripts/uninstall-registry.sh`](https://github.com/OpenG2P/crop-sown-registry/blob/develop/scripts/uninstall-registry.sh) `--namespace <ns> [--release csr] [--keep-iam] [--keep-pvs] [--dry-run] [--yes]`                                                 | Also drops the registry's database and role in `commons-postgresql`, its IAM rows, PVCs and their PVs ([Uninstall](https://docs.openg2p.org/products/registry/crop-sown-registry/deployment/rancher.md#uninstall))                                                                                                                                                                                                                                                                                                                                                                |
| Farmer Registry    | [`scripts/uninstall-registry.sh`](https://github.com/OpenG2P/farmer-registry/blob/develop/scripts/uninstall-registry.sh) `--namespace <ns> --release fr [--keep-iam] [--keep-dashboards] [--dry-run] [--yes]`                                                | As above, and first removes the registry's Superset dashboards (its default release name is `registry`, so give `--release fr`)                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Commons            | `helm uninstall` of `commons-services`, then `commons`                                                                                                                                                                                                       | [Commons Helm chart: tear down](https://docs.openg2p.org/operations/deployment/infrastructure-setup/environment-setup-multi-node/openg2p-commons-helm-chart.md#tear-down)                                                                                                                                                                                                                                                                                                                                                                                                         |

None of the scripts touches Partner Management or the Consent Manager. The partners, their keys and their policies stay in Partner Management: in the Exchange, the Composite and the partners with their use-case policies; in each department, the Composite with its key and scope policies. If needed, disable the partners or revoke their policies there with a policy request ([access policies](https://docs.openg2p.org/platform/platform-services/partner-management/functional-specifications.md#access-policies)).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.openg2p.org/products/open-agri-stack/deployment/upgrades-and-uninstall.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
