Markdown |
---|
- [Introduction](#introduction)
- [Target Audience](#target-audience)
- [End User License Agreement](#end-user-license-agreement)
- [Prerequisites](#prerequisites)
- [Gateway Hostname](#gateway-hostname)
- [Hardware Requirements](#hardware-requirements)
- [Operating System](#operating-system)
- [Docker](#docker)
- [PowerShell](#powershell)
- [HTTPS](#https)
- [Gateway Basic Auth Password](#gateway-basic-auth-password)
- [User uid](#user-uid)
- [Docker group gid](#docker-group-gid)
- [Installing](#installing)
- [Running the Install Script](#running-the-install-script)
# Introduction
The Smart Classifier ML is a set of APIs for training machine learning (ML) models and making predictions based on these models. The Smart Classifier ML APIs are required by the Smart Classifier feature in the Saga platform.
## Target Audience
This guide is directed towards system administrators that are to install the Smart Classifier ML.
## End User License Agreement
By installing the software one is accepting the [End User License Agreement](https://www.ayfie.com/hubfs/terms/eula.pdf).
# Prerequisites
## Gateway Hostname
The first prerequisite to complete is to decide on the Gateway Hostname of the Smart Classifier ML APIs as other prerequisites as well as the Saga Installer depends on knowing it. The recommended Gateway Hostname is the FQDN of the Smart Classifier ML host. Setting it to anything else requires a DNS entry.
## Hardware Requirements
The more CPU cores, the faster ML model training.
|CPU Speed|CPU Cores |RAM | Drive Size|
|:-------:|:----------:|:------:|:---------:|
| ~2 GHz| 4| 8 GB| 50 GB|
## Operating System
Tested on Ubuntu 22.04.
## Docker
Install Docker
```
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
```
## PowerShell
The Smart Classifier ML installer requires PowerShell installed. Consult [Install PowerShell on Linux](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux?view=powershell-7.2) on how to install PowerShell on Linux.
## HTTPS
The Smart Classifier ML requires the HTTPS protocol. The steps to configure HTTPS are the same as in the Saga platform. Please refer to the [Saga Install Guide](https://ayfie-dev.atlassian.net/wiki/spaces/SAGA/pages/2400714758/Ayfie+Locator+Installation+Guide) for how to configure HTTPS.
## Gateway Basic Auth Password
The Smart Classifier APIs are secured with Basic Auth in the Gateway. The Basic Auth user is set to *smart-classifier-ml*. The Basic Auth password needs to be generated. The password must be hashed using MD5, SHA1, or BCrypt. When configuring the Smart Classifier feature in Saga platform, one needs to set the un-hashed version of this password. The hashed Basic Auth password is required by the installer.
One can use the *htpasswd* application on Ubuntu to generate the hashed password. Replace password with the password.
```
htpasswd -nb smart-classifier-ml password
```
This will output something like:
```
smart-classifier-ml:$apr1$fhrtmbJR$og2srnFdPPFpDiTaFUOxZ0
```
The encrypted password, *$apr1$fhrtmbJR$og2srnFdPPFpDiTaFUOxZ0*, will be input when running the install script later.
## User uid
Decide which user should run Smart Classifier ML and log in as this user.
* Get the *uid* of this user. The *uid* is required by the installer. The *uid* is used to set the file permission:
```
id
```
* This user needs to be member of the *docker* group to run the installer wihtout *sudo*:
```
sudo usermod -a -G docker username
```
* Log out and in if you are logged in with this user. Verify that the user is a member of the *docker* group with:
```
id | grep docker
```
## Docker group gid
* Get the gid of the Docker group. The *gid* is required by the installer. The *gid* is used to set the file permissions:
```
id | grep docker
```
# Installing
New versions of the Smart Classifier ML is released using the continuous delivery approach. The Smart Classifier ML is versioned using semantic versioning. When new versions within the same major version are released, *the smart-classifier-ml.ps1* script will discover that a new version is available and automatically upgrade to that new minor version.
## Running the Install Script
* Create the folder for Smart Classifier ML
```
sudo mkdir -p /var/ayfie/smart-classifier-ml
```
* Set permissions. Replace *username* with the name of the user:
```
sudo chown username:docker /var/ayfie/smart-classifier-ml
sudo chmod g+s /var/ayfie/smart-classifier-ml
```
* Download the Smart Classifier ML installer:
```
cd /var/ayfie/smart-classifier-ml
wget https://nexus.ayfie.dev/repository/Raw-Hosted/smart-classifier-ml-releases/5/smart-classifier-ml.ps1
```
* Run the installer:
```
pwsh smart-classifier-ml.ps1
```
|
...