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 https://bahmni.atlassian.net/wiki/spaces/BAH/pages/1310748/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:
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:
mvn clean install -DskipTests
Copy
bahmni-core/bahmnicore-omod/target/bahmnicore-omod-VERSION-SNAPSHOT.omod
into the OpenMRS modules directory and restart OpenMRS:docker cp <bahmni-core/bahmnicore-omod/target/bahmnicore-omod-VERSION-SNAPSHOT.omod> bahmni-standard-openmrs-1:/openmrs/data/modules
Execute into the OpenMRS container by running the following commands:
docker exec -it bahmni-standard-openmrs-1
Navigate to the modules folder:
cd data/modules
List all the files in the folder:
ls -ltr
Optionally, if you can remove the older bahmnicore-omod before continuing to the next step.
Now, give the omod root permissions:
chown -R root:root <bahmnicore-omod-VERSION-SNAPSHOT.omod>
Exit from the container.
Finally, restart OpenMRS to reflect the changes:
docker compose restart openmrs
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:
#OMRS_DEV_DEBUG_PORT: ${OMRS_DEV_DEBUG_PORT} #ports: # - ${OMRS_DEV_DEBUG_PORT}:${OMRS_DEV_DEBUG_PORT}
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:
docker build -t <org-name>/<image-name>:<image-tag> -f <Dockerfile-path> .
Restart OpenMRS.
With these steps, you are ready to embark on your Bahmni development journey.