Commands to upgrade CHT when using medic-os

Okay, maybe this is obvious, but I have not been able to figure it out. Could someone point me to the medic-os commands that I could use to upgrade the CHT version running in the container? Thanks!

@jkuester - you should be able to use an authenticated call to the upgrade API to do this, passing in the correct JSON payload.

Testing external to the container, I was able to make this call to my localhost which has the IP 192.168.68.108 and was configured with the local-ip.co cert:

curl https://medic:password@192-168-68-108.my.local-ip.co:8443/api/v1/upgrade/stage -k -X POST -H "Content-Type: application/json" -d '{"build":{"namespace":"medic","application":"medic","version":"'3.15.0'"}}'

This immediately returned {"ok":true} and if you’re logged in on the admin upgrade page (/admin/#/upgrade) in a browser, it should show that it’s upgrading. Note that I called the stage endpoint, so you’d have to call the complete endpoint to finish the upgrade. It’s safe to do this any time, as the API will just return “Cannot find a staged upgrade that is ready for completion” if the staging is not complete.

If you’re wanting to do this from within the medic-os container, you could just replace the URL with the localhost address, change the port and change the protocol to not be https, like this:

curl http://medic:password@localhost:5988/api/v1/upgrade/stage -k -X POST -H "
Content-Type: application/json" -d '{"build":{"namespace":"medic","application":"medic","version":"'3.15.0'"}}'

Best of luck!

2 Likes

Ah, good idea! Had not thought of just manually calling the endpoint.

Just a quick reminder - this API doesn’t sanitize input: If you pass in an non-existent version to upgrade to, the API will return {"ok":true}, but the upgrade will fail! (I found this out the hard way when testing :sweat_smile: )