How to use openmrs-sdk to run a distro reference

Tags: #<Tag:0x00007fdb7a4ca290>

I have set up openmrs-sdk and trying to run a reference application through sdk (I haven’t built/installed any module separately by my own). My approach was something like this -

mvn openmrs-sdk:setup -DserverId=1 -Ddistro=referenceapplication:2.10.0 note that I also have database set up.

This command creates a directory openmrs/1 where I can see openmrs-2.3.0.war file and .omod files in a subdirectory named module. When I try to run the server,

mvn openmrs-sdk:run -DserverId=1

the server loads an empty page and on terminal shows warning - WARN - OpenmrsUtil.getRuntimeProperties(2039) |2020-04-15 16:56:05,696| Unable to find a runtime properties file. Initial setup is needed. View the webapp to run the setup wizard.

What am I doing wrong here? Do I need to clone and build all the modules separately and then I can run the application? Is there any simple way to do all that with few commands?

for setting up the sdk,you could have a look at this https://wiki.openmrs.org/display/docs/OpenMRS+SDK

I was able to get the server running using the commands you’ve mentioned. Can you share Java, mvn, and MySQL version you’re running on your system?

Also, can you share the logs using pastebin.com?

2 Likes

@nasif , all is fine.
At first time you run the server , you need to acces the server at http://localhost:<tocat_port>/openmrs and complete the setup wizard.
Thats the normal behaviour.

1 Like

Thanks a lot. I was actually making a stupid mistake only by looking at http://localhost:<tomcat_port> which loads an empty page. Everything actually worked fine after adding /openmrs to the address. I believe when I built the openmrs-core modules in my machine, there was a pointer that asks to go to ‘/openmrs’ in order to view the contents. Thanks a lot again!

However, I want to run some SCA scanner for this reference application. For which I need to clone and build the code in my local machine. I can manually clone individual modules and build them separately, but that seems like not to be an efficient process as the required modules (and versions) are listed in this distro. Ideally, I would want simpler command that would take this distro as input and clone and build all the necessary modules. I read from documentation that the sdk does not build any code but is that possible by any mean?

Similar to setting up the reference application, is there any sdk command that would clone all the required modules in my local machine, and a command that would also build all of them?

Why would you want to clone and build all the 30 modules?

I am planning to run some SCA (Software Composition Analysis) tools on OpenMRS in order to study its dependencies, specifically how many dependencies might have a known vulnerabilities in them. I will run some tools including both open source (e.g. OWASP-Dependency-Check, Eclipse Steady) and commercial ones. All of these tools at least require the pom.xml files to infer the dependencies. Some tools do more sophisticated analysis like constructing call graphs or looking at execution traces of the test cases for which I will need the source code and tests. Therefore, I will need to have the source code for all the 30 modules in my machine and have a way to build them all. It would be greatly helpful if I can do them all together at once rather than individually.

This is not supported at the moment. But we have a starting point, just in case you want to add this functionality to our SDK.

1 Like

Hi, I am trying to watch the openmrs-core modules within the SDK environment. with mvn openmrs-sdk:watch -DserverId=distro-2-10-0 command, it shows me build success for the parent/root pom.xml file in the openmrs-core and all the child modules are skipped. Is it the expected behavior or there is something wrong. Ideally, I want the server the run based on my fork of the openmrs-core (all modules).

The log output of my watch goal is here.