Wiki Spaces

Documentation
Projects
Resources

Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack

Documentation

Page tree

Versions Compared

Key

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

...

Code Block
themeMidnight
languagebash
titleRunning Run the OpenMRS standalone server
java -jar openmrs-standalone.jar

...

Code Block
themeMidnight
languagebash
titleInstalling Install the OpenMRS SDK
mvn org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:setup-sdk

...

Code Block
themeMidnight
languagebash
titleCreating Create a Platform Server
 mvn openmrs-sdk:setup-platform -DserverId=platform -Dversion=1.11.5

...

Code Block
themeMidnight
languagebash
titleRunning Run a Platform Server with the SDK
mvn openmrs-sdk:run

It is also possible to run Reference Application server using the SDK. See the SDK docs for instructions on how to do this.

Enterprise

The enterprise install is usually meant for production environments, and involves installing MySQL and Tomcat manually, then downloading the OpenMRS Platform WAR file from the OpenMRS downloads page and deploying it to Tomcat. See the full documentation here.

...

Code Block
themeMidnight
languagebash
titleInstall OWA Generator
npm install -g generator-openmrs-owa

Next, create a directory for your Open Web App and change into it. Then running to following to scaffold your app:

Code Block
themeMidnight
languagebash
titleScaffold Open Web App
yo openmrs-owa

The output should be something like:

Image Added

3. Development

All the Open Web App files are in the app directory, everything else is used for building and managing packages. Any files you add manually must be added in app directory.

The manifest.webapp files contain the information that OpenMRS needs to host your app. See the Open Web Apps Module documentation for detailed documentation. The launch_path property contains to the the path your app entry point. This is the page that will be loaded when you click on your app in OpenMRS.

The command to build the distributable version of your app is just:

Code Block
themeMidnight
languagebash
titleBuild App
gulp

This will create a ZIP file in the dist directory that you can upload on the Open Web Apps module admin page.

Local Deployment

To speed up development workflow, we can deploy directly to the app data directory on the filesystem using the following command:

Code Block
themeMidnight
languagebash
titleDeploy Locally
gulp deploy-local

The path to the local deploy directory is contained in gulpfile.js in the LOCAL_OWA_FOLDER variable. The following are the default locations for the various server installs:

  • Standalone: {{/path/to/openmrs-standalone-2.3.1/appdataowa
  • SDK: ~/openmrs/platform/owa (replace "platform" with the name you gave your server) !! TODO: confirm this
  • Enterprise: /usr/share/tomcat7/.Openmrs/owa !! TODO: confirm this
  • Docker: TODO

Running gulp deploy-local will inject your bower dependencies then copy everything in the dist folder to the server.

Managing Packages

The Open Web App generator by default uses Bower for package management. To add a new package (say, angular) just run:

Code Block
themeMidnight
languagebash
titleInstall Package
bower install --save angular

This will download the angular package and store it in the bower_components directory.

When you run gulp or gulp deploy-local the installed bower packages will automatically be injected into your html files at the location you choose. To specify the location, add the following to your HTML files:

Code Block
themeMidnight
languagexml
titleBower Javascript Injection Point
<!-- bower:js -->
<!-- endbower -->

During the build process, the appropriate markup to include your packages will be injected there, and the packages will be copied into the dist/lib directory.

You may also need to include the CSS files from your installed packages in your HTML. This is done in the same way, except you replace js with css:

Code Block
themeMidnight
languagexml
firstlineBower CSS Injection Point
<!-- bower:css -->
<!-- endbower -->