Inside my docker environment, i have been trying to update the rest webservices module.
The normal workflow is using the add or upgrade button, and then selecting the new version of the rest webservices module but this is not working for docker environtments.
Hardship i go through
getway first complains that my upload is too big: Solved with increasing the client_max_body_size to 10M; inside the getway container at /etc/nginx/nginx.conf
The getway then complains that the request has taken too long with 504 gateway time-out nginx. Refreshing the browser or going to the legacy home throws a 500 internal server error
I then just have to restart the backend container which restores the previous .omod file of the rest webservices module i wanted to override. This results in me having two .omod files for the rest web services module. I know legacy modules’ list shows the actual name of the .omod file loaded but it gets confusing when both new and old .omod files have the same name ie mostly when openmrs is running a snapshot version of the module by default.
How i walk around this
When selecting the .omod file to upload, i change its name to give it unique characters. Then i will just check in the modules UI to check if my new .omod file is started. (remember I have two .omod file of the same module)
In docker, I import my new .omod file, whose name is different from the current module i want to override and restart the backend container. At the same second, i delete the old .omod as the container is restarting. This most times breaks modules so i restart all of them from the modules UI.
I just turn to the OpenMRS sdk and with continue the normal, stop, update modules, start and wait …
This is why i think life can be much simpler if i just add/delete from the modules folder and then just click start all ‘Start All’ which will sync my change to the modules folder
FWIW, we might also need to increate ignix’s request timeout
So the way I usually develop modules with Docker and OpenMRS is to provide the OMOD as a Docker volume. Usually I just overwrite the pre-existing OMOD I care about. This is done by having something like this in the OpenMRS service configuration in docker-compose: