Upgrading from cht v3.17.0 to 4.6.0

Due to the need to upgrade from v 3.17.0 to v 4.6.0 . We came to a decision to first clone the instance and upgrade the clone in order to estimate how much time it will take and also what challenges will be encounter before doing the upgrade on the production.
Through the process of cloning the instance ,

  • We have created a snapshot from the volume of the production instance.
  • Created an AM image from the snapshot
  • Created the instance from the AMI (image)
  • The Ec2 instance created from the AMI is on v3.17.0 .

After cloning the instance and running it , we faced and error of 504 error nginx.

When trying to solve the error, we noticed that when we try accessing the medic-os container url on 5988,we get ( Connection reset by peer.)
then (Empty reply from s **

**erver)

below is our unchr-app config included in our nginx config.

how can we solve this error to return the server at 5988

Hi @Edwin

It seems that your container didn’t start up correctly. Can you check the logs from the medic-os container to see what is really going on?
There is some information about how to troubleshoot medic-os installations here: AWS Hosting in CHT 3.x | Community Health Toolkit

Please let us know what you’ve found!

hi @diana thankyou for the reply.

when i run the medic-os logs i cant seem to find the problem.
logs medic-os

when i run both
Missing folder medic-api.log
less /srv/storage/medic-api/logs/medic-api.log

Missing folder medic-sentinel.log
less /srv/storage/medic-sentinel/logs/medic-sentinel.log

Hi @Edwin

Interesting. It seems as if the services haven’t started.
There are some commands to help you investigate which services are up and you can try to start them. The commands are detailed here: GitHub - medic/medic-os: A space-efficient Linux-based operating system, designed specifically to run Medic's mHealth platform. This is the build system and source code; Docker images will be available on Medic's website.

I would suggest starting with supervisor-inspect and going from there.

hi @diana
Thankyou for the reply. When i try to run the supervisor-inspect , i get command not found.
Screenshot from 2024-05-08 11-30-15

Hi @Edwin

As the documentation says, the scripts reside in /boot : GitHub - medic/medic-os: A space-efficient Linux-based operating system, designed specifically to run Medic's mHealth platform. This is the build system and source code; Docker images will be available on Medic's website.

So the command is /boot/supervisor-inspect. Can you try this?

hi @diana
the services are running properly . i have restarted them. Still facing the problem of accessing the port.

Screenshot from 2024-05-08 14-16-08

curl -X GET ‘http://localhost:5988
curl: (56) Recv failure: Connection reset by peer

Screenshot from 2024-05-08 14-20-14

Hi @Edwin

Can you try curl -k https://localhost ?

hi @diana

Hi @Edwin

Please don’t use the port when using https.
curl -k https://localhost

hi @diana
Thank you for the early responses.

curl -k https://localhost

Screenshot from 2024-05-08 15-11-17

hi @diana
We found the issue as to why we were getting the 502 error. This is because of the limited resources we had used to clone the instance compared to the resources of the instance we were trying to clone. (from ( (t2 micro to t2 large)

Then is worked . Thank You for all the help and support.

hi @diana , @mrjones and @jkuester @niraj

  • After installing the data migration tool

  • Export the couch_url

  • Prepare CHT-Core 3.x installation for upgrading
    cd ~/couchdb-migration/
    docker-compose run couch-migration pre-index-views 4.6.0

We are encountering the error below

What could be the solution?

Hi @Edwin

Can you check the status of CouchDb in this case? Is it still healthy?

hi @diana
The CouchDb status is healthy

Can you try the migration again?

Hi @ Diana
The migration was successful.

After migration, we chose the Single node.

When they say it is safe to proceed to starting cht core 4.x , Do they mean under self hosting or under App Developer Hosting.

Hi @Edwin

The migration only prepares your data. You can follow any hosting guide you desire, as long as you use this data for your CouchDb installation.
However, I believe app developer hosting only offers single node deployments, and if you migrated to multi-node than you would have to use the guide under self hosting (multiple nodes - Docker).

hi @diana .
The Upgrade was successful . We used single node docker.
thank you for the help.

2 Likes

@diana, I followed App Developer Hosting in CHT 4.x | Community Health Toolkit to upgrade the current instance, which we plan to start using today from CHT 3.17 to CHT 4.x on my localhost computer before replicating to the production VM, which currently doesn’t have data thus wont need migration service.
I did change the CouchDB password from the config, but got the error CouchDB UUID not set, default will be used.

The upgrade got stuck after running the code: CHT_COMPOSE_PROJECT_NAME=app-devl COUCHDB_SECRET=foo DOCKER_CONFIG_PATH=${PWD} COUCHDB_DATA=${PWD}/couchd CHT_COMPOSE_PATH=${PWD} COUCHDB_USER=medic COUCHDB_PASSWORD=password docker-compose up

Please advise if:

  1. I missed a step in the upgrade preparation, especially CouchDB config settings from cht-couchdb.yml
  2. If I will still use my earlier config directory to run our current application instance with docker-compose up -d, or the folder created with the upgrade files, cht-4-app-developer
    Thank you