I am currently working on a task that involves creating a CI process for Liquibase snapshots, as detailed in this issue.
In the last platform call, @dkayiwa and @burke suggested trying this process locally, I wrote a script to automate the Liquibase snapshot build steps, which are normally performed manually (refer to steps to build Liquibase snapshots). I successfully automated most of the build steps, but the OpenMRS initialization step requires interaction with a browser. Do you have any suggestions on how to automate this initialise step?
Additionally, you can find the current state of my work here. I would appreciate it if you could review and provide suggestions for improvement.
@burke @dkayiwa @ibacher
You can set a system property named
OPENMRS_INSTALLATION_SCRIPT to the script that you would like to automate the installation.
Thank you for the information. I’m not quite familiar with how to set a system property or where to find the script for the OPENMRS installation. Could you please provide more guidance or specific steps on how to set the OPENMRS_INSTALLATION_SCRIPT system property and where to locate the script for automating the installation?
Though called a script, it is actually a properties file of key value pairs where each installation wizard setup option has a key to let you supply a value that enables the initialisation filter to automatically run without user intervention. These are the properties: https://github.com/openmrs/openmrs-core/blob/2.6.3/web/src/main/java/org/openmrs/web/filter/initialization/InitializationFilter.java#L311-L356
And here is an example of such a file: https://github.com/openmrs/openmrs-core/blob/2.6.3/api/src/main/resources/installation.h2.properties
The value pointed to by the
OPENMRS_INSTALLATION_SCRIPT system property can be an absolute file path and name, or a file in the classpath like
Thanks for your clarifications. I have successfully automated the OpenMRS installation process. Now, I am looking for a way to identify when the installation process is completed so that I can terminate the OpenMRS server afterward.
Now, I use the following command to terminate the server after installation
# Check the return value and act accordingly
if [ $? -eq 0 ]; then
echo "OPENMRS Initialization success"
echo "OPENMRS Initialization unsuccessful"
read -p "Press Enter to continue..."
kill -9 $(lsof -t -i:8080)
The installation process is completed when the REST endpoint below returns HTTP status code 200
Here is the script that I wrote to generate Liquibase snapshots automatically.
Please review my work and let me know if there are any changes needed or if there are any issues to be addressed.