FaceStream manual launching#
Before manual launching FaceStream, the following actions should be performed:
-
The license key is activated.
If the LP services are not launched and the LP license was not activated at the start of the FaceStream launch, see the "License key activation when LP is not launched" section.
If LP services are launched and the LP license was activated at the start of the FaceStream launch, see the "License key activation when LP is launched" section.
-
The required components are launched (see the "Launching LP services" section):
- Influx OSS 2 container
- PostgreSQL container
- LUNA Configurator container
- LUNA Licenses container
Upload settings to LUNA Configurator#
The main settings of LUNA Streams and FaceStream should be set in the Configurator service after its launch. The exception is the FaceEngine settings, which are set in the configuration file "faceengine.conf" and transferred during the launch of the FaceStream container.
If necessary, you can use configuration files instead of the Configurator service settings and transfer them during container launching (for more information, see the "Use FaceStream with configuration files" section of the administrator manual).
FaceStream and LUNA Streams settings are uploaded into the Configurator in different ways.
Upload LUNA Streams settings#
To upload LUNA Streams settings into the Configurator service, you should use the configuration migration mechanism.
docker run \
-v /etc/localtime:/etc/localtime:ro \
--rm \
--entrypoint='' \
--network=host \
dockerhub.visionlabs.ru/luna/streams-configs:v.0.5.9 \
python3 -m streams_configs.migrate head --config_db_url postgres://luna:luna@127.0.0.1:5432/luna_configurator
--config_db_url postgres://luna:luna@127.0.0.1:5432/luna_configurator
- luna_configurator
database address flag
Upload FaceStream settings#
FaceStream settings are located in a special file "facestream_dump.json". To upload these settings into the Configurator service, you should use the "load_dump.py" script.
The "load_dump.py" script requires Python version 2.x or 3.x. If version 2.x is installed, then the script should be run using the
python
command. If version 3.x is installed, then the script should be run using thepython3
command.
- Go to the directory with script and dump file:
cd /var/lib/fs/fs-current/example-docker/luna_configurator/dumps/
- Run the script to upload FaceStream settings into the Configurator service, specifying the installed version of Python (the command below gives an example of running the script for Python version 3.x):
python3 -m load_dump --dump-file=facestream_dump.json --luna-config=http://127.0.0.1:5070/1
All necessary parameters will be automatically added to the Configurator service.
LUNA Streams database preparing#
To launch FaceStream, you need to launch the LUNA Streams service by creating and initializing a database for it. This service is not included in the LUNA PLATFORM 5 distribution, so it should be launched separately.
LUNA Streams database creating#
Note. Run the commands below only if you have not previously launched the PostgreSQL container as described in "PostgreSQL container launching". When performing the PostgreSQL container launch command, the LUNA Streams database is automatically created.
Create a database for LUNA Streams:
docker exec -i postgres psql -U luna -c "CREATE DATABASE luna_streams;"
Allow the user to log in to the database:
docker exec -i postgres psql -U luna -c "GRANT ALL PRIVILEGES ON DATABASE luna_streams TO luna;"
Activate PostGIS:
docker exec -i postgres psql -U luna luna_streams -c "CREATE EXTENSION postgis;"
LUNA Streams DB initialization#
Initialize the data in the LUNA Streams database:
docker run -v /etc/localtime:/etc/localtime:ro \
--rm \
--network=host \
dockerhub.visionlabs.ru/luna/luna-streams:v.0.5.9 \
python3 ./base_scripts/db_create.py --luna-config http://localhost:5070/1
Command for launching LUNA Streams container#
The container is launched with the following command:
docker run \
--env=CONFIGURATOR_HOST=127.0.0.1 \
--env=CONFIGURATOR_PORT=5070 \
--env=PORT=5160 \
--env=WORKER_COUNT=1 \
--env=RELOAD_CONFIG=1 \
--env=RELOAD_CONFIG_INTERVAL=10 \
-v /etc/localtime:/etc/localtime:ro \
--name=luna-streams \
--restart=always \
--detach=true \
--network=host \
dockerhub.visionlabs.ru/luna/luna-streams:v.0.5.9
Commands for launching FaceStream container#
Command for launching container using CPU#
The container is launched as follows:
docker run \
--env=CONFIGURATOR_HOST=127.0.0.1 \
--env=CONFIGURATOR_PORT=5070 \
-v /var/lib/fs/fs-current/extras/conf/configs/faceengine.conf:/srv/facestream/data/faceengine.conf \
-v /var/lib/fs/fs-current/extras/conf/configs/runtime.conf:/srv/facestream/data/runtime.conf \
-v /etc/localtime:/etc/localtime:ro \
--env=PORT=34569 \
--detach=true \
--restart=always \
--name=facestream \
--network=host \
dockerhub.visionlabs.ru/luna/facestream:v.5.1.14
For a description of the remaining parameters and launching keys, see the relevant sections below.
The list of streams is available at
http://127.0.0.1:34569/api/1/streams/
. Viewing the stream in the browser is available athttp://127.0.0.1:34569/api/1/streams/preview/<stream_id>
.
Command for launching container using GPU#
Note. Use this command only if you are going to use FaceStream with GPU.
Before launching FaceStream in GPU mode, additional dependencies should be installed (see "GPU dependencies installation" section).
Before starting the FaceStream container with GPU, it is required to enable GPU for calculations in the FaceStream settings using the "enable_gpu_processing" parameter (see the "FaceStream configuration" section in the administrator manual).
docker run \
--env=CONFIGURATOR_HOST=127.0.0.1 \
--env=CONFIGURATOR_PORT=5070 \
-v /var/lib/fs/fs-current/extras/conf/configs/faceengine.conf:/srv/facestream/data/faceengine.conf \
-v /var/lib/fs/fs-current/extras/conf/configs/runtime.conf:/srv/facestream/data/runtime.conf \
-v /etc/localtime:/etc/localtime:ro \
--env=PORT=34569 \
--gpus device=0 \
--detach=true \
--restart=always \
--name=facestream \
--network=host \
dockerhub.visionlabs.ru/luna/facestream:v.5.1.14
--gpus device=0
- the parameter specifies the used GPU device and enables GPU utilization. A single GPU can be utilized per FaceStream instance. Multiple GPU utilization per instance is not available.
For a description of the remaining parameters and launching keys, see the relevant sections below.
The list of streams is available at
http://127.0.0.1:34569/api/1/streams/
. Viewing the stream in the browser is available athttp://127.0.0.1:34569/api/1/streams/preview/<stream_id>
.
Launching keys#
To launch FaceStream with Configurator, the keys are set using environment variables:
--env=
- this parameter sets the environment variables required to start the container. The following basic values are specified:
-
CONFIGURATOR_HOST=127.0.0.1
- host on which the Configurator service is running. The local host is set if the container is running on the same server where the Configurator is running. -
CONFIGURATOR_PORT=5070
- listening port for the Configurator service. By default, port 5070 is used. -
PORT=34569
- port where FaceStream will listen. -
STREAMS_ID=""
- tag specifies a list of stream IDs that will be requested from LUNA Streams for processing. Other streams will be filtered. The "stream_id" parameter is given in response to the "create stream" request.
If the value is ""
or the STREAMS_ID
tag is not set, then FaceStream will take all existing "stream_id" from the queue.
If a non-existent value is set, an error about an incorrect UUID will be indicated when launching FaceStream.
By default, the value equals ""
.
To use the key, the CONFIGURATOR_HOST
and CONFIGURATOR_PORT
variables should be specified.
STREAMS_NAME=""
- list of streams names sets in this tag. Streams names are set using the "name" parameter at the time of their creation ("create streams" request). Streams with these names will be requested from LUNA Streams for processing. Other streams will be filtered.
Otherwise, the principle of operation is similar to the "STREAMS_ID" tag.
GROUPS_ID=""
andGROUPS_NAME=""
- tags specify a list of group IDs or a list of group names. The parameters "group_id" or "group_name" are set during stream creation ("create stream" request). Streams with these parameters will be requested from LUNA Streams for processing. Other streams will be filtered.
If the value is ""
or the GROUPS_ID
/GROUPS_NAME
tags are not set, then FaceStream will not filter streams by groups.
If a non-existent value is set, an error about an incorrect UUID will be indicated when launching FaceStream.
By default, the value equals ""
.
To use the keys, the CONFIGURATOR_HOST
and CONFIGURATOR_PORT
variables should be specified.
You can set multiple values for "STREAMS_NAME", "STREAMS_ID", "GROUPS_NAME" and "GROUPS_ID" tags. Syntax example:
--env=STREAMS_ID="037f3196-c874-4eca-9d7c-91fd8dfc9593 4caf7cf7-dd0d-4ad5-a35e-b263e742e28a"
CONFIGS_ID=""
- tag is used to set a LUNA Configurator tag, which relates to the FaceStream main configurations. The same tag should be set for "TRACK_ENGINE_CONFIG" and "FACE_STREAM_CONFIG".
If the value is set to ""
then the "TRACK_ENGINE_CONFIG" and "FACE_STREAM_CONFIG" records will be used by default. If the record by default does not exist or has an invalid JSON syntax, the configuration file from the distribution package will be used.
By default, the value equals ""
.
To use the key, the CONFIGURATOR_HOST
and CONFIGURATOR_PORT
variables should be specified.
-
CONFIG_RELOAD = 1
- tag that enables checking for changes in the "FACE_STREAM_CONFIG" section of the LUNA Configurator service and takes the following values:1
- change tracking is enabled, if there are changes in the configuration, all FaceStream containers will be automatically restarted;0
- change tracking is disabled.
By default, the value equals 1
.
PULLING_TIME = 10
- tag that sets the period for receiving new parameters from the "FACE_STREAM_CONFIG" section of the LUNA Configurator service in the range [1...3600] sec. Used in conjunction with theCONFIG-RELOAD
tag.
By default, the value equals 10
.
--device=
- this parameter is required to specify the address to the USB device. The address must be specified in the stream source when it is created. Example: --device=/dev/video0
.
See how FaceStream works with LUNA Configurator in the section "Use FaceStream with LUNA Configurator" of the administrator manual.
Description of container launch parameters#
docker run
- command to launch the selected image as a new container.
-v
- enables you to load the contents of the server folder into the volume of the container. This way the content is synchronized.
-v /var/lib/fs/fs-current/extras/conf/configs/faceengine.conf:/srv/facestream/data/faceengine.conf \
- this parameter enables you to use the FaceEngine settings from the configuration file "faceengine.conf".
-v /var/lib/fs/fs-current/extras/conf/configs/runtime.conf:/srv/facestream/data/runtime.conf \
- this parameter enables you to mount the runtime configuration file into the FaceStream container. Before changing the default settings, you need to consult with VisionLabs specialists.
--network=host
- this parameter specifies that there is no network simulation and a server network is used. If you need to change the port for third-party containers, replace this line with -p 5440:5432
. Here, the first port 5440
is the local port, and 5432
is the port used in the container.
/etc/localtime:/etc/localtime:ro
- sets the current time zone used by the container system.
--name=facestream
- this parameter specifies the name of the container to be launched. The name must be unique. If a container with the same name already exists, an error will occur.
--restart=always
- this parameter defines the restart policy. Daemon always restarts the container regardless of the completion code.
--detach=true
- running the container in the background.