Common Troubleshooting Guide (docker)

NOTE: Below are some of the common issues that may come in while running Bahmni on Docker. If you run into other issues or the steps mentioned here don’t fix the issue, feel free to ask questions on Bahmni Slack #community channel.

 

How to view the logs of any container or service

docker-compose logs <service-name> -f # Examples # openmrs logs docker-compose logs openmrs -f # reports logs docker-compose logs reports -f # crater logs docker-compose logs crater-php -f # apache web proxy logs docker-compose logs bahmni-web -f # apache httpd logs docker-compose logs proxy -f

To see all the running services / containers

docker ps # Or docker-compose ps

To ssh into a running container

# Command: docker-compose exec <service_name> /bin/bash # e.g. To ssh into openmrs container docker-compose exec openmrs /bin/bash

 

To start a single service

To RESET and CLEAN everything and start again

The following commands will delete ALL docker images and volumes (databases) on your machine. You can choose to leave volumes as-is, if you want the DBs to remain as-is.

 

Getting 404 Error when accessing patient documents or implementer-interface or some service of Bahmni:

This issue might pop up when a deployment is made which has caused recreation of containers on the environment. When containers get recreated, the docker network might assign a different IP address to the containers within the docker network. Due to which the proxy service might not be able to properly proxy pass requests it received.

So whenever a deployment is made and containers are recreated, it is recommend to restart the proxy service with the following command to avoid errors due to improper proxy pass by containers. Run this command from bahmni-lite or bahmni-standard depending on which flavour you have deployed.

If you have a CI/CD based deployment to your environment, it is recommended to add the command to your workflow action and doing a docker compose up. Example here.

Bahmni UI keeps on loading

  • This might be because OpenMRS service is not started and initialised. Wait for 5-10 mins for OpenMRS to completely boot.

  • Check if OpenMRS is up by hitting https://localhost/openmrs

  • Check the status of container by running docker ps

  • Check the OpenMRS logs to see if its ready. You should see the following messages when its ready:

 

Bahmni UI on Login gives an OpenMRS Service Error

If on login to Bahmni EMR UI, you see the following error, The OpenMRS service is currently unavailable. Please check if the service is started and refresh the page once it up. It can happen if OpenMRS is not running. Please perform the following steps:

  1. Go to url: https://<ip>/openmrs/ (this should open the OpenMRS Admin UI home page). If this gives an error, then possibly openmrs service is not running (check and start the openmrs service).

  2. Try login into Openmrs Admin UI (enter any valid user creds, like superman and Admin123).

  3. Now logout from openmrs.

  4. Again try Bahmni EMR UI login page. It should load now. https://<IP>/bahmni/home/

  5. This error should only be seen on first time access of Bahmni UI (something to do with cookies issue). You can also try clearing your cookies/browser cache, or try accessing Bahmni in incognito mode – to validate this is a cookie/browser cache issue.

OpenMRS gives Proxy Error

  • This might be because OpenMRS service is not started and initialised. Wait for 5-10 mins for OpenMRS to completely boot.

  • Check the status of container by running docker ps

  • Check logs by running docker compose logs openmrs -f

Bahmni and OpenMRS are up, but entering data in Bahmni EMR UI gives error

  • Check if you have created the Search Index in OpenMRS (one time setup). See steps here.

To Run Bahmni Docker on Apple Silicon Mac M1 machines

  • Ensure that you have Docker desktop installed along with Rosetta2. See here.

  • In Bahmni docker-compose.yml file, in the following services: craterdb, crater-atomfeed-db & reportsdb(since arm64 images are not available for these services currently), add the line:

Request Header too Large Exception in OpenMRS Logs

If the OpenMRS logs show this exception, and on Bahmni EMR UI you see errors (esp opening the Orders TAB), etc. Then it is possibly happening due to this issue:

  1. Check in incognito mode of browser, if this still persists. It might not throw this error in incognitor, becuase no browser add-ons are adding any extra headers.

  2. To fix the issue, read this: https://stackoverflow.com/questions/39720422/java-tomcat-request-header-is-too-large . Steps to fix:

Unable to access Crater on remote machines

Crater needs a separate domain of its own to work and for its different components to communicate with each other. Unlike other Bahmni services where we make use of the Proxy image for navigating and routing requests we cannot create a subdirectory for Crater (like <domain>/crater). In order to be able to use it, a port access needs to be provided to Crater on cloud environments (e.g via AWS's security group rules).

Crater running on Docker can be configured further (Crater App URL, Port etc) by changing the values in .env file under the sections Crater Environment Variables and Crater-Atomfeed Environment variables. Read more about running Crater on Docker here. You need to ensure you mention the IP address in the following places in `.env` file:

Status call fails when uploading a csv file in the Admin module

In a fresh Bahmni instance, when a CSV file is uploaded for the first time in the CSV Upload section of the Admin module, an exception is triggered, resulting in an error message being displayed. Two calls are made: one for the upload and another for the status check. However, the status call returns a 500 error, showing a message in the UI ("There was an issue in the server. Please try again."), regardless of whether the program call succeeds or fails. Interestingly, clicking the refresh button resolves the status, displaying all statuses on the UI (Refer bug card).

It was identified that trying to update certain records within a MySQL DB using the JDBC connector leading to “Zero Date value Prohibited” exception. This occurs because the MySQL Java Connector, by default, throws this exception when processing empty or null values for datetime fields. To address this, the zeroDateTimeBehavior configuration property can be adjusted. Allowable values include:

  • "exception" (the default), which throws an SQLException with an SQLState of S1009.

  • "convertToNull", which returns NULL instead of the date.

  • "round", which rounds the date to the nearest closest value, which is 0001-01-01.

The recommended approach is to set OMRS_DB_EXTRA_ARGS to include &zeroDateTimeBehavior=convertToNull. During openmrs runtime, OMRS_DB_EXTRA_ARGS appends zeroDateTimeBehavior=convertToNull to the JdbcUrl. Upon boot up, openmrs utilizes its own startup script to define the jdbc url, where OMRS_DB_EXTRA_ARGS appends any provided parameters to the end of the url. See this: https://www.taogenjia.com/2021/05/26/JDBC-Error-Java-sql-SQLException-Zero-Date-value-Prohibited/

 

Patients are not getting synced as Customers on Crater

Typically requires a restart of the crater-atomfeed service. After restart, it takes about 2-3 mins for the atomfeed service to initialise. See sample logs of a successful run below.

 

 

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