Automated Script for OpenMRS Build and Compilation (Linux)

Hi,

Being somewhat of a beginner myself, I can see the struggles of being completely new at something and the trouble that comes along with it. In the case of building and compiling OpenMRS, a lot of newbies have had difficulty getting it up and running. I can only imagine what it would be like if one had no prior knowledge about coding and the command shell in Linux.

In addition, the documentation on how to do so (link here) already assumes you have some knowledge to the world of Linux.

One major example of this that I found was that in the documentation, it made no mention of making sure to kill all of the processes running on ports 3306 and 8080, which are what MySQL and the Jetty server utilize. This gave me a lot of trouble early on as I had no idea why it wasn’t working. I highly recommend adding a quick mention of this at the beginning, maybe something around the lines of,

“Please make sure to kill all running on ports 3306 and 8080, which are what MySQL and the Jetty server use. You can do this by typing “fuser -k port number/tcp” in the command line. If those don’t work, try typing “sudo netstat -pna | grep port number”, recording the process ID number, and killing with “kill ID number””

I’ve previously created a video on how to build and compile OpenMRS for Linux (link here), and in this video alone you can see how long and tedious the process is. Keep in mind that I already have had experience messing around in Linux and bash.

I think a simple bash script would greatly help with those struggling, especially for those currently involved in GCI (including me).

You can find the bash script that I wrote here. It certainly isn’t complete yet, but it’s a good start nonetheless. I believe that this would be a great help to those who need it. If you’d be so kind to take a look at the code (right now it’s just completely non-interactive, very elementary), I’d appreciate some feedback.

To Do’s:

  • Switch default java version (right now it only installs java 1.8 but doesn’t set to default)
  • Get MySQL server up and running (right now it just installs, is it possible to create server in bash?)
  • Download UI
  • Overall just add more functionality

Thanks,

WZCoding

@wzcoding Have you tried using OpenMRS SDK , this might be the implementation of what you are suggesting.

Looking at the OpenMRS SDK, it does in fact have a similar goal (Rapid development for users), but that’s aimed towards active developers and contributors of OpenMRS. You can see that through the vast options it has for building, deploying, creating projects, etc. I’d like to think of my suggestion as a simple, hands-off approach just to get the user to the installation wizard. It’s not meant to replace the SDK by any means, but if you take a look at the instructions for getting up to the installation wizard, there is a total of 10 steps just to get there. Ideally a bash script like this can help alleviate some of that, just one step (sh openMRS_build_and_compile.sh) will do. When I’m done, I’ll upload a video comparing the script, using OpenMRS SDK, and building and compiling on my own. Thanks for the feedback.

Have you looked at the standalone version of OpenMRS?

Yes, I think that mainly this would be for those younger involved in GCI and such that might not have experience but need to build and compile, not for people who actually need to utilize the medical records system. What do you think? Yes, I completely agree that the standalone version is beginner friendly as well, but I’m aware that there are some instances where it’s necessary to build and compile. My goal is to have this “walk through” and show how it’s built and compiled for those people who in the future might want to contribute to the OpenMRS application.

@wzcoding we are constantly looking for ideas on how to improve the SDK and make it a tool that gives the best experience to developers. Do you think you can highlight issues with the SDK that need working on up to the point where you would want it? :slight_smile:

You can also do all of the above via Docker.

Thanks for the suggestion! I think that’s a really good idea. Do you think I make something that would instead walk people through building and compiling from source, have a script get the OpenMRS SDK up and running (install, get dependencies) , and maybe be a function in the SDK that would build, deploy, and run the module (Automate what happens in Basic Usage), just to show new people how it works?

KInda already exists: En

What I meant was a script to automate getting all of the dependencies and getting the user up with a new server with SDK. I don’t know if this is better than the current dev manual, I thought it would help people having trouble with it. This is just an idea floating around I had, but if you’d prefer me just to work on the top JIRA tasks please let me know and I can make that a priority. Thanks