Skip to content
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
b5a067c
feat(#1949): Preparing for CHT 5.0, remove existing upgrades dir
mrjones-plip Aug 8, 2025
b12ecb0
add all breaking changes, settle on final layout of page
mrjones-plip Aug 18, 2025
eed8d14
Update content/en/hosting/cht/migration/preparing-for-5.md
mrjones-plip Aug 19, 2025
28c8a80
move links to relref and remove localhost per feedback
mrjones-plip Aug 22, 2025
91e494c
4.20 is not 4.2.0 ;)
mrjones-plip Aug 22, 2025
390decf
add related updates section per feedback
mrjones-plip Aug 22, 2025
3e952b4
add two more breaking changes to the list
mrjones-plip Sep 3, 2025
8da6b82
Update content/en/hosting/cht/migration/preparing-for-5.md
mrjones-plip Sep 8, 2025
c03cd43
merge main to branch
mrjones-plip Sep 10, 2025
1de6800
fix merge conflict from main merge on last commit
mrjones-plip Sep 10, 2025
8290919
order by breaking changes vs non-breaking changes per feedback
mrjones-plip Sep 10, 2025
7dfff48
add more explination to language setting
mrjones-plip Sep 10, 2025
dd553bb
move from tk to todo (but still keep tks)
mrjones-plip Sep 10, 2025
359562f
remove repetive content per feedback
mrjones-plip Sep 11, 2025
dd08c0e
Merge branch 'main' into 1949-preparing-for-5x
mrjones-plip Sep 11, 2025
9ffb120
Merge branch 'main' into 1949-preparing-for-5x
mrjones-plip Sep 23, 2025
2372a63
add info about needs_signoff change
mrjones-plip Sep 23, 2025
bd5a22f
Merge branch 'main' into 1949-preparing-for-5x
mrjones-plip Oct 4, 2025
81945fb
add info for checking chrome version for angular 20
mrjones-plip Oct 4, 2025
d36ed8d
fix angular link, ensure CLI tools are installed
mrjones-plip Oct 5, 2025
3540494
tweak wording about angular, re-order steps
mrjones-plip Oct 7, 2025
2211e43
tidy up big ol' command to find browser versions
mrjones-plip Oct 7, 2025
e5cf530
Merge branch 'main' into 1949-preparing-for-5x
mrjones-plip Oct 7, 2025
ece15a9
add work around for upgrade crashing
mrjones-plip Oct 20, 2025
711bfbc
Merge branch 'main' into 1949-preparing-for-5x
mrjones-plip Oct 20, 2025
d957c70
add final links to helm chart info
mrjones-plip Oct 29, 2025
f04f644
Merge branch 'main' into 1949-preparing-for-5x
mrjones-plip Oct 29, 2025
6920b11
add final info for Declarative Configuration
mrjones-plip Oct 29, 2025
c13de56
Update content/en/hosting/cht/migration/preparing-for-5.md
mrjones-plip Oct 29, 2025
1e41198
Update content/en/hosting/cht/migration/preparing-for-5.md
mrjones-plip Oct 29, 2025
ee0ca15
Update content/en/hosting/cht/migration/preparing-for-5.md
mrjones-plip Oct 29, 2025
b4ed013
Update content/en/hosting/cht/migration/preparing-for-5.md
mrjones-plip Oct 29, 2025
8caf2d3
Update content/en/hosting/cht/migration/preparing-for-5.md
mrjones-plip Oct 29, 2025
9836d22
Update content/en/hosting/cht/upgrade-troubleshooting.md
mrjones-plip Oct 29, 2025
aef3265
Update content/en/hosting/cht/upgrade-troubleshooting.md
mrjones-plip Oct 29, 2025
41df9ab
Update content/en/hosting/cht/upgrade-troubleshooting.md
mrjones-plip Oct 29, 2025
4da46ca
Update content/en/hosting/cht/migration/preparing-for-5.md
mrjones-plip Oct 29, 2025
a56c158
Update content/en/hosting/cht/migration/preparing-for-5.md
mrjones-plip Oct 29, 2025
b2073fb
Update content/en/hosting/cht/migration/preparing-for-5.md
mrjones-plip Oct 29, 2025
905c49f
Update content/en/hosting/cht/migration/preparing-for-5.md
mrjones-plip Oct 29, 2025
406748a
Update content/en/hosting/cht/migration/preparing-for-5.md
mrjones-plip Oct 29, 2025
10714c8
Update content/en/hosting/cht/migration/preparing-for-5.md
mrjones-plip Oct 29, 2025
7d24f6c
remove upgrade warning per feedback
mrjones-plip Oct 29, 2025
fa2872c
add k8s staging screenshot, tidy up helm chart wording per feedback
mrjones-plip Oct 29, 2025
54e1559
remove empty dir and files per feedback
mrjones-plip Oct 29, 2025
d6b1206
add front matter to helm charts migrate page, change weights for toc …
mrjones-plip Oct 29, 2025
ae895a6
remove note about self hosting in 4.x per feedback
mrjones-plip Oct 29, 2025
6dcdf61
remove confusing line about language settings UI
mrjones-plip Oct 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: >

aliases:
- /apps/guides/updates/collect-forms-update
- /building/guides/updates/collect-forms-update
- /building/guides/updates/collect-forms-update/
---

To do over the air Medic Collect form updates via HTTP rather than sending APKs which have a long manual install process, follow the steps below:
Expand Down
3 changes: 1 addition & 2 deletions content/en/hosting/cht/migration/preparing-for-4.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
title: "Preparing to upgrade to CHT 4.0"
linkTitle: "Preparing to upgrade to CHT 4.0"
linkTitle: "Preparing for 4.0"
weight:
aliases:
- /apps/guides/hosting/3.x/preparing-for-4.0
- /apps/guides/updates/preparing-for-4.md
- /apps/guides/updates/preparing-for-4/
- /building/guides/updates/preparing-for-4/
date: 2022-09-01
description: >
Steps to ensure your CHT App will run smoothly on CHT 4.0 and later

Expand Down
161 changes: 161 additions & 0 deletions content/en/hosting/cht/migration/preparing-for-5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
---
title: "Preparing to upgrade to CHT 5.0"
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved
linkTitle: "Preparing for 5.0"
weight:
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved
description: >
Steps to ensure your CHT App will run smoothly on CHT 5.0 and later

Comment thread
mrjones-plip marked this conversation as resolved.
Resolved
---

## Introduction

CHT releases use [Semantic Versioning](https://en.wikipedia.org/wiki/Semver#Semantic_versioning) (also known as "SemVer"), which means that the CHT upgrade from the major 4.x version to the 5.x version denotes there are breaking changes. The key to a successful upgrade will be to understand and plan for these breaking changes.

As with all upgrades, major or minor, you should always:
* Have [backups]({{< relref "/hosting/cht/docker/backups/" >}}) that have been tested to work
* Ensure your [CHT Conf]({{< relref "/community/contributing/code/cht-conf/" >}}) version is up to date
* Review the change log to understand how end users might be affected
* Check [troubleshooting upgrades](/hosting/cht/upgrade-troubleshooting/) guide if the upgrade doesn't succeed

Read though this entire document before upgrading and pay special attention to the "Breaking Changes" section to know which of of the changes are applicable.

## Breaking Changes

### Upgrade service removed from Kubernetes

{{< callout type="info" >}} Applies to: [Kubernetes]({{< relref "/hosting/cht/kubernetes/" >}}) hosted CHT instances {{< /callout >}}

In CHT 4.x there are two ways to upgrade a Kubernetes hosted CHT instance:

1. Click "Stage" and then "Upgrade" in the CHT administration interface.
2. Push a new helm chart to Kubernetes that specified different versions.

A recurring problem seen on production deployments was that, over time, CHT administrators would use the CHT administration interface to upgrade. Then, during a migration or a restore from backup, Kubernetes administrators would inadvertently downgrade a CHT instance by using an out of date Helm chart.

To avoid this situation, the upgrade service has been removed from Kubernetes based deployments.
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved

Kubernetes based deployments will need to follow the migration steps from the deprecated [CHT 4.x Helm Charts repository](https://github.com/medic/helm-charts/) to the new [CHT 5.x Helm Charts](https://github.com/medic/cht-core/tree/master/scripts/build/helm) in the main CHT repository. Please see the [technical guide](/hosting/cht/migration/helm-charts-4x-to-5x-migration/) on how to migrate Kubernetes based deployments to 5.0.

Background information:
* [Add documentation for migrating from 4.x medic/helm-charts to the new production charts in 5.x cht-core](https://github.com/medic/cht-docs/issues/1943)
* [Hide upgrade button in admin app for k8s deployments, while still allowing staging upgrades](https://github.com/medic/cht-core/issues/9954)
* [Remove upgrade service from Helm charts](https://github.com/medic/cht-core/issues/10186)

### Token login requires `app_url`

{{< callout type="info" >}} Applies to: Instances that use [token login]({{< relref "/building/login/#magic-links-for-logging-in-token-login" >}}) {{< /callout >}}

For instances that use token login, be sure declare `app_url` in your [settings file]({{< relref "/building/reference/app-settings/token_login/#app_settingsjson-token_login" >}}). This is backwards compatible and safe to do while still on CHT 4.x.
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved

Background information:
* [Require `app_url` to be set when enabling `token_login`](https://github.com/medic/cht-core/issues/9983)

### Enabling languages via generated docs

{{< callout type="info" >}} Applies to: Instances that enable languages via web interface {{< /callout >}}

As of [CHT 4.2.0]({{< relref "/releases/4_2_0/#technical-improvements" >}}), deployment administrators can enable or disable supported languages [via the settings file]({{< relref "/building/reference/app-settings/#app_settingsjson" >}}). CHT 5.0 removes this web interface to enable or disable languages and requires this to be done via App Settings.
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved

Before upgrading, ensure [your app settings]({{< relref "/building/reference/app-settings/#app_settingsjson" >}}) has the correct languages enabled. This is backwards compatible and safe to do while still on CHT 4.x. If you're unsure if this applies to you, double check your app settings.

If `launguages` is not set, the login screen will show all languages. Fix it by declaring the `launguages` per above.
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved

Background information:
* [Deprecate enabling languages through generated docs](https://github.com/medic/cht-core/issues/8157)
* [Allow app builders to specify disabled languages in config](https://github.com/medic/cht-core/issues/6281)


### Declarative Configuration

{{< callout type="info" >}}Applies to: All Instances{{< /callout >}}

Deployments that have not compiled their app settings config in a very long time with a new version of CHT Conf, when logging in as an offline user may see, `Error: Rules Engine: Rules are not declarative. Updates are required.`

Additionally, the web developer console will show:

```shell
Error selecting contact Error: Rules Engine: Rules are not declarative. Updates are required.
ERROR Error: Uncaught (in promise): TypeError: Cannot read properties of null (reading 'doc')
TypeError: Cannot read properties of null (reading 'doc')
```

The fix is to:
1. Update [CHT Conf](/community/contributing/code/cht-conf/) to be current
2. Recompile the app settings and upload them to the CHT. Be sure to replace the value of `--url` to the current password, URL and port: `cht --url=https://medic:password@example.com:12345 compile-app-settings upload-app-settings`


Background information:
* [Make declarative config mandatory](https://github.com/medic/cht-core/issues/5906)

### Increase ecmaVersion ES linting to version 6

{{< callout type="info" >}} Applies to: CHT versions between 4.0 and 4.4 {{< /callout >}}

Deployments running CHT Version 4.0 and 4.4 must upgrade to version 4.5 or later before upgrading to version 5.x.

Background information:
* [Increase ecmaversion linting for ddocs](https://github.com/medic/cht-core/issues/9202)

### Ensure booleans are used with signoff fields

{{< callout type="info" >}} Applies to: Instances where `needs_signoff` triggers replication of reports {{< /callout >}}

In some scenarios where `needs_signoff` is set to string `"false"` instead of boolean `false`, replication will happen when it shouldn't. This is because the string of `"false"` is a truthy value.

CHT 5.0 now correctly enforces this to be a boolean. Deployments to make sure that workflows that use `needs_signoff` field have a boolean instead of a string.
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved

Background information:
* [Replication fails to filter out reports with `needs_signoff` set to false](https://github.com/medic/cht-core/issues/10183)

### Angular 20 requires Chrome 107 or later

{{< callout type="info" >}} Applies to: all instances {{< /callout >}}

CHT 5.0 is preparing fo an upgraded version of [Angular](https://blog.angular.dev/announcing-angular-v20-b5c9c06cf301). As this version of Angular will require Chrome 107 or later, we're making this a requirement in 5.0 as a breaking change to pave the path for the upgrade later. When [researching the impact of this upgrade](https://github.com/medic/cht-core/issues/10029#issuecomment-3358338361) we surveyed over 100,000 end users devices and found that less than 0.5% of users are affected. These users are running Chrome 106 released 3 years ago at this writing. A best practice is to have users always run the latest version if possible.
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved

To check if any of your users are impacted, check the [user-devices API](/building/reference/api/#get-apiv2exportuser-devices). This is an authenticated API endpoint and will return JSON for all users for all time. As this may include multiple entries per user, it's important to filter out duplicate users and of course filter out users who are running Chrome 107 or later.
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved

Before starting, be sure `curl`, `jq` and `sort` are installed. In Ubuntu server, this looks like: `sudo apt update&&sudo apt install jq coreutils curl`. After confirming these tools are installed, save the output of the API to a JSON file being sure to replace `user`, `password` and `URL` with their correct values for your production instance:

```shell
curl https://user:password:URL/api/v2/export/user-devices > devices.json
```

**Note**: for large instances with more than 2,000 users, run the API call after hours. It can have an adverse impact on CHT server performance.
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved

Now that you have the `devices.json` JSON file, flatten it into a CSV file with just one row per user. Note that we're only finding users of the APK (`select(.apk|length> 0)`) and the Chrome browser (`select(.browser.name == "Chrome"`). This excludes desktop and Firefox users which will show up in the JSON as well. Finally, we're also only showing users active since `2025-04-01`, 6 months ago as of this writing (`select(.date > "2025-04-01")`). Be sure to update this date to be a relative 6 months ago from when you run the command:

```shell
jq -r '.[] | select(.apk|length> 0)
| select(.browser.name == "Chrome")
| select(.date > "2025-04-01")
| "\(.deviceId) \(.user) \(.date) \(.browser.version)"' \
devices.json | sort -u -k1,2r \
| sort -u -k1,1 | cut -f2,3,4 -d' '| sort -rh -k3 \
| sed 's/ /,/g' > devices.csv
```

The resulting file `devices.csv` will have all of your users sorted by the version of Chrome they use. Scroll to the bottom and find any users running a version lower than `107` and ensure they update to a newer version. The easiest way to upgrade is to open the Play Store and update any out of date software, being sure to update [WebView](https://play.google.com/store/apps/details?id=com.google.android.webview&hl=en).

For instances with users who share devices, or have multiple devices they log in on, they may have multiple entries. Thi is because the CHT creates one entry per device per user. Be sure to upgrade all affected devices!
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved

Background information:
* [Upgrade to Angular 20](https://github.com/medic/cht-core/issues/10029)


## Non-Breaking Changes

These changes apply to all deployments. No specific action needs to be taken, but administrators should be aware of the changes.
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved

### CouchDB Nouveau

A major feature of CHT 5.0 is replacing the old freetext search in 4.x with CouchDB Nouveau. The addition of Nouveau [decreases the amount of disk space](https://github.com/medic/cht-core/issues/9898#issuecomment-2864545914) used by the CHT. Disk space has been shown to be a major contributor to hosting costs, hence Nouveau is the first feature to [reduce Hosting Total Cost of Ownership (TCO)](https://github.com/medic/cht-roadmap/issues/171).
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved

Nouveau has the following impact on all CHT deployments upgrading to 5.0:

* Offline users' devices will have their search indexes rebuilt after the upgrade. During the rebuild, search functionality will be initially unavailable. However, once the indexing is complete, the search behavior will be unchanged from before for all users: the search experience is the same in both CHT 4.x and CHT 5.x.
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved
* The Nouveau index data on the server will be stored in `${COUCHDB_DATA}/nouveau` for single-node CouchDBs and in `${DB1_DATA}/nouveau` for clustered CouchDBs.
* The following `medic-client` views no longer exist. Be sure to update any custom scripts which use them: `contacts_by_freetext`, `contacts_by_type_freetext` and `reports_by_freetext` .

Background information:
* [Reduce disk space with CouchDB Nouveau (TCO)](https://github.com/medic/cht-core/issues/9542)
25 changes: 25 additions & 0 deletions content/en/hosting/cht/upgrade-troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,31 @@ A safe fix for any upgrade getting stuck is to restart all services. Any views

If you're able to, after a restart go back into the admin web GUI and try to upgrade again. Consider trying this at least twice.

## CHT 4.18.0 - 4.21.1: Error triggering update

**[Issue #10296](https://github.com/medic/cht-core/issues/10296)**: Requests will fail due to fetch implementation if headers are not sent within 5 minutes

API:
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved

```shell
TypeError: fetch failed
at node:internal/deps/undici/undici:15445:13
at async /home/diana/.config/JetBrains/WebStorm2025.2/scratches/fetchtimeout.js:2:13 {
[cause]: HeadersTimeoutError: Headers Timeout Error
at FastTimer.onParserTimeout [as _onTimeout] (node:internal/deps/undici/undici:6821:32)
at Timeout.onTick [as _onTimeout] (node:internal/deps/undici/undici:528:17)
at listOnTimeout (node:internal/timers:608:17)
at process.processTimers (node:internal/timers:543:7) {
code: 'UND_ERR_HEADERS_TIMEOUT'
}
```

**Fix:**
1. Wait until there's no more [active tasks](https://michellephung.github.io/Fauxton-Visual-Guide/#page-active-tasks).
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved
2. When there's no more active tasks, start the same upgrade again from the admin UI. It should succeed without any errors this time.
Comment thread
mrjones-plip marked this conversation as resolved.
Resolved

{{< figure src="upgrade.again.png" link="upgrade.again.png" caption="Admin web GUI showing 'Error triggering update' message at the top, and an arrow pointing to 'Install' button as the next step" >}}

## CHT 4.0.x - 4.3.x: CouchDB Crashes

**[Issue #9286](https://github.com/medic/cht-core/issues/9286)**: Starting an upgrade that involves view indexing can cause CouchDB to crash on large databases (>30m docs). The upgrade will fail and you will see the logs below when you have this issue.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.