Ensuring the sanctity of Bahmni backups

Problem Statement

  • Weekly once, backups from all clients get copied to a central server in the respective folders and numbered based on the week of the month
  • To test the sanctity of these backups every backup should be restored on a test machine
    • If restore fails then many times, the database server specially PostgreSQL does not start forcing to clean database / reinstall in some cases.
    • If database does not start, it becomes difficult to identifying the real reason to restore - backup issue or the data transfer issue (corrupt file etc.)
    • This hampers testing of backups for the other clients


  • Use automated script that uses Docker to test the sanctity of backups
    • The script uses appropriate Docker Image for PostgreSQL and MySQL
    • Use cron job to run the script weekly once when backup is copied
    • At the end of the script check one of the key tables of the restored backup say location in case of OpenMRS database and res_company in case of ODOO database to check the result returns the expected data.

Advantages of using Docker for Restore

  • If crashed/failed, Docker image can easily be recycled

A tailormade script has been developed (few things may have to be improved upon to make it generic; but works for now) to accomplish this task. The script can also be configured to send SMS for every database restored for every client.

Check the presentation for further details Testing Bahmni DB Restore.pdf (143.7 KB)