Install Bahmni on Cloud (Digital Ocean)

Security Alert

There's been a security advisory from OpenMRS for webservices.rest module. As part of security Advisory, who ever planning to install Bahmni or already have installed Bahmni of versions 0.89, v0.90, v0.91 those have to replace existing webservices.rest module with 2.24.0 version module. 

 Steps to replace webservices.rest module


#Go to openmrs modules path on Bahmni server
sudo cd /opt/openmrs/modules

# Stop openmrs service
sudo service openmrs stop

# Take a backup of existing webservice.rest module (Eg for Bahmni v0.91)
sudo mv webservices.rest-2.20.0.omod webservices.rest-2.20.0.omod.backup
 
# Download webservices.rest-2.24.0.omod using below command 
sudo wget http://repo.mybahmni.org/packages/libraries/webservices.rest-2.24.0.omod

# Give ownership to bahmni user
sudo chown bahmni:bahmni webservices.rest-2.24.0.omod
 
# Start Openmrs service 
sudo service openmrs start

For more details on security advisory, please refer to below talk threads

https://talk.openmrs.org/t/critical-security-advisory-cve-2018-19276-2019-02-04/21607

https://talk.openmrs.org/t/update-for-cve-2018-19276-2019-02-04/21682

You can install Bahmni on the Cloud, as long as you meet the System Requirements (64-bit CentOS V7.x). One easy way of doing this is on Digital Ocean. Sign up using this referral link (you get 100$ credited to your account). Digital Ocean gives you a computer with a public IP on the cloud, with high speed internet access, and SSD drives. Please read the pricing FAQ for Digital Ocean.


Legal Implications of Cloud Deployments

Many countries have legal restrictions on storing medical data on the cloud. If you are unsure of your local laws & regulations, then please do NOT put real data on the cloud. Use the steps mentioned in this document only to "evaluate" or "play" with Bahmni on the Cloud.

Poor Internet

The advantage with deploying on the Cloud is that you can snapshot your machines, restore them quickly, and don't need to worry about Hardware. Also, if you have slow internet, then you can use a Cloud server, since the cloud machines have high speed internet access for downloads and uploads, while you use a slow ssh connection to talk to the computer. Downloading everything on your own machine can require higher internet speeds, and you may not want to do that if you have poor internet.

This page is currently limited to Digital Ocean. But, if you are familiar with AWS, Linode or any other IaaS cloud providers, then you can install and try Bahmni there. All you need is a 64-bit CentOS version 7.x machine with the hardware configuration described in the System Requirements.

For instance please read this post on how a community member setup Bahmni on AWS: https://talk.openmrs.org/t/how-to-install-bahmni-on-aws/10445


Steps to Install Bahmni on Digital Ocean

Step 1: Create an account on Digital Ocean. Sign up using this referral link to get 100$ credited to your account.

Step 2: Create a Droplet with the following settings at minimum (Read steps here):

  • 64-bit CentOS (v7.6)
  • For the hardware configuration, please see Bahmni System Requirements  (for instance: 8 GB RAM, 150 GB disk)
  • A region close to your geographical location for faster network speed
  • Enable "Private Networking"
  • Add your Public SSH Key (else they will email you a root login password). SSH Key is more secure and recommended.

Step 3: You should be able to login into your machine using the command "ssh root@<ip-of-your-droplet>

Step 4: Setup swap space on your machine using these steps (for reference read this document). We want to setup 4 GB  of swap space.

Setup 4 GB Swap Space on CentOS
# Informs you of how much swap space is allocated. if nothing is returned, then its not setup.
swapon -s   
 
# To setup 4096k (4GB swap space) do these steps: 
sudo dd if=/dev/zero of=/swapfile bs=1024 count=4096k
sudo mkswap /swapfile

# Activate the swap file
sudo swapon /swapfile  
echo '/swapfile   swap   swap    defaults        0 0' | sudo tee --append /etc/fstab
 
# Check if swap space is setup
swapon -s   


Now you have a fresh 64-bit CentOS Box available with 4GB swap space setup. You can choose to snapshot this box, so that you don't need to repeat these steps next time you need a fresh box.


NOTE: Digital Ocean servers, and other similar cloud providers can be vulnerable to attacks by malicious hackers. Please ensure you safeguard your droplet, and follow these instructions after having installed Bahmni, to improve the security of your droplet and setup firewall:

https://www.digitalocean.com/community/tutorials/7-security-measures-to-protect-your-servers

Step 5: To Install Bahmni follow this document: Install Bahmni on CentOS (Please ensure you also read the Security related information in that page to setup firewall, etc)