Руководство по установке

Руководство по установке СинГраф 24.05

ООО «ПРЕГЕЛЬ» 2025

Введение

В данной инструкции описан процесс развертывания универсальной модульной интеграционной платформы СинГраф (далее Платформа).

Развертывание Платформы СинГрафРазвертывание платформы состоит из выполнения следующих шагов:

1. Подготовка операционной системы

2. Установка и настройка Docker Engine

3. Установка Платформы СинГраф

4.Проверка успешности установки Платформы СинГраф


Подготовка операционной системы

В качестве операционной системы на сервере управления рекомендуется использовать OS Ubuntu 22.04.4 LTS x86_64/amd64.

Установка ОС производится с помощью штатного инсталлятора.

При настройке инсталлятора выбирается режим установки minimal.

Разметка системного диска производится автоматически инсталлятором системы.


Установка и развертывание Docker

Установка производится на следующую систему:

операционная система: Ubuntu 22.04.4 LTS

архитектура: x86_64/amd64


Для установки должно быть настроено стабильное подключение к интернету.

Все команды выполняются через команду sudo то есть от имени суперпользователя системы Linux.

Ваш текущий пользователь должен иметь соответствующие права для выполнения команды sudo.

Обновляем список доступных пакетов и их версий.

sudo apt update

Пример вывода в терминале:

~$ sudo apt update
Hit:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:2 http://ru.archive.ubuntu.com/ubuntu jammy InRelease
Hit:3 http://ru.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:4 http://ru.archive.ubuntu.com/ubuntu jammy-backports InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
18 packages can be upgraded. Run 'apt list --upgradable' to see them.

Устанавливаем обновления пакетов


Без выполнения sudo apt update, команда sudo apt upgrade не будет знать о новых версиях пакетов.

sudo apt update

Ниже пример вывода sudo apt upgrade в сокращенном виде, так как пакеты постоянно обновляются, и могут быть установлены другие пакеты на конкретном сервере.


Пример вывода в терминале:

~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
 ubuntu-pro-client
The following packages have been kept back:
 python3-update-manager update-manager-core
The following packages will be upgraded:
 apt apt-utils cloud-init coreutils dpkg ethtool landscape-common libapt-pkg6.0 libgpgme11 libldap-2.5-0 libldap-common snapd tcpdump ubuntu-advantage-tools
 ubuntu-pro-client-l10n update-notifier-common
16 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 33.0 MB of archives.
After this operation, 1,383 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 coreutils amd64 8.32-4.1ubuntu1.2 [1,437 kB]
Get:2 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libapt-pkg6.0 amd64 2.4.12 [912 kB]
Get:3 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 dpkg amd64 1.21.1ubuntu2.3 [1,239 kB]
Get:4 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 apt amd64 2.4.12 [1,363 kB]
Get:5 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 apt-utils amd64 2.4.12 [211 kB]
Get:6 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 update-notifier-common all 3.192.54.8 [185 kB]
Get:7 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 ubuntu-advantage-tools all 31.2.3~22.04 [10.8 kB]
Get:8 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 ubuntu-pro-client amd64 31.2.3~22.04 [197 kB]
Get:9 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 ubuntu-pro-client-l10n amd64 31.2.3~22.04 [20.3 kB]
Get:10 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 tcpdump amd64 4.99.1-3ubuntu0.2 [501 kB]
Get:11 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 ethtool amd64 1:5.16-1ubuntu0.1 [207 kB]
Get:12 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 landscape-common amd64 23.02-0ubuntu1~22.04.2 [88.7 kB]
Get:13 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libgpgme11 amd64 1.16.0-1.2ubuntu4.2 [136 kB]
Get:14 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libldap-2.5-0 amd64 2.5.17+dfsg-0ubuntu0.22.04.1 [183 kB]
Get:15 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libldap-common all 2.5.17+dfsg-0ubuntu0.22.04.1 [15.8 kB]
Get:16 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 snapd amd64 2.62+22.04 [25.8 MB]
Get:17 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 cloud-init all 24.1.3-0ubuntu1~22.04.1 [560 kB]
Fetched 33.0 MB in 10s (3,177 kB/s)
Preconfiguring packages ...
(Reading database ... 74556 files and directories currently installed.)
Preparing to unpack .../coreutils_8.32-4.1ubuntu1.2_amd64.deb ...

Предварительная установка необходимых пакетов для Docker Engine

sudo apt-get install curl apt-transport-https ca-certificates software-properties-common

Пример вывода в терминале:

~$ sudo apt-get install curl apt-transport-https ca-certificates software-properties-common
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ca-certificates is already the newest version (20230311ubuntu0.22.04.1).
ca-certificates set to manually installed.
curl is already the newest version (7.81.0-1ubuntu1.16).
curl set to manually installed.
software-properties-common is already the newest version (0.99.22.9).
software-properties-common set to manually installed.
The following NEW packages will be installed:
 apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 1,510 B of archives.
After this operation, 170 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ru.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 apt-transport-https all 2.4.12 [1,510 B]
Fetched 1,510 B in 1s (1,891 B/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 74568 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_2.4.12_all.deb ...
Unpacking apt-transport-https (2.4.12) ...
Setting up apt-transport-https (2.4.12) ...
Scanning processes...
Scanning candidates...
Scanning linux images...
Running kernel seems to be up-to-date.
Restarting services...
Service restarts being deferred:
 systemctl restart unattended-upgrades.service

No containers need to be restarted.

No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.

Добавление Docker-репозитория


Последовательное выполнение команд:

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

(это всё одна команда, скопируйте и вставьте в терминал)

echo \
 "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
 $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
 sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Пример вывода в терминале:

~$ sudo apt-get install ca-certificates curl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ca-certificates is already the newest version (20230311ubuntu0.22.04.1).
curl is already the newest version (7.81.0-1ubuntu1.16).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

~$ 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

~$ echo \
 "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
 $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
 sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
Hit:1 http://ru.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://ru.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:4 http://ru.archive.ubuntu.com/ubuntu jammy-backports InRelease
Get:5 https://download.docker.com/linux/ubuntu jammy InRelease [48.8 kB]
Get:6 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages [32.0 kB]
Fetched 80.9 kB in 6s (13.2 kB/s)
Reading package lists... Done

Установка свежей версии Docker Engine пакетов

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Пример вывода в терминале:

~$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
 docker-ce-rootless-extras libltdl7 libslirp0 pigz slirp4netns
Suggested packages:
 aufs-tools cgroupfs-mount | cgroup-lite
The following NEW packages will be installed:
 containerd.io docker-buildx-plugin docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin libltdl7 libslirp0 pigz slirp4netns
0 upgraded, 10 newly installed, 0 to remove and 2 not upgraded.
Need to get 121 MB of archives.
After this operation, 434 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ru.archive.ubuntu.com/ubuntu jammy/universe amd64 pigz amd64 2.6-1 [63.6 kB]
Get:2 http://ru.archive.ubuntu.com/ubuntu jammy/main amd64 libltdl7 amd64 2.4.6-15build2 [39.6 kB]
Get:3 https://download.docker.com/linux/ubuntu jammy/stable amd64 containerd.io amd64 1.6.31-1 [29.8 MB]
Get:4 http://ru.archive.ubuntu.com/ubuntu jammy/main amd64 libslirp0 amd64 4.6.1-1build1 [61.5 kB]
Scanning processes...
Scanning candidates...
Scanning linux images...

Running kernel seems to be up-to-date.

Restarting services...
Service restarts being deferred:
 systemctl restart unattended-upgrades.service

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

Проверка установки Docker Engine

sudo docker run hello-world

Пример вывода в терминале:

~$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete
Digest: sha256:a26bff933ddc26d5cdf7faa98b4ae1e3ec20c4985e6f87ac0973052224d24302
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
   (amd64)
 3. The Docker daemon created a new container from that image which runs the
   executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
   to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

Добавляем текущего пользователя системы


Добавляем текущего пользователя системы $username в группу docker вашей системы.

$username - нужно заменить на имя вашего пользователя.

sudo usermod -aG docker $username

Пример вывода в терминале (при успешном выполнении, вывод информации будет отсутствовать):

~/syngraph$ sudo usermod -aG docker $username

Работа Docker без прав root


Для того, чтобы Docker работал без root прав, нужно после добавления вашего пользователя в группу docker, сделать либо Logout/Login, либо перезагрузить операционную систему.


Установка и первоначальная настройка ПО «Синграф»

  1. Загрузка и запуска Docker контейнеров
./start.sh
Пример вывода в терминале:
~/syngraph$ ./start.sh
-------------------------------------------

Startup Syngraph application
Loading Docker images..

Loaded image: syngraph/basic:latest
Loaded image: nats:latest
Loaded image: natsio/nats-box:latest
Loaded image: natsio/prometheus-nats-exporter:latest
Loaded image: grafana/grafana-enterprise:latest
Loaded image: prom/prometheus:latest
-------------------------------------------

Startup Docker builds..

[+] Running 7/7
 ✔ Network syngraph-net             Created        0.4s
 ✔ Container syngraph-prometheus    Started2.5s
 ✔ Container syngraph-grafana       Started    2.4s
 ✔ Container syngraph-nats          Started    2.7s
 ✔ Container syngraph-io            Started    4.4s
 ✔ Container syngraph-runtime       Started    4.8s
 ✔ Container syngraph-nats-exporter Started    4.7s
-------------------------------------------

Run tests..
Sleep 25 second. Please waite..

rt
└── [depth=2] OUT
├── [2a] hub/a
│  ├── [hub/typea] hub/typea
│  └── [2e] hub/e
├── [name0] hub/a
│  ├── [hub/typea] hub/typea
│  └── [2e] hub/e
├── [2b] hub/b
│  └── [2e] hub/e
└── [2c] hub/c
└── [2d] hub/d

Success!
Usage example:
NATS_URL=nats://nats:foliage@127.0.0.1:4222 ./syngraph-cli gwalk to rt
NATS_URL=nats://nats:foliage@127.0.0.1:4222 ./syngraph-cli gwalk inspect
NATS_URL=nats://nats:foliage@127.0.0.1:4222 ./syngraph-cli gwalk routes --fd 2 -v 0
NOTE!
The environment variable needs to be exported so that you don't have to specify it each time before ./syngraph-cli
1. export NATS_URL=nats://nats:foliage@127.0.0.1:4222
2. source ~/.bashrc

2. Проверка состояния контейнеров

docker stats

Выполните команду: CTRL+C (выход)


Пример вывода в терминале:

CONTAINER ID  NAME                    CPU %    MEM USAGE / LIMIT    MEM %NET I/O          BLOCK I/O     PIDS
9b5b98375b8f  syngraph-nats-exporter  12.52%8.266MiB / 7.748GiB  0.10%    3.48MB / 304kB   0B / 0B         10
987bf7a34bee  syngraph-io             0.00%    440KiB / 7.748GiB    0.01%1.12kB / 0B      0B / 0B         1
43190a85c5c8  syngraph-runtime        17.09%   9.391MiB / 7.748GiB  0.12%2.48MB / 1.78MB  0B / 0B         11
0fad1b8659c4  syngraph-prometheus     4.16%21.71MiB / 7.748GiB  0.27%    384kB / 33.1kB   164kB / 524kB   10
abd3adddb03e  syngraph-grafana        0.49%    65.77MiB / 7.748GiB  0.83%20.1kB / 4.92kB  664kB / 54.8MB  20
c8f14e16387e  syngraph-nats           4.91%    14.99MiB / 7.748GiB  0.19%1.71MB / 5.94MB  0B / 3.47MB     10

3. Экспорт переменной окружения для NATS приложения СинГраф

export NATS_URL=nats://nats:foliage@127.0.0.1:4222
        Пример вывода в терминале:
~/syngraph$ export NATS_URL=nats://nats:foliage@127.0.0.1:4222

4.Активация окружения с новой экспортированной переменной

source ~/.bashrc

Пример вывода в терминале:

~/syngraph$ source ~/.bashrc

Общая проверка работоспособности ПО СинГраф


Использование syngraph-cli:

//переход в вершину rt
./syngraph-cli gwalk to rt

//инспектирование текущей вершины
./syngraph-cli gwalk inspect

//найти и показать все маршруты текущей вершины с глубиной 2
./syngraph-cli gwalk routes --fd 2 -v 0

Пример вывода в терминале:

~/syngraph$ ./syngraph-cli gwalk to rt
~/syngraph$ ./syngraph-cli gwalk inspect
Vertex
rt

Body
-

~/syngraph$ ./syngraph-cli gwalk routes --fd 2 -v 0
rt
└── [depth=2] OUT
├── [2b] hub/b
│  └── [2e] hub/e
├── [2c] hub/c
│  └── [2d] hub/d
├── [2a] hub/a
│  ├── [2e] hub/e
│  └── [hub/typea] hub/typea
└── [name0] hub/a
├── [2e] hub/e
└── [hub/typea] hub/typea

Остановка Docker контейнеров

./stop.sh

Пример вывода в терминале:

~/syngraph$ ./stop.sh
 Stopping Syngraph application
Stopping and remove Docker containers..

[+] Running 7/7
 ✔ Container syngraph-runtime       Removed  1.3s
 ✔ Container syngraph-io            Removed    10.6s
 ✔ Container syngraph-prometheus    Removed    1.5s
 ✔ Container syngraph-grafana       Removed    1.1s
 ✔ Container syngraph-nats-exporter Removed    1.0s
 ✔ Container syngraph-nats          Removed    0.8s
 ✔ Network syngraph-net             Removed    0.3s
-------------------------------------------

Success!
Check running containers: docker stats
Exit from docker stats: ctrl+c

2. Проверка состояния контейнеров

docker stats
//выход ctrl+c

Пример вывода в терминале:


        CONTAINER ID NAMECPU % MEM USAGE / LIMIT MEM %NET I/O BLOCK I/O PIDS