Quick Setup Guide for Bahmni Developers

Before jumping into setup local code for development, it is important to understand Bahmni and its architecture. This is because different sub-components of Bahmni have different backing code repositories (in different tech stacks) and hence, it is imperative you understand what repository/codebase you wish to setup locally, and why.

  1. Training: Please watch Bahmni training video here to get familar with Bahmni software and architecture: Bahmni - Starting off the Bahmni Journey - Dec 2021 (Training)

  2. Demo: Play with our online Bahmni demos to get familiar with Bahmni look-and-feel and functionality: Bahmni Online Demo

  3. Docker: Setup Bahmni locally on your own machine using this: Running Bahmni on Docker

  4. Code: Now you can setup the code (brief steps mentioned below for frontend and backend of Bahmni EMR). Note: You will need to know which repository you need to setup depending on what you wish to change. Ask on Slack #community channel for guidance.

Learn how to get started with the Bahmni Codebase. This article describes how to quickly get started with the codebase. For a more detailed guide, see Developer's Guide.

Table of Contents

Useful Links

Here are some essential links to help you along the way:

Setting Up Bahmni on Docker

The following guide helps you in installing Bahmni using Docker.

Prerequisites

  • Install a stable version of Git.

  • Install the latest stable versions of Docker and Docker Compose on your machine, based on your respective OS.

  • Clone the Bahmni Docker repository.

Docker Setup

Now, let's set up Bahmni using Docker:

  1. Navigate to the relevant subfolder for your desired configuration.

    cd bahmni-docker/bahmni-standard OR cd bahmni-docker/bahmni-lite
  2. Edit the .env.dev file, and make the following changes:

    • Change COMPOSE_PROFILES=bahmni-standard OR COMPOSE_PROFILES=bahmni-lite in the .env.dev file (or run with the default, which is just emr). For a detailed guide on the Docker compose profiles that Bahmni uses, see Docker Compose Profiles.

  3. Execute the script:

    ./run-bahmni.sh .env.dev

    This script provides various options such as start, stop, view logs, pull updates, reset, and more. You can read more about the script here.

Making Changes in Bahmni Apps

To make changes in Bahmni Apps, follow these steps:

  1. Clone the openmrs-module-bahmniapps repository and complete the one-time installation steps as mentioned in the README.md file.

  2. Set the Bahmni Apps folder path as the value for BAHMNI_APPS_PATH in the .env.dev file.

  3. In the docker-compose.yml file, under the bahmni-web service definition, find the below 2 commented lines:

    # - "${BAHMNI_APPS_PATH:?}/ui/app/:/usr/local/apache2/htdocs/bahmni" # - "${BAHMNI_APPS_PATH:?}/ui/node_modules/@bower_components/:/usr/local/apache2/htdocs/bahmni/components"
  4. Uncomment the above lines.

  5. Reload your tab and the changes that you make will get reflected on your local server.

Making Changes in Bahmni Core

Running the Change in the OpenMRS Service

To run changes in the OpenMRS service within Bahmni, follow these steps:

  1. Clone the bahmni-core repository, making sure you meet the requisites mentioned in the README.md.

  2. Build bahmni-core/omod using the following command:

  3. Copy bahmni-core/bahmnicore-omod/target/bahmnicore-omod-VERSION-SNAPSHOT.omod into the OpenMRS modules directory and restart OpenMRS:

  4. Execute into the OpenMRS container by running the following commands:

  5. Navigate to the modules folder:

  6. List all the files in the folder:

Optionally, if you can remove the older bahmnicore-omod before continuing to the next step.

  1. Now, give the omod root permissions:

  2. Exit from the container.

  3. Finally, restart OpenMRS to reflect the changes:

Setting Up a Debugger

To set up a debugger for OpenMRS, perform the following steps:

  1. Edit the .env.dev file, and make the following changes:

    • Change #OMRS_DEV_DEBUG_PORT= to OMRS_DEV_DEBUG_PORT=8200.

  2. In the docker-compose.yml file, under the openmrs service definition, find the below 3 commented lines:

  3. Uncomment the above lines.

  4. Run the debugger, and you are all set to debug your Bahmni code.

To read more about setting up a Debugger for Visual Studio Code, see Running and debugging Java and for IntelliJ IDEA, refer Debug your first Java application.

Making Changes in Docker Services

  1. Build the service using the following command:

  2. Restart OpenMRS.

With these steps, you are ready to embark on your Bahmni development journey.

The Bahmni documentation is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)