# Backup of Installation in Docker

## Hardware and Software Requirements

To launch the services, you'll require:

* CPU: 16 cores,
* RAM: 32 GB,
* Disk: 100 GB, SSD,
* Linux-compatible OS,
* Docker 19.03+ (for API 5, you can also use Podman 4.4+ ),
* Docker Compose 1.27+ (or podman-compose 1.2.0+, if you use Podman).

For Docker installations with multiple API servers, you'll also require shared volume or NFS.

## Distribution Package Contents

The package you get consists of the following directories and files:

```bash
// scripts for preliminary checks of hosts to ensure compliance 
// with software and hardware requirements
|-[checkers]
|   |--pre-checker-all.sh
|   |--pre-checker-api.sh
|   |--pre-checker-bio.sh
// subdirectories with configuration files for the services in use
|-[configs]
|   |--[api]
|   |--[init]
|   |--[nginx]
|   |--[o2n]
|   |--[pg-o2n]
|   |--[postgres]
|   |--[redis]
|   |--[statistic]
|   |--[tfss]
|   |--[webui]
|   |--config.env
// service data and the TFSS models
|-[data]
|   |--api
|   |--pg-o2n
|   |--postgres
|   |--redis
|   |--tfss
// manifest for running all services on a single host
|-docker-compose-all.yml
// manifest for services related only to the API
|-docker-compose-api.yml
// manifest for the TFSS service
|-docker-compose-bio.yml
```

## Installation

### Installing TFSS and the API on the Same Host

1. Put the license file in `./configs/tfss/license.key`.
2. Unzip the file that contains models into the `./data/tfss/models` directory.
3. Before starting system configuration, we recommend running the host readiness check scripts. Navigate to the checkers directory and run the `pre-checker-all.sh` script.&#x20;

```bash
docker compose --env-file configs/config.env -f docker-compose-all.yml 
```

4. Set the initial passwords and values:

<details>

<summary>Configuration</summary>

* `configs\api\config.py`
  * **Line 15**: `'PORT'` is the same port as set in line 2 of `configs\nginx\default.conf`. Needed to set URLs to serve static via nginx.
  * **Line 21**: `'HOST'` is the same name as set in docker-compose for `oz-api-nginx` container. Needed to set URLs to serve static via nginx.
  * **Line 24-28**: `'DB_*'` are parameters for connecting to PostgreSQL database. Must refer to `oz-api-pg` name and parameters, that are set in `configs\init\init-db.sh`, `configs\postgres\init.sql`
  * **Line 33-34**: `'TFSS'` must refer to `oz-tfss` container name and port, that are set in the `docker-compose.yaml` `oz-tfss` start command.
  * **Line 36**: Regula. Currently, we support only external Regula.
  * **Line 54-57**: Redis connection. Change password or Redis container name and port, corresponding to lines 2 and 4 of `configs\redis\redis.conf`.
  * **Line 69**: Celery workers' healthcheck list. Remove Celery workers from list, if you have disabled them in `docker-compose.yaml`.
  * **Line 141**: O2N. Change o2n name and port, corresponding to `docker-compose.yaml`.
* `configs\init\init-*.sh`
  * VARS section of each file (**Lines 4-9**) must refer to PostgreSQL names, ports in docker-compose, parameters in `config.py` and sets up user and database that are created during startup.
* `nginx\default.conf`
  * **Line** 2: Listen port. Must be set corresponding to the `docker-compose` `oz-api-nginx` port parameter and `config.py`
  * **Lines 27, 43, 48**: Service names in redirect. `oz-api`, `oz-statistic`. Change if container names are changed in `docker-compose.yaml`
* `configs\pg-o2n\init.sql`
  * Username, database name, password that are pre-created in database.
  * Username in lines 1, 9.
  * Password in line 1.
  * DB name in lines 8, 16.
* `configs\postgres\init.sql`
  * Username, database name, password that are pre-created in database.
  * Username in lines 1, 9.
  * Password in line 1.
  * DB name in lines 8, 16.
* `configs\redis\redis.conf`
  * **Line 2**: password for security. Refers to `config.py`.
  * **Line 4**: port. Refers to `config.py`.
* `data\tfss`
  * Must have `'models'` folder with models.
* `configs\webui\aquireToken.sh`
  * **Line 3-6**: API parameters. Web UI should point to the `oz-api-nginx` container. Set name and port same as in `oz-api-nginx`.
  * **Line 5-6**: login and password must be the same as in `configs\init\init-user.sh` (if you have created another user manually, you can also use other credentials)
* `configs\o2n\config.env`
  * **Lines 6-10**: pg-o2n parameters. Must be the same as listed in `init-o2n.sh` and `pg-o2n\init.sql`.
  * **Line 12**: password for superuser in PostgreSQL for O2N.
  * **Lines 14-16**: service parameters for superuser in PostgreSQL.
  * **Lines 24-29**: database parameters. Must be the same as listed in `configs\postgres\init.sql`.
  * **Line 38**: `'APP_ENV'` User `'local'` for `http`, `'https'` for `https`.
  * **Line 51-57**: mail parameters. Set up for `'send password to email'` option.

</details>

5. For this configuration, run all services on a single host:

```bash
docker compose --env-file configs/config.env -f docker-compose-all.yml up -d
```

{% hint style="info" %}
We recommend using PostgreSQL as a container only for testing purposes. For the production deployment, it is recommended to use a standalone database.
{% endhint %}

### Installing TFSS and the API on Separate Hosts

#### TFSS Host

1. Create a directory and unzip the distribution package into it. The package contains Docker Compose manifests and directories with the configuration files required for operation.
2. Put the license file in `./configs/tfss/license.key`.
3. Unzip the file that contains models into the `./data/tfss/models` directory.
4. Before starting system configuration, we recommend running the host readiness check scripts. Navigate to the checkers directory and run the `pre-checker-all.sh` script.

   ```bash
   ./pre-checker-bio.sh
   ```
5. For this configuration, run TFSS service on a separate host:

```bash
docker compose --env-file configs/config.env -f docker-compose-bio.yml up -d
```

#### API Host

1. Create a directory and unzip the distribution package into it. The package contains Docker Compose manifests and directories with the configuration files required for operation.
2. Before starting system configuration, we recommend running the host readiness check scripts. Navigate to the checkers directory and run the `pre-checker-all.sh` script.

```bash
./pre-checker-bio.sh
```

3. Set the initial passwords and values as described in [step 4 of the same host installation](#configuration).
4. For this configuration, run all services on a single host:

```bash
docker compose --env-file configs/config.env -f docker-compose-api.yml up -d
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.ozforensics.com/oz-knowledge/guides/administrator-guide/installation-in-docker-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
