Additional information#
This section provides the following additional information:
- Steps to perform descriptors matching
- Useful commands for working with Docker
- Description of the parameters for launching LIM services and creating databases
- Actions to enable saving LIM service logs to files
Steps to perform descriptors matching#
To start the descriptors matching procedure using LIM services, you should perform the following steps:
- select the preferred mode that will be used for the descriptors matching - one-time or automatic.
- one-time mode: specify the required "list_id" in the request body to the "create task" resource and perform the request;
- automatic mode for working with specific lists: specify the required "list_id" in the "indexing_list" setting of the "LIM_MANAGER_INDEXING" of the Configurator service;
- automatic mode for working with all existing lists:
- specify the "dynamic" value in the "indexing_list" setting of the "LIM_MANAGER_INDEXING" of the Configurator service;
- specify the minimum number of faces in the list in the "min_indexing_list_size" setting of the "LIM_MANAGER_INDEXING" of the Configurator service to index all existing descriptors in the lists.
- send a request for matching descriptors from the API service.
For details on LIM service interaction, see the "Service interaction" section of the LIM administrator manual.
Docker commands#
Show containers#
To show the list of launched Docker containers use the command:
docker ps
To show all the existing Docker containers use the command:
docker ps -a
Copy files to container#
You can transfer files into the container. Use the docker cp
command to copy a file into the container.
docker cp <file_location> <container_name>:<folder_inside_container>
Enter container#
You can enter individual containers using the following command:
docker exec -it <container_name> bash
To exit the container, use the command:
exit
Images names#
You can see all the names of the images using the command
docker images
Delete image#
If you need to delete an image:
- run the
docker images
command - find the required image, for example dockerhub.visionlabs.ru/luna/luna-image-store
- copy the corresponding image ID from the IMAGE ID, for example, "61860d036d8c"
- specify it in the deletion command:
docker rmi -f 61860d036d8c
Delete all the existing images:
docker rmi -f $(docker images -q)
Stop container#
You can stop the container using the command:
docker stop <container_name>
Stop all the containers:
docker stop $(docker ps -a -q)
Delete container#
If you need to delete a container:
- run the "docker ps" command
- stop the container (see Stop container)
- find the required image, for example dockerhub.visionlabs.ru/luna/luna-image-store
- copy the corresponding container ID from the CONTAINER ID column, for example, "23f555be8f3a"
- specify it in the deletion command:
docker container rm -f 23f555be8f3a
Delete all the containers:
docker container rm -f $(docker container ls -aq)
Check service logs#
You can use the following command to show logs for the service:
docker logs <container_name>
Launching parameters description#
When launching a Docker container for a LUNA Index Module service you should specify additional parameters required for the service launching.
The parameters specific for a particular container are described in the section about this container launching.
All the parameters given in the service launching example are required for proper service launching and utilization.
Launching services parameters#
Example command of launching LP services containers:
docker run \
--env=CONFIGURATOR_HOST=127.0.0.1 \
--env=CONFIGURATOR_PORT=5070 \
--env=PORT=<Port_of_the_launched_service> \
--env=WORKER_COUNT=1 \
--env=RELOAD_CONFIG=1 \
--env=RELOAD_CONFIG_INTERVAL=10 \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/logs/<service>:/srv/logs/ \
--name=<service_container_name> \
--restart=always \
--detach=true \
--network=host \
dockerhub.visionlabs.ru/luna/<service-name>:<version>
The following parameters are used when launching LP services containers:
docker run
- the command for running the selected image as a new container.
dockerhub.visionlabs.ru/luna/<service-name>:<version>
- the parameter specifies the image required for the container launching.
Links to download the container images you need are available in the description of the corresponding container launching.
--network=host
- the parameter specifies that a network is not simulated and the server network is used. If you need to change the port for third-party party containers, 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. The example is given for PostgreSQL.
--env=
- the parameter specifies the environment variables required to run a container. The following general values are specified:
-
CONFIGURATOR_HOST=127.0.0.1
- the host where the Configurator service is running. The localhost is set in the case when the container is launched on the same server with the Configurator service. -
CONFIGURATOR_PORT=5070
- the port where the Configurator service is listening. The 5070 port is used by default. -
PORT=<Port_of_the_service>
- the port where the service will listen. -
WORKER_COUNT
- specifies the number of worker processes for the service. -
RELOAD_CONFIG
enables auto-reload of configurations for the service when set to "1". See the "Automatic configurations reload" section in the LUNA PLATFORM 5 administrator manual. -
RELOAD_CONFIG_INTERVAL
specifies the configurations check period (10 seconds by default). See the "Automatic configurations reload" section in the LUNA PLATFORM 5 administrator manual.
--name=<service_container_name>
- the parameter specifies the name of the launched container. The name must be unique. If there is a container with the same name, an error will occur.
--restart=always
- the parameter specifies a restart policy. The daemon will always restart the container regardless of the exit status.
--detach=true
- run the container in the background mode.
-v
- the volume parameter enables you to mount the content of a server folder into a volume in the container. Thus their contents will synchronize. The following general data is mounted:
/etc/localtime:/etc/localtime:ro
- sets the current time zone used by the system in the container.-
/tmp/logs/<service>:/srv/logs/
- enables copying of the folder with service logs to your server/tmp/logs/<service>
directory. You can change the directory where the logs will be saved according to your needs. -
/var/lib/luna/lim_storage:/srv/local_storage
- enables you to mount a directory for storing indexes in local storage. The location and name of the directory for storing indexes inside LIM containers is set in the "INDEX_STORAGE_LOCAL" settings of the LIM services. Note that the directory must be the same for all three services. The local directory can be changed according to your needs.
Creating DB parameters#
Example command of launching containers for database migration or database creation:
docker run \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/logs/<service>:/srv/logs/ \
--rm \
--network=host \
dockerhub.visionlabs.ru/luna/<service-name>:<version> \
python3 ./base_scripts/db_create.py --luna-config http://localhost:5070/1
The following parameters are used when launching containers for database migration or database creation:
--rm
- the parameter specifies if the container is deleted after all the specified scripts finish processing
python3 ./base_scripts/db_create.py
- the parameter specifies Python version and a script db_create.py
launched in the container. The script is used for the database structure creation.
--luna-config http://localhost:5070/1
- the parameter specifies where the launched script should receive configurations. By default, the service requests configurations from the Configurator service.
Logging to server#
To enable saving logs to the server, you should:
- create directories for logs on the server;
- activate log recording and set the location of log storage inside LP service containers;
- configure synchronization of log directories in the container with logs on the server using the
volume
argument at the start of each container.
Create logs directory#
Below are examples of commands for creating directories for saving logs and assigning rights to them for all LUNA PLATFORM services.
mkdir -p /tmp/logs/lim-manager /tmp/logs/lim-indexer /tmp/logs/lim-matcher /tmp/logs/python-matcher-proxy
chown -R 1001:0 /tmp/logs/lim-manager /tmp/logs/lim-indexer /tmp/logs/lim-matcher /tmp/logs/python-matcher-proxy
Logging activation#
To enable logging to file, you need to set the log_to_file
and folder_with_logs
settings in the <SERVICE_NAME>_LOGGER
section of the settings for each service.
Automatic method
To update logging settings, you can use the logging.json
settings file provided with the distribution package.
Run the following command:
docker cp /var/lib/luna/lim-current/example-docker/configs/logging.json luna-configurator:/srv/luna_configurator/used_dumps/logging.json
Update your logging settings with the copied file.
docker exec -it luna-configurator python3 ./base_scripts/db_create.py --dump-file /srv/luna_configurator/used_dumps/logging.json
Manual method
Go to the Configurator service interface (127.0.0.1:5070
) and set the logs path in the container in the folder_with_logs
parameter for all services whose logs need to be saved. For example, you can use the path /srv/logs
.
Set the log_to_file
option to true
to enable logging to a file.
Mounting directories with logs when starting services#
The log directory is mounted with the following argument when starting the container:
-v <server_logs_folder>:<container_logs_folder> \
where <server_logs_folder>
is the directory created in the create logs directory step, and <container_logs_folder>
is the directory created in the activate logging step.
Example of command to launch the Index Manager service with mounting a directory with logs:
docker run \
--env=CONFIGURATOR_HOST=127.0.0.1 \
--env=CONFIGURATOR_PORT=5070 \
--env=PORT=5190 \
--env=WORKER_COUNT=1 \
--env=RELOAD_CONFIG=1 \
--env=RELOAD_CONFIG_INTERVAL=10 \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/logs/lim-manager:/srv/logs \
-v /var/lib/luna/lim_storage:/srv/local_storage \
--name=lim-manager \
--restart=always \
--detach=true \
--network=host \
dockerhub.visionlabs.ru/luna/lim-manager:v.0.3.0
The example container launch commands in this documentation contain these arguments.