Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

alt tag

OpenMRS CD 3 (OCD3)

A dockerized Jenkins server ready to manage dockerized OpenMRS and Bahmni instances.

OCD3 in a nutshell:

  • Builds and deploys all OpenMRS or Bahmni related software artifacts.
  • Provides a definition framework for OpenMRS and Bahmni servers.
  • Delivers server instances to Linux-powered hosts.
  • Tracks code and configuration changes and propagates them to its managed server instances.

Quick Start

The following steps describe a way to gather OCD3 artifacts locally and run the Docker container based on them. In a Un*x shell:

1 - Set the target version:


2 - Copy the artifacts out of the Nexus repo into the local Maven repo:

mvn dependency:get \
  -DgroupId=net.mekomsolutions \
  -DartifactId=openmrs-cd \
  -Dversion=$VERSION \
  -Dpackaging=zip \

3 - Unpack everything into openmrs-cd on the home folder:

mvn dependency:copy -Dartifact=net.mekomsolutions:openmrs-cd:$VERSION:zip -DoutputDirectory=/tmp/ && unzip /tmp/openmrs-cd-$ -d /tmp/ && rm /tmp/openmrs-cd-$ && rsync -av --delete /tmp/openmrs-cd-$VERSION/ ~/openmrs-cd/ && rm -r /tmp/openmrs-cd-$VERSION

4 - Run the openmrscd container:

docker run -dti --name openmrscd  -p 8080:8080 \
  -v ~/openmrs-cd/node-scripts:/opt/node-scripts \
  -v ~/openmrs-cd/jenkins_home:/var/jenkins_home \
  -v ~/openmrs-cd/app_data:/var/lib/openmrs_cd/app_data \

After the container has started, the customized Jenkins instance will be accessible at with the following credentials: admin / password.

Authorize 'jenkins' user to write to the app_data folder:

docker exec -it openmrscd \
  bash -c "sudo chown -R jenkins:jenkins /var/lib/openmrs_cd/app_data/"

Attention: The app data folder will contain the CD's file-based database. Make sure to keep it in a safe location.

5 - Setup your Maven repo: You must configure the coordinates of your Maven repo if you intend to deploy your own Maven artifacts with the CD. Launch the artifact_repo.js script to configure the artifacts repository credentials and artifacts upload URLs:

docker exec -it openmrscd \
  bash -c "cd /usr/share/jenkins/ && npm install && node artifact_repo.js"

And answer the prompted questions.

Note: If you do not want to enter the artifacts repository URLs and authentication details by hand (through the CLI) you can just edit usr/share/jenkins/artifact_repo_default.json (see the default one here as an example) with your own repo URLs and ID and then run the script again. It will detect the file and ask you to use it.

Developer Guide

OCD3 is a Dockerized Jenkins with preconfigured jobs. Those jobs run Node JS scripts or Node-generated Bash scripts.

This explains the structure and content of the root folder of the project:

├── docker
├── jenkins
└── node-scripts

node-scripts is the Node JS scripts area, docker holds the Dockerfile (and other resources needed to configure the container) and jenkins contains the parts of Jenkins home that are preconfigured, as well as the pipelines' Jenkinsfiles.

Gradle is used to run all build tasks and package all artifacts that make OCD3.

Working out of the sources directly

When developing on the CD the best is to mount the Docker volumes right out of the sources.

1 - Clone the openmrs-cd repository:

Note: we assume that cloned repositories should go into the home ~/repos folder. Adapt the commands below in accordance to your own local setup.

mkdir -p ~/repos && cd ~/repos && \
  git clone && cd openmrs-cd

2 - Build the Node scripts:

./gradlew node-scripts:build

3 - Run the openmrscd container based on the latest tag:

docker run --name openmrscd  -p 8080:8080 \
  -v ~/repos/openmrs-cd/node-scripts:/opt/node-scripts \
  -v ~/repos/openmrs-cd/jenkins/jenkins_home:/var/jenkins_home \
  -v ~/.m2:/var/jenkins_home/.m2 \
  -v ~/Documents/openmrs-cd/app_data:/var/lib/openmrs_cd/app_data \

The last two mounted volumes are 'nice to have', they ensure that the CD reuses your local .m2 and that the app data are extracted out of the container to some convenient location. In its most minimal form however the above Docker command becomes:

docker run --name openmrscd  -p 8080:8080 \
  -v ~/repos/openmrs-cd/node-scripts:/opt/node-scripts \
  -v ~/repos/openmrs-cd/jenkins/jenkins_home:/var/jenkins_home \

The 'node-scripts' component

Developing on OCD3 means working in here most of the time. That is because the bulk of the logic of what OCD3 does lives here. Almost all Jenkins jobs are built on the following pattern:

Jenkins jobs run Node scripts that generate Bash scripts that in turn perform the core CD tasks.

This is how one would build the underlying Node JS scripts:

gradle node-scripts:build

And this must be done before submitting code commits. However note that the code base is not really built into anything since the container links directly to /node-scripts, but this formats the code and runs the test suite.

A detailed developer guide about the Node scripts can be found here.

The 'docker' component

See here.

The 'jenkins' component

OCD3 not only needs a Docker image for its binaries but also requires a 'Jenkins home' folder that provides a pre-configured Jenkins setup:

gradle jenkins:build

This will package a zip archive of the jenkins folder.

Note: Developing with the jenkins component may require to use git clean -Xdf from time to time. Please read the note for developpers first.

The parent project (root folder)

Finally it is possible to build everything at once from the root level:

gradle build

This will cascade down to all child builds and run them.


A Continuous Delivery platform for OpenMRS and Bahmni servers





No releases published


No packages published


You can’t perform that action at this time.