Installation
Testing harness tool is a complete test framework that will facilitate testing how well technologies align to the OpenHIE Architecture specification and health and data content, as specified by WHO SMART Guidelines.
Setting Up File System
Step 1: Create Directories
- Open a terminal window.
- Navigate to the
/srv
directory:cd /srv
- Create a directory named tht:
mkdir tht
- Inside the tht directory, create three more directories:
- error-logs to store error logs based on dates.
mkdir tht/error-logs
- files where DocumentService related files will be stored.
mkdir tht/files
- files where database backup related files will be stored.
mkdir tht/backup
- error-logs to store error logs based on dates.
Step 2: Set Permissions
Run this command for permission update:
sudo chmod -R a+rwx /srv/tht
Docker Configuration
Docker Installation
- One can refer the official Docker website at https://docs.docker.com/engine/install/ubuntu/ or visit DigitalOcean's documentation for instructions on installing Docker on Ubuntu 20.04. The steps outlined are sourced from DigitalOcean's guide available at https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04.
Linux(Ubuntu)
- Update existing list of packages:
sudo apt update
- Install a few prerequisite packages:
These let apt use packages over HTTPS.
sudo apt install apt-transport-https ca-certificates curl software-properties-common
- Install curl:
This command updated existing list of packages.
sudo apt update
This command will install the curl package.sudo apt install curl
This command will give the version of curl that has been installed. You can use this to check curl installation result.curl --version
This command fetches the contents of the given webpage. It is used to check of curl is working properly.curl http://www.example.com/
- Add GPG key:
This adds the GPG key of official docker repository in your system.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- Add Docker repository to APT sources:
This will also update our package database with the Docker packages from the newly added repo.
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
- Run this command in the terminal:
This command makes sure you are about to install from the Docker repo instead of the default Ubuntu repo You’ll see output like this, although the version number for Docker may be different:
apt-cache policy docker-ce
Notice that docker-ce is not installed, but the candidate for installation is from the Docker repository for Ubuntu 20.04 (focal).docker-ce:
Installed: (none)
Candidate: 5:19.03.9~3-0~ubuntu-focal
Version table:
5:19.03.9~3-0~ubuntu-focal 500
500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages - Install Docker
Docker should now be installed, the daemon started, and the process enabled to start on boot.
sudo apt install docker-ce
- Check if it is running:
The output should be similar to the following, showing that the service is active and running:
sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2020-05-19 17:00:41 UTC; 17s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 24321 (dockerd)
Tasks: 8
Memory: 46.4M
CGroup: /system.slice/docker.service
└─24321 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Docker Setup
Step 1: Directory Modifications and Initial Zip File Movement
- Go to the project directory.(The extracted folder of the GitHub zip file)
- Execute the following command:
sudo bash ./copy_zips.sh files
- The terminal will display the list of files copied to the directory
/srv/tht/files
. - Grant permissions to that folder using the following command:
sudo chmod -R 777 /srv/tht
Step 2: Launch Docker-Compose
- Navigate to the project directory.(The extracted folder of the GitHub zip file)
- Run the following command:
sudo docker compose up
- The
tht.env
file is available to configure ports and other settings. If needed, make changes there. - Attempt to access
http://localhost:3000/
to reach the testing-harness-tool's login page.
Docker Guide
1: Docker Commands For Initial Setup
- Navigate to the project directory.(The extracted folder of the GitHub zip file)
- Run the following command to build the docker:
sudo docker-compose --env-file tht-prod.env build
- Run the following command to run docker:
sudo docker-compose --env-file tht-prod.env up
- NOTE: Replace docker-compose with docker compose if the Ubuntu version is newer then 20.04.2 LTS
2: Docker Rerun Commands
- Navigate to the project directory.(The extracted folder of the GitHub zip file)
- Run the following command docker down
OR Run the following command docker down Along with database refresh
sudo docker-compose down
sudo docker-compose down -v
- Run the following command to fetch the new code:
git pull
- Run the following command to build the docker:
sudo docker-compose --env-file tht-prod.env build
- Run the following command to run docker:
sudo docker-compose --env-file tht-prod.env up
- NOTE: Replace docker-compose with docker compose if the Ubuntu version is newer then 20.04.2 LTS
3: Schedule Database Backup
- Navigate to the project directory.(The extracted folder of the GitHub zip file)
- Run the following command:
crontab -e
- Write following line and replace ProjectDirectoryPath while writing and save it.
* 2 * * * {ProjectDirectoryPath}/backup.sh
- Now everyday at 2:00 a.m. database backup will get stored in
/srv/tht/backup
directory and latest 2 copy will be available.
4: Restore Database Backup
- Navigate to the project directory.(The extracted folder of the GitHub zip file)
- Using following command to stop docker:
sudo docker-compose down
- Now run following command to restore database:
To restore latest backup
To restore second latest backup
sudo sh restoreLatest.sh
sudo sh restoreSecondLatest.sh
- Using following command to up docker:
sudo docker-compose up
- NOTE: Replace docker-compose with docker compose if the Ubuntu version is newer then 20.04.2 LTS