# Common Sections

Grouping of similar sections accross all modules 

# POC installation

POC INSTALLATION INSTRUCTIONS  
Pre-requisites  
● MySQL 8.0+  
● Ruby 3.2.2  
● Rails 7.0.2  
● Nginx web server 1.9 or above  
10.2.

New Installation  
For a new front-end installation, run the following commands:  
Step 1: Navigate to the location where you want the application to be  
cd /var/www  
Step 2: Clone the application by running the following command:  
git clone https://github.com/HISMalawi/HIS-Core-release.git HIS-Core  
Step 3: Navigate to the directory you have cloned in Step 2  
cd /var/www/HIS-Core  
Step 4: Use vim, vi or nano or any ASCII-compatible text editor to configure the endpoint of the API. Open the file config.json  
nano /var/www/HIS-Core/config.json

Modify apiURL and api Port according to your environment  
Step 5: Navigate to the nginx directory depending on where Nginx is on your server  
cd /opt/nginx/conf or cd /etc/nginx (For old server image)  
Step 6: Edit the server block and add the following:  
server {  
listen 4000;  
server\_name localhost;  
location / {  
root /var/www/HIS-Core/;  
index index.html index.htm;  
try\_files $uri $uri/ /index.html;  
}  
rails\_env development;  
}  
Run sudo /opt/nginx/sbin/nginx -s reload to reload the web server on the old server image or  
Run sudo systemctl restart nginx.service on the new server image  
The application will run on http://0.0.0.0:4000 where the IP address of the server is 0.0.0.0. The user can access the front end from the actual IP address of the server

Upgrade of existing front-end installation  
To upgrade to the latest version, make sure the targeted machine has access to the following GitHub repository:  
https://github.com/HISMalawi/HIS-Core-Release/  
To upgrade the front end, navigate to the respective directory where it is running and run the following commands:  
a) Run git fetch –tags  
b) Run git checkout &lt;targeted version&gt;. (Refer to section 2 for the version details). For example, git checkout v2024.Q3.R5  
c) Use vim, vi or nano or any ASCII-compatible text editor to configure the endpoint of the API. Open the file config.json  
d) Ensure that under the apps block, the ART module is set to enabled  
e) Run sudo /opt/nginx/sbin/nginx -s reload or sudo systemctl restart nginx.service to reload the web server  
APK Download Link: https://github.com/HISMalawi/HIS-Core-release/releases/download/v2024.Q4.R1/2024.Q4.R1.apk   
BHT-EMR-API  
To upgrade to the latest version, make sure the targeted machine has access to the following GitHub repository:  
https://github.com/HISMalawi/BHT-EMR-API  
To upgrade the API, navigate to the respective folder where it is running and run the following commands:  
a) Run git fetch –tags  
b) Run git checkout &lt;targeted version&gt;. (Refer to Section 2 for the latest tags). For example, git checkout v5.3.0  
c) Run bundle install --local   
d) Restart the the emr-api service by running sudo systemctl restart emr-api.service(New server image), if you are using Nginx with passenger-module (Old server image) run sudo /opt/nginx/sbin/nginx – s reload  
e) Load the following files to your targeted ART database:  
1\. db/sql/openmrs\_metadata\_1\_7.sql  
2\. db/sql/moh\_regimens\_v2021.sql  
3\. db/sql/bart2\_view\_schema\_additions.sql  
4\. db/sql/alternative\_drug\_names.sql  
2\. 5. db/sql/ntp\_regimens.sql  
Using the script below  
./bin/update\_art\_metadata.sh \[development/production\]  
10.4. API Database Configuration   
It is advised that all sites should configure their database.yml like in the picture below for optimal performance of the app. The other settings can be set according to the facility setup but of focus are the variables anchor which is a new setting for mysql 8.0.