How bahmni/openmrs-distro-bahmni works
Project type and purpose
• This is a *distribution builder* for OpenMRS (a Java-based EMR platform) tailored to the Bahmni distribution.
• It assembles OpenMRS core + Bahmni configuration module + FHIR CDSS and Terminology modules into deployable artifacts.
• It provides Docker images and Helm charts for containerized deployment.
File structure
• Top-level: Maven wrapper (mvnw, pom.xml), distro (assembly), openmrs-module-bahmni.configuration (custom module), package (docker + helm), GitHub workflows for CI/CD.
• distro/src/main/assembly: defines Maven Assembly descriptor to bundle core + modules.
• openmrs-module-bahmni.configuration: Java code + resource files (apps JSON, config.xml, message bundles) – this is the main customization module.
• package/docker/openmrs: Dockerfile, shell startup scripts, property templates.
• package/helm/openmrs: Helm Chart (Chart.yaml, values.yaml) + Kubernetes templates (Deployments, Services, ConfigMaps, Secrets, Volumes, HPA).
README for additional insights
• Build command: ./mvnw clean deploy publishes artifacts into the Bahmni Maven repo.
• Bundles FHIR CDSS and Terminology modules.
a. Main components
1. *Build & Packaging*
• Maven Build Server (CI via GitHub Actions)
• Maven Assembly Plugin (produces distro ZIPs/JARs)
2. *Artifact Repository*
• bahmnirepo.thoughtworks.com (Maven repo)
3. *Container Image*
• Dockerfile builds openmrs + modules
• startup scripts inject configuration
4. *Deployment & Orchestration*
• Kubernetes Cluster
• Helm Chart for OpenMRS
5. *Runtime Components*
• OpenMRS Platform (Spring web app)
• Bahmni Configuration Module (Activator.java + resources)
• FHIR CDSS Module
• FHIR Terminology Service Module
• Database (MySQL / Postgres)
• Persistent Volumes (for uploads, images, forms)
• ConfigMaps & Secrets (properties, credentials)
6. *External Services*
• FHIR Terminology Server (SNOMED CT service)
• CDSS Rule Engine (if hosted externally)
b. Relationships & Interactions
• CI pushes Maven artifacts → Maven repo
• Docker build fetches artifacts from repo → produces image → pushes to Docker registry
• Helm install pulls image → creates Kubernetes Deployment
• Container at startup uses bahmni_startup.sh + ConfigMap/Secret → writes openmrs-runtime.properties → launches OpenMRS
• OpenMRS loads Bahmni configuration module + FHIR modules on startup
• OpenMRS connects to the relational DB (persistent volume claim)
• OpenMRS exposes REST APIs (FHIR endpoints); may call out to external CDSS/Terminology services
• Kubernetes manages scaling (HPA), service endpoints, volume mounts, and secrets injection
c. Architectural patterns & design principles
• Plugin modularity (OpenMRS modules loaded via Activator)
• Build ↔ Repository ↔ Container ↔ Orchestration pipeline
• Infrastructure-as-code (Helm charts, Dockerfiles)
• Separation of concerns: build vs package vs deploy vs runtime
d. Key technologies/frameworks
• Java, Spring, Maven
• OpenMRS module framework
• Maven Assembly Plugin
• Docker, Bash shell scripts
• Kubernetes, Helm
• GitHub Actions for CI/CD
• FHIR (CDSS, Terminology)
Essential details to capture
• Assembly descriptor’s role in bundling modules
• openmrs-module-bahmni.configuration as the customization entry point
• Use of ConfigMap templates in Helm for openmrs-runtime.properties and other .template files
• Volume mounts for persistent data
• Optional scaling via HPA
– how source code flows from GitHub → Maven → Docker → Kubernetes
– how the OpenMRS server is composed at runtime (core, Bahmni config module, FHIR modules)
– how infrastructure elements (DB, volumes, config, secrets, external FHIR services) connect together
– which technologies and frameworks play each role.