Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This tutorial will introduce you to OpenMRS SDK (Server Development Kit). It assumes that you have basic understanding of OpenMRS modular architecture (you can learn about it reading Technical Overview).

...

If you want to enable remote debugging by default when running the server,
specify the port number here (e.g. 1044). Leave blank to disable debugging.
(Do not do this on a production server) (default: 'no debugging'): 

Type default value '1044' and push enter. Specifying debug port is essential to setup remote debugging configuration. You will be asked what database you want to use:

...

OpenMRS distribution consist of platform and set of modules. SDK distribution is specified in properties file, by convention named openmrs-distro.properties. Minimal valid distro file contains 3 fields:

...

To sum up, our openmrs-distro.properties file will look like this:

name= OWA development
version= 1.0
war.openmrs= 2.0
omod.owa=1.6.2
omod.webservices.rest=2.17-SNAPSHOT 

SDK automatically assumes that modules Maven Group ID is 'org.openmrs.module', but you can declare another Group ID

...

Now, when we have our distro configuration file, you can setup server from this openmrs-distro.properties file with command:

Code Block
mvn openmrs-sdk:setup

...

To allow others to reproduce your server configuration, you have to create 'openmrs-distro.properties' file  file with modules deployed on failing server. Since SDK 3.4.x you can go to your server directory `{user directory}/openmrs/{name of server}` and copy this file to share it with others. If you are using older version of SDK or standalone OpenMRS, you need to manually create this file as described in Creating new distribution

...

To create dump from dockerized MySQL database, you need to use mysqldump from within the container. We will show it on example of creating dump of MySQL database in SDK container. First, ensure that SDK container "openmrs-sdk-mysql-v3-2" is started:

Code Block
docker start openmrs-sdk-mysql-v3-2

...

Code Block
docker exec -it openmrs-sdk-mysql-v3-2 mysqldump -u root -pAdmin123 {name of database, equal to name of server} > dump.sql

Username 'root' and password 'Admin123' are standard credentials for MySQL instance in container created by SDK. Creating dumps from custom container looks analogously, you just have to replace container name and credentials.

After command execution, you will have dump.sql file in your working directory.

...

Now, if you want to replicate environment of other developer, and you are provided openmrs-distro.properties and dump.sql, you can do that in one step:

...

from directory where you have those 2 files. flag '-Drun' makes  makes SDK automatically run server after successful setup. Go to http://localhost:8080/openmrs/ to complete the setup.

...