Installing the Backend System
Follow these instructions to install, build, and verify the backend system.
System Requirements
To operate the backend system, you must have one of the following:
- A 64-bit Mac OS (Intel or ARM)
- A 64-bit Linux machine (Ubuntu or Debian)
Prerequisites
I. Update the Environment
-
Open a
Terminal
window; if using Linux or Mac. -
If you are using Linux, make sure your environment system packages are up to date.
sudo apt update sudo apt upgrade
II. Install Java 17
-
Install the OpenJDK package.
Mac:Go to https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html. Download the kit based on your system requirements. Install the JDK.
Linux:
sudo apt install -y openjdk-17-jdk-headless unzip
-
Verify that you have successfully installed version 17.
java -version
Make sure it is:
java version "17.0.8" 2023-07-18 LTS Java(TM) SE Runtime Environment (build 17.0.8+9-LTS-211) Java HotSpot(TM) 64-Bit Server VM (build 17.0.8+9-LTS-211, mixed mode, sharing)
III. Install Docker and Docker Compose
-
Download Docker Desktop to get all the necessary packages for this installation: https://www.docker.com/products/docker-desktop/
-
Open the Docker Desktop.
-
Confirm successful installation.
MAC:
docker info
Linux:
sudo docker --version sudo systemctl status docker `
VI. Clone Backend System
-
If you do not have Git, install it using the instruction here: Git - Installing Git (git-scm.com)
-
If you wish to iterate and develop on the backend, please fork the repo and then clone it from your own account. You can find steps to fork here: https://docs.github.com/en/get-started/quickstart/fork-a-repo
-
Download the latest implementation of the Samsung Health Stack backend system from GitHub.
git clone https://github.com/S-HealthStack/backend-system.git
The folder in which you cloned the
backend-system
will be referred to as<install_path>
within this document.
V. Firebase Service
-
If you do not have an account, create a Firebase account and a project with default settings by visiting: Firebase (google.com)
-
Go to the [Firebase console](Firebase console) and select your project.
-
Click on the gear icon in the top left corner to access your project settings.
-
Click on the
Service accounts
tab. -
Click the
Generate new private key
button to generate a new service account key file (we used Node.js on our Mac test).NOTE: You don't need to follow any further instructions on Firebase at this point - all you had to do was generate the key.
-
Return to the terminal and create a Firebase
service-account-key.json
file.cd backend-system/platform touch service-account-key.json
-
Update the
service-account-key.json
file with the private key generated in step 5 soservice-account-key.json
looks like the key you created/downloaded from Firebase. -
.gitignore this
service-account-key.json
file as it includes sensitive info about your Firebase account.
Installation
Method 1: Using Docker Compose
I. backend-config-files-v1.zip
-
Download
backend-config-files-v1.zip
from https://github.com/S-HealthStack/S-HealthStack.github.io/blob/main/files/installing-the-backend/backend-config-files-v1.zip -
Extract the files and place them at the level of
backend-system
. Your file structure should look as follows for<install_path>
:backend-system docker-compose.yml haproxy multi_db rule-update trino ref.tgz .env
II. Database (Optional)
-
If you don't want to use our provided sample database, following the Configuring the Database page instructions if you want to connect to the running Postgres container.
-
(Optional) Update PostgreSQL root user password and SMTP relay server host, username, port, and password. We use SMTP service to send account invitation/activation/password reset emails.
POSTGRES_PASSWORD=<new-value-here> SMTP_HOST=<new-value-here> SMTP_PORT=<new-value-here> MAIL_USER=<new-value-here> MAIL_USER_PASSWORD= <new-value-here>
-
(Required if performing Step 2) Sync password with Trino PostgreSQL catalog file downloaded located at:
<install_path>/trino/etc/catalog/postgresql/postgresql.properties
connector.name=postgresql connection-url=jdbc:postgresql://hrp-postgres:5432/healthstack connection-user=postgres connection-password= <new-value-here>
III. Compile
-
Move into the backend-system directory.
cd backend-system
-
Compile and package the backend-related microservices:
Mac & Linux:
./gradlew clean ./gradlew build -x detekt