Question:
I have successfully set up a UAT using Bahmni Docker. I have added and removed OpenMRS metadata, and I am now happy with the setup. I would like to deploy this setup on multiple servers.
I have a few questions though:
How can I package the entire setup as a single Docker service so that it is easy to deploy on multiple servers? Should i start the packaging from the vagrant setup instead?
How should I handle OpenMRS database migrations when deploying the setup to multiple servers?
I have also implemented a custom module for DHIS integration and edited the proxy config to point to that. How can I ensure that these changes are replicated in the packaging?
I have also used implementer interface to create 3 clinical forms. How can I ensure that these changes are replicated in the packaging too?
What would be a good approach to tackling these points?
Packaging the entire setup as a single docker image is not ideal. It would become hard to maintain over time and the artifact size would also be so huge. Also you will miss some of the important features of docker like updating/upgrading only the required containers, starting.stopping individual containers etc.
The option here for you would be to build custom images with your code customisations if any and publish it to an image repository like docker hub. Once the images are published, you can update image names in your docker compose file and .env file and let docker compose pull images wherever you make deployments. An example of custom image dockerfile for openmrs service can be found here which adds a custom module on top of bahmni product openmrs build.
You can add your database migrations to the masterdata/configuration directory of the configuration repository which in turn will be used by the initializer to run the migrations. You can add to appropraite csv files or add to liquibase/liquibase.xml if you dont find the right subfolder for your change. Once you build your configuration repository, you can build a docker image out of it as well and deploy.
Publish DHIS module as a separate docker image and also publish a customised proxy image built on top of bahmni/proxy image. Example here.
You can leverage bahmniforms directory in the masterdata/configuration directory of your configuration repository. It is just that you can export json from implementer interface and add the same json to the bahmniforms directory.