Skip to content

Latest commit

 

History

History
278 lines (176 loc) · 5.48 KB

INSTALL GUIDE - HEADLESS SERVER.md

File metadata and controls

278 lines (176 loc) · 5.48 KB

Install cHIMS in a Headless production server.

Table of Contents.

  • Install the OS and the necessary packages.

  • Preparing the database.

  • Downloading and configuring Payara Server 5.x.

  • Configure JDBC MySQL connector.

  • Configuring Payara Server.

  • Installing CHIMS.

  • Troubleshooting.

  • Upgrading Cloud HIMS.

Install the OS and the necessary packages.

Download and install the latest Ubuntu Server in your headless Linux server or a cloud VM (e.g., Ubuntu Server 22.10 x64).

You can install the minimised version to limit resource usage.

Select install Open SSH Server

Connecting to the Ubuntu Server through SSH.

ssh USER_NAME@SERVER_IP_ADDRESS

Updating the system

sudo apt update

sudo apt upgrade

Install JDK.

java --version
sudo apt install openjdk-11-jdk

Install git.

sudo apt install git

Install zip.

sudo apt install zip

Installing MySql server.

sudo apt install mysql-server

Install Apache Maven.

sudo apt install maven

Preparing the database.

sudo mysql -u root -p

Configure the root password

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'ROOT_PASSWORD';

Create additional user

CREATE USER 'USER_NAME'@'localhost' IDENTIFIED WITH mysql_native_password BY 'USER_PASSWORD';

Create the database

create database DATABASE_NAME ;
GRANT ALL PRIVILEGES ON DATABASE_NAME.* TO 'USER_NAME'@'localhost';

Uploading a sample/backup dataset - Optional.

use DATABASE_NAME;

source ./SOURCE_PATH/SOURCE.sql;

Exit;

Downloading and configuring Payara Server 5.x.

wget https://s3.eu-west-1.amazonaws.com/payara.fish/Payara+Downloads/5.2022.5/payara-5.2022.5.zip?hsCtaTracking=7cca6202-06a3-4c29-aee0-ca58af60528a%7Cb9609f35-f630-492f-b3c0-238fc55f489b -O payara-5.2022.5.zip
unzip payara-5.2022.5.zip

Start Payara Server

./payara5/bin/asadmin start-domain

Change admin password

./payara5/bin/asadmin change-admin-password

Enable secure admin

./payara5/bin/asadmin enable-secure-admin

Restart the Payara Server

./payara5/bin/asadmin restart-domain

Once the server is up and running, navigate to http://SERVER_IP_ADDRESS:4848 in your web browser to access the console.

Configure JDBC MySQL connector.

Download JDBC MySQL connector

wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-j-8.0.31.zip

Extract the archive.

unzip mysql-connector-j-8.0.31.zip

Add the JDBC MySQL connector to Payara Server

./payara5/bin/asadmin add-library ./mysql-connector-j-8.0.31/mysql-connector-j-8.0.31.jar

Restart the Payara server.

./payara5/bin/asadmin restart-domain

Configuring Payara Server.

After configuring the JDBC MySQL connector, navigate to http://SERVER_IP_ADDRESS:4848 in your web browser to access the console.

Configuring JDBC Connection Pool.

  • Pool Name: chims (A name for your Pool)

  • Resource Type: javax.sql.DataSource

  • Database Driver Vendor: MySql8

  • Additional Properties:

Name Value
ServerName localhost
PortNumber 3306
DatabaseName DATABASE_NAME
User DATABASE_USER
Password DATABASE_PASSWORD
UseSSL false
allowPublicKeyRetrival true
URL jdbc:mysql://localhost:3306/DATABASE_NAME

Click Ping and look for ✅ Ping Succeeded

Configuring JDBC Resources.

  • JNDI Name: jdbc/chims

  • Pool Name: chims

Installing cHIMS.

Obtaining the source code.

git clone https://github.com/lk-gov-health-hiu/chims.git`

Packaging and deploying the project.

mvn package -f chims

Deploying the cHIMS Application.

./payara5/bin/asadmin deploy ./chims/target/WAR_FILE_NAME.war

In the Payara Server Console, go to Applications, and under the Deployed Applications section, click Launch for the deployed application (chims-0.1).

It will open a new window, and it will have the links to the launched application.

E.g., http://SERVER_NAME:8080/chims

While the application is deployed on a remote server, we need to replace the server name with the IP address.

E.g., http://SERVER_IP_ADDRESS:8080/chims

After creating the user and the institution, you can log in and use/customise the system.

Troubleshooting.

Look at the error message and check the log file.

Sometimes you may need to edit the following files before packaging the project into a .war file.

./pom.xml ./src/main/resources/META-INF/persistence.xml ./src/main/webapp/WEB-INF/glassfish-web.xml

Upgrading cHIMS.

Back up the database and the previous installation.

Change to the chims directory.

cd chims

Pull the updated source codes from GitHub.

git pull

Package the project into a .war file

mvn package -f chims

Force deploy the new .war file.

./payara5/bin/asadmin deploy --force ./chims/target/chims-0.1.war