# Развертывание OCR-модуля

### 1. Установка Docker

1. Set up Docker's apt repository

   ```bash
   # Add Docker's official GPG key:
   sudo apt-get update
   sudo apt-get install ca-certificates curl
   sudo install -m 0755 -d /etc/apt/keyrings
   sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
   sudo chmod a+r /etc/apt/keyrings/docker.asc

   # Add the repository to Apt sources:
   echo \
       "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
       $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
       sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
   sudo apt-get update
   ```
2. Install the Docker packages

   ```bash
   sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
   ```
3. Verify that the installation is successful

   ```bash
   docker -v
   ```

#### Linux post-installation steps for Docker Engine

1. Create the docker group

   ```bash
   sudo groupadd docker
   ```
2. Add your user to the docker group

   ```bash
   sudo usermod -aG docker $USER
   ```
3. You can also run the following command to activate the changes to groups:

   ```bash
   newgrp docker
   ```

#### Configure Docker to start on boot

```bash
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
```

### 2. Развертывание OCR

1. Clone the OCR repository

   ```bash
   git clone --depth=1 --filter=tree:0 https://oauth2:glpat-kBQgzxGLZbNyyphyNjur@git.datagaze-lab.uz/datagaze-dlp/server/ocr-api.git
   ```
2. Build and run

   ```bash
   docker compose up -d --build
   ```

***

\* В случае, если вы разворачиваете сервис OCR на другой машине, вам следует открыть общий доступ к папке /var/lib/datagaze/.data/data, а затем смонтировать её на машине, хостящей сервис OCR.

1. Edit /etc/samba/smb.conf and add the following:

   ```
   [dlp_share]
   comment = Ubuntu File Server Share
   path = /var/lib/datagaze/.data/data
   browsable = yes
   read only = yes
   create mask = 0755
   ```
2. Set up a Samba password for your user:

   ```bash
   sudo smbpasswd -a username
   ```

> In case your user is `dlp_admin` then you should run `sudo smbpasswd -a dlp_admin`&#x20;

3. Mount the share from the machine hosting your OCR service:

<pre class="language-bash"><code class="lang-bash"><strong>sudo mkdir -p /var/lib/datagaze/.data/data
</strong>sudo mount -t cifs -o username=serverUserName //serverIpAdress/dlp_share /var/lib/datagaze/.data/data
</code></pre>


---

# 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://docs.datagaze.uz/ustanovka-servera-datagaze-dlp/razvertyvanie-ocr-modulya.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.
