Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Kindly skip to DB backup extraction if the pre setup of Docker and GitHub repositories are already completed.

♣️Repositories

🔸 Bahmni Lite

🔸 Bahmni Lite - India based with ABDM integration

🔸 Bahmni Scripts - to build DB for openMRS

♣️Setup

🔹 Git clone the respective Bahmni Lite repository

🔹 Git clone the Bahmni Scripts repository

🔹 Install Docker

♣️DB backup extraction

We used Kubernetes on cloud to run Bahmni Lite. So the following setup will extract DB dump based on Kubernetes commands.

🔹 Get into the openMRS kubernetes pod

kubectl exec -it openmrs<POD_ID> -n <namespace> -- bash

🔹 Navigate to the openmrs/data folder and zip the configuration checksum folder

#install zip
yum install zip

#Navigate to openmrs/data directory
cd /openmrs/data

#Zip the checksums folder
zip -r configuration_checksums.zip configuration_checksums

🔹 Extract the existing DB as a SQL dump

#Install mysql
yum install mysql

#Export the current live DB as a sql dump to the pod
mysql -u username -p database_name > omrsdb.sql
#Provide password and press Enter

#Exit Mysql
Exit

🔹 Capture Database details

#Open the runtime properties
cat openmrs-runtime.properties

#Exit the openMRS pod
Exit

Keep a note of the above DB details and maintain them securely until the setup is completed successfully

🔹 Copy the files to local machine

#Copy the checksums zip to the local
kubectl cp performance/openmrs-<POD_ID>:/openmrs/data/configuration_checksums.zip configuration_checksums.zip

#Copy the sql dump to the local
kubectl cp performance/openmrs-<POD_ID>:/openmrs/data/omrsdb.sql omrsdb.sql

♣️Build the DB in Docker

We used mysql 5.7 for our setup, if you use mysql 5.6 kindly change it wherever applicable.

🔹 Navigate to ~/bahmni-scripts/demo/db-backups/1.0.0-lite/mysql5.7/resources

🔹 Delete the files present in this directory

🔹 Copy and paste the files exported from the pod i.e configuration_checksums.zip and omrsdb.sql to this directory

🔹 Navigate back to the mysql5.7 directory and replace the Dockerfile contents with the following code:

Apple M1 Chip

ARG arch
FROM --platform=linux/amd64 mysql:5.7

#Install the required tools
RUN yum update -y && \
   yum install -y \
   unzip

#Set the mysql root password
ENV MYSQL_ROOT_PASSWORD=<ROOTPASSWORD>

#Copy configuration_checksums & DB Backup
COPY demo/db-backups/1.0.0-lite/mysql5.7/resources/*.zip  .
COPY demo/db-backups/1.0.0-lite/mysql5.7/resources/*.sql  /docker-entrypoint-initdb.d/omrs_db_backup.sql

RUN unzip configuration_checksums.zip && \
   rm configuration_checksums.zip

Others

FROM mysql:5.7

#Install the required tools
RUN yum update -y && \
   yum install -y \
   unzip

#Set the mysql root password
ENV MYSQL_ROOT_PASSWORD=<ROOTPASSWORD>

#Copy configuration_checksums & DB Backup
COPY demo/db-backups/1.0.0-lite/mysql5.7/resources/*.zip  .
COPY demo/db-backups/1.0.0-lite/mysql5.7/resources/*.sql  /docker-entrypoint-initdb.d/omrs_db_backup.sql

RUN unzip configuration_checksums.zip && \
   rm configuration_checksums.zip

🔹 Navigate to bahmni-scripts root directory and execute the following docker command:

docker build --no-cache -t bahmni/openmrs-db:<TAGNAME> -f demo/db-backups/1.0.0-lite/mysql5.7/Dockerfile .

♣️Config the environment and docker compose

🔹 Navigate to the bahmni-docker/bahmni-lite or bahmni-india-package directory where the docker- compose.yml is present

If using M1 chip, add platform: linux/amd64 to each service present under the docker compose file.

🔹 Add the openMRS DB details captured earlier in DB backup extraction to the .env file and save it

# OpenMRS Environment Variables
OPENMRS_IMAGE_TAG=latest
OPENMRS_DB_IMAGE_NAME=bahmni/openmrs-db:<TAGNAME>
OPENMRS_DB_NAME=<DBNAME>
OPENMRS_DB_HOST=openmrsdb
OPENMRS_DB_USERNAME=<DBUSERNAME>
OPENMRS_DB_PASSWORD=<DBPASSWORD>
OPENMRS_DB_CREATE_TABLES='false'
OPENMRS_DB_AUTO_UPDATE='true'
OPENMRS_MODULE_WEB_ADMIN='true'
MYSQL_ROOT_USERNAME=root
# OMRS_DEV_DEBUG_PORT=
OMRS_JAVA_SERVER_OPTS=''
OMRS_JAVA_MEMORY_OPTS=''
OPENMRS_UPLOAD_FILES_PATH=./openmrs-uploads
BAHMNI_OPENMRS_MODULES_PATH=
MYSQL_ROOT_PASSWORD=<ROOTPASSWORD>
OPENMRS_DB_TYPE=mysql
OPENMRS_DOCKER_ENV='true'

♣️Invoke Bahmni Lite

🔹 Bring up Bahmni through Docker compose

docker-compose up -d --build

🔹 Wait for openMRS to load with all the required indexes

🔹 Enter “http://localhost/openmrs” in browser and verify openMRS is up

🔹 Navigate to “http://localhost/” and start using Bahmni.

  • No labels