> For the complete documentation index, see [llms.txt](https://docs.dbrain.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dbrain.io/lokalnaya-ustanovka/lokalnyi-servis-licenzii.md).

# Локальный сервис лицензий

### Установка локального сервиса лицензий

{% hint style="danger" %}
Если вы используете Windows, обязательно [установите Powershell](https://github.com/PowerShell/PowerShell#get-powershell) и выполняйте процесс через него. В противном случае ничего не получится
{% endhint %}

1\. Запустите локальный сервис лицензий:

```bash
docker run --rm -d --name local-license-server -p 8081:8080 registry.dbrain.io/public/license-local:challenge-v2
```

2\. Убедитесь, что сервис запущен:

```bash
curl http://localhost:8081/info
{"limit": 0, "used": 0, "left": 0, "activatedAt": null}
```

Если увидели такой ответ, значит сервис ещё не активирован.

3\. Начните процесс активации, сгенерировав `challenge` строку. Это можно сделать через `curl` или любым иным `http` клиентом.

```bash
curl http://localhost:8081/activation/challenge
<challenge_string>
```

4\. Получите `challenge-answer` — ответ на свою `challenge` строку одним из двух способов:

* С помощью сотрудника `Dbrain` — <https://t.me/dbrain_help>
* Или написать запрос в общем чате с командой `Dbrain`&#x20;

5\. Завершите активацию сервиса лицензий, введя `challenge-answer` строку:

```bash
curl http://localhost:8081/activation/activate --data 'ответ_на_challenge-строку'
```

**Обратите внимание: одинарные кавычки в параметре `--data 'string'` важны при использовании в командной строке, иначе некоторые символы `challenge-answer` строки будут неверно интерпретированы в `bash` и активация не удастся.**

6\. Проверьте успешность активации:

```bash
curl http://localhost:8081/info
{"limit": 1000, "used": 0, "left": 1000, "activatedAt": 1651771605}
```

`activatedAt` указывает на `unix`время активации.

7\. Всё, можно пользоваться. Сервис лицензий доступен для сервисов Dbrain по адресу `http://localhost:8081/check/v2`. Не забудьте прописать этот адрес в переменной окружения сервисов Dbrain `LICENSE_URL=<адрес-сервера-лицензий>/check/v2`.

8\. Лимиты и использованные квоты можно проверить в любой момент в эндпоинте `/info`.

9\. Для повторной активации перезапускать сервис не нужно — достаточно снова перейти к пункту (3) и запросить новую `challenge` строку.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.dbrain.io/lokalnaya-ustanovka/lokalnyi-servis-licenzii.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
