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.
Training: Please watch Bahmni training video here to get familar with Bahmni software and architecture: Bahmni - Starting off the Bahmni Journey - Dec 2021 (Training)
Demo: Play with our online Bahmni demos to get familiar with Bahmni look-and-feel and functionality: Bahmni Online Demo
Docker: Setup Bahmni locally on your own machine using this: Running Bahmni on Docker
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:
Ability to push/pull to Github repositories (using SSH Keys)
Setting up Bahmni on the cloud for development using Github Codespaces
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:
Navigate to the relevant subfolder for your desired configuration.
cd bahmni-docker/bahmni-standard OR cd bahmni-docker/bahmni-lite
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 justemr
). For a detailed guide on the Docker compose profiles that Bahmni uses, see Docker Compose Profiles.
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:
Clone the openmrs-module-bahmniapps repository and complete the one-time installation steps as mentioned in the README.md file.
Set the Bahmni Apps folder path as the value for
BAHMNI_APPS_PATH
in the .env.dev file.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"
Uncomment the above lines.
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:
Clone the bahmni-core repository, making sure you meet the requisites mentioned in the README.md.
Build bahmni-core/omod using the following command:
Copy
bahmni-core/bahmnicore-omod/target/bahmnicore-omod-VERSION-SNAPSHOT.omod
into the OpenMRS modules directory and restart OpenMRS:Execute into the OpenMRS container by running the following commands:
Navigate to the modules folder:
List all the files in the folder:
Optionally, if you can remove the older bahmnicore-omod before continuing to the next step.
Now, give the omod root permissions:
Exit from the container.
Finally, restart OpenMRS to reflect the changes:
Setting Up a Debugger
To set up a debugger for OpenMRS, perform the following steps:
Edit the .env.dev file, and make the following changes:
Change
#OMRS_DEV_DEBUG_PORT=
toOMRS_DEV_DEBUG_PORT=8200
.
In the docker-compose.yml file, under the openmrs service definition, find the below 3 commented lines:
Uncomment the above lines.
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
Build the service using the following command:
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)