Skip to content

Run third-party services#

This section describes the launching of databases in docker containers. They must be launched before environment preparation and LP services.

Monitoring services#

LUNA PLATFORM's monitoring services include InfluxDB (used by default), ClickHouse, and Prometheus. Instructions for starting InfluxDB and ClickHouse databases are provided below.

For information on selecting a database for monitoring and working with Prometheus, see the "Monitoring" section of the Administrator's Guide.

If necessary, you can configure the visualization of monitoring data using the LUNA Dashboards service, which includes a configured Grafana data visualization system. In addition, you can launch the Grafana Loki tool for advanced work with logs. See the instructions for launching LUNA Dashboards and Grafana Loki in the "Monitoring and logs visualization using Grafana" section.

Select your preferred database and start it using the appropriate command:

InfluxDB#

Note: If you haven't deleted the old container, skip this step.

Monitoring LUNA PLATFORM services requires running the Influx 2.0.8-alpine database. Below are the commands to launch the InfluxDB container.

For more information, see the "Monitoring" section in the administrator manual.

Note: If necessary, you can use an external InfluxDB 2.0.8-alpine. In this case, you can skip the command below, but you will have to set custom settings for each LUNA PLATFORM service.

Use the docker run command with these parameters:

docker run \
-e DOCKER_INFLUXDB_INIT_MODE=setup \
-e DOCKER_INFLUXDB_INIT_BUCKET=default \
-e DOCKER_INFLUXDB_INIT_USERNAME=luna \
-e DOCKER_INFLUXDB_INIT_PASSWORD=password \
-e DOCKER_INFLUXDB_INIT_ORG=luna \
-e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=kofqt4Pfqjn6o0RBtMDQqVoJLgHoxxDUmmhiAZ7JS6VmEnrqZXQhxDhad8AX9tmiJH6CjM7Y1U8p5eSEocGzIA== \
-v /etc/localtime:/etc/localtime:ro \
-v /var/lib/luna/influx:/var/lib/influxdb2 \
--restart=always \
--detach=true \
--network=host \
--name influxdb \
dockerhub.visionlabs.ru/luna/influxdb:2.0.8-alpine

The command above creates a default bucket. The bucket for storing monitoring data LUNA PLATFORM will be created during the environment preparation step using the Storages utility. Note that attempting to prepare an environment (create a bucket) for InfluxDB via the Storages utility will fail if the bucket already exists and the -ii flag (ignore the entity if it already exists) is not specified in the environment preparation command.

ClickHouse#

For more information, see the "Monitoring" section of the administrator manual.

Note: You can use an external ClickHouse database if needed. In this case, you can skip the command below, but you will need to configure custom settings for each LUNA PLATFORM service.

Use the docker run command with the following parameters:

docker run \
-e CLICKHOUSE_USER=luna \
-e CLICKHOUSE_PASSWORD=password \
-v /var/lib/luna/clickhouse/data:/var/lib/clickhouse \
-v /var/lib/luna/clickhouse/logs:/var/log/clickhouse-server \
-v /var/lib/luna/current/extras/conf/clickhouse_config.xml:/etc/clickhouse-server/config.xml \
--name=clickhouse \
--network=host \
--restart=always \
--detach=true \
--health-cmd="wget --no-verbose --tries=1 --spider http://localhost:8123/ping || exit 1" \
dockerhub.visionlabs.ru/luna/clickhouse-server:v.25.4.0 

Note that ClickHouse logs are saved to files by default. The directory /var/lib/luna/clickhouse/logs is mounted for this purpose.

Migrating InfluxDB to ClickHouse#

To migrate from InfluxDB to ClickHouse on an already deployed LUNA PLATFORM and properly prepare the environment, follow the steps below.

Important: The migration does not include transferring accumulated data from InfluxDB to ClickHouse.

1․ Start the ClickHouse container using the command above. 2․ Open the Storages configuration file:

vi /var/lib/luna/current/extras/conf/storages_config.conf

and set the necessary settings for ClickHouse in the LUNA_MONITORING section. Example:

STORAGE_TYPE = clickhouse
SEND_DATA_FOR_MONITORING = 1
HOST = 127.0.0.1
PORT = 9000
HTTP_PORT = 8123
DB_USER = luna
DB_PASSWORD = password
DB_NAME = luna_monitoring
USE_SSL = 0
FLUSHING_PERIOD = 1 

3․ Edit the "LUNA_MONITORING" section in the LUNA PLATFORM settings to tell the system which monitoring database to use for all services (except the Configurator service - see step 4).

You can load the configuration in one of the following ways:

  • using a dump file before starting LUNA PLATFORM:
vi /var/lib/luna/current/extras/conf/platform_settings.json
  • Using the Configurator service interface after launching it. To do this, go to http://<your_server_ip_adress>:5070/, enter "LUNA_MONITORING" in the "Setting name" field, apply filters, and enter values ​​in the Value field:
{
    "storage_type": "clickhouse",
    "send_data_for_monitoring": 1,
    "use_ssl": 0,
    "flushing_period": 1,
    "host": "127.0.0.1",
    "port": 9000,
    "http_port": 8123,
    "db_user": "luna",
    "db_password": "password",
    "db_name": "luna_monitoring"
}

4․ Since the Configurator service settings are stored in its configuration file, to configure monitoring of this service, you need to edit the monitored file before starting the container:

/var/lib/luna/current/example-docker/luna_configurator/configs/luna_configurator_postgres.conf

In the file, find the "LUNA_MONITORING" section and set the necessary connection parameters to ClickHouse.

5․ Run the command to prepare the entire environment (including monitoring) in the "Update environment command" section.

PostgreSQL#

Migrate PostgreSQL 12 to PostgreSQL 16#

In LUNA PLATFORM v.5.53.0, the VisionLabs image for PostgreSQL has been updated from version 12 to version 16.

If this image was previously used, then you need to perform the migration yourself according to official documentation. If necessary, you can continue using PostgreSQL 12 by specifying the image "postgis-vlmatch:12" in the container launch command.

Mounting PostgreSQL 12 data from the directory "/var/lib/luna/postgres" into a container for PostgreSQL 16 will result in an error.

Launch PostgreSQL#

Note: If you haven't deleted the old container, skip this step.

Use the following command to launch PostgreSQL.

Use the following command to launch PostgreSQL.

docker run \
--env=POSTGRES_USER=luna \
--env=POSTGRES_PASSWORD=luna \
--shm-size=1g \
-v /var/lib/luna/postgresql/data/:/var/lib/postgresql/data/ \
-v /etc/localtime:/etc/localtime:ro \
--name=postgres \
--restart=always \
--detach=true \
--network=host \
--health-cmd="pg_isready -U luna -d postgres" \
dockerhub.visionlabs.ru/luna/postgis-vlmatch:16.1

-v /var/lib/luna/current/example-docker/postgresql/data/:/var/lib/postgresql/data/ — The volume command enables you to mount the "data" folder to the PostgreSQL container. The folder on the server and the folder in the container will be synchronized. The PostgreSQL data from the container will be saved to this directory.

--network=host — If you need to change the port for PotgreSQL, you should change this string to -p 5440:5432. Where the first port 5440 is the local port and 5432 is the port used inside the container.

You should create all the databases for LP services manually if you are going to use an already installed PostgreSQL.

Redis#

Note: If you haven't deleted the old container, skip this step.

Note: Redis is set to lunapass by default when starting. It is highly recommended to change the password for increased security. Note that the password must be specified in the corresponding service setting, for example, in the "password" parameter of the "LUNA_ATTRIBUTES_DB" group of the Events service. By default, the dump file already contains the password lunapass.

Use the following command to launch Redis.

docker run \
-v /etc/localtime:/etc/localtime:ro \
--name=redis \
--restart=always \
--detach=true \
--network=host \
dockerhub.visionlabs.ru/luna/redis:7.2 \
redis-server --requirepass lunapass