Assistance Required: Deploying Modified OpenMRS 2.x Server

I am writing to seek guidance on deploying a modified version of the OpenMRS 2.x server to a production environment. Here is an outline of the steps I have followed so far and the challenges I am facing:

Steps Undertaken:

  1. Initial Setup:
  • Installed prerequisites: Java, Maven, OpenMRS SDK, and Docker Desktop.
  • Set up an OpenMRS 2.x server using the SDK with the following command:
mvn openmrs-sdk:setup -DserverId=platformv2 -DserverPath=C:\OpenMRSserver\platformv2
  • Selected MySQL in a Docker container as the database.
  1. Running the Server:
  • Started the server using:
mvn openmrs-sdk:run
  1. Customization:
  • Cloned the required modules from GitHub to a separate directory.
  • Made changes (e.g., logo, favicon, and text modifications).
  • Built the OMOD files for each module using:
mvn clean install
  • Stopped the server, replaced the old OMOD files in the modules folder with the new ones, and restarted the server using the same run command.
  • Verified that the changes were applied correctly in the browser.
  1. Preparing for Production:
  • I believe the next step is to build a .war file for deployment. However, I am unsure how to proceed or whether additional steps are required to ensure a successful deployment.

Challenges:

  • I am unclear on the exact commands and process needed to generate a production-ready .war file from the server setup.
  • I want to confirm if my approach to modifying the OpenMRS 2.x server is correct or if I have missed any critical steps.

I would greatly appreciate your assistance in guiding me through the WAR file creation process or any recommendations for deploying my customized OpenMRS server to production effectively.

Thank you for your time and support.

Do you want to create a WAR file that includes bundled modules?

As a helpful tip, there’s no need to copy the OMOD file when working on modules manually. Instead, you can use the OpenMRS SDK to have a server watch your codebase. This allows the server to automatically build and copy the modules to its modules directory. Simply run the following command in your module folder:

mvn openmrs-sdk:watch -DserverId=server

2 Likes

Thank you for the suggestion!

I have a quick question regarding the mvn openmrs-sdk:watch command. Should I start the server first and then open a terminal in the cloned repository for each module to execute this command from that directory? Or is there a specific order or setup I should follow to ensure it works as expected?

Additionally, you mentioned creating a WAR file with bundled modules. Could you advise on the best standard approach for deployment? Is it better to create a standalone WAR file with all modules included, or to deploy the server and modules separately?

Looking forward to your guidance!

I think the method of deploying the server and modules separately is better than bundling everything into a single WAR file. It seems more flexible, especially for making updates to individual modules without redeploying the entire application.

You don’t need to run the server to watch it. I also recommend keeping modules separately.

1 Like