running, debugging, databases

I have questions about running and debugging OpenMRS. It seems like there are many different options for installing, building, running, and debugging. For example:

  • download various ready-to-use configurations from here: https://openmrs.org/download/.
  • get sources from git, build with maven, run with “mvn jetty:run”.
  • use SDK which has lots of fancy-looking ways to install and run.

For the bugs I’m looking at right now (TRUNK-5344: Module Class Loader Doesn’t Allow Unrelated Modules to Have the Same Library, and FM2-184: FHIR2 module breaks OpenMRS when datafilter module is loaded), I want to be able to debug (I use eclipse) core code. I actually have been able to debug the latest built-from-source using eclipse and ‘mvn jetty:run’, but I’m wondering if that’s the best way to do it?

Also, I want to be able to debug the current released version, 2.3.0. Question: Can I use a database that was created for 2.4.0-SNAPSHOT with a 2.3.0 server? Or should I maintain separate databases for each configuration I want to test?

Similarly, if I want to run, say, just the platform with a small number of modules and also run the full RefApp, can those two configurations use the same database?

Thanks,

Lee

Personally, I tend to use the SDK for most of my development work, but that’s because I largely want to test the core with other modules and it’s easier to maintain that via the SDK.

Generally speaking, I would maintain a separate database for at least each version of the platform. There’s no guarantee that a database setup by 2.4.0 will run on 2.3.0 (though you can move from 2.3.0 to 2.4.0).

It may not be necessary to maintain a separate database per configuration, but that’s what I tend to do as there’s almost no downside and it ensures that changes made to the database testing one set of functionality doesn’t interfere with those made by others.

Once you get into managing multiple configurations, the SDK becomes really valuable, since it allows you to spin up multiple versions of OpenMRS with different configurations and add or remove components from them as needed, reset the database, etc. I highly recommend using the SDK with MySQL installed via Docker.

1 Like

Thanks @ibacher. I did not realize how handy the SDK is. One question: How do I stop a server? I found a q&a that said “ctrl-z” to stop, but that does nothing for me (I’m on Windows 10). I tried “ctrl-c” and that exits the mvn command (I started the server with mvn openmrs-sdk:run), but does not stop the server.

Oh and one more: If I use a docker mysql (very nice feature!), where is the database? Is it completely inside the container (and therefore lost when the container stops), or is there a mount/volume option so the db is outside the container and can be re-used?

Hmmm… I don’t use Windows, but for me ctrl-c stops the server and exits Maven. If that’s not working, it should probably be reported as a bug.

It’s stored in a Docker volume. You can see the setup here.

@leebreisacher ur right about this on windows…the command “ctr-c” stops maven but the port is not killed automatically…Personally I just keep killing it with two commands you can read up on here…otherwise when u just restart u will end up with errors due to failure to delete some temp folders…