Skip to content

Upgrade FaceStream#

Before launching FaceStream, the steps described in the "Before upgrade" section must be completed.

Settings migration#

To preserve the possibility of using the LUNA Streams user settings from the previous version, you should perform a migration.

FaceStream settings do not require migration in the current release.

Run the following command to migrate LUNA Streams settings:

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

LUNA Streams database migration#

Run migration script to update the LUNA Streams database structure.

It is recommended that you back up your database before taking any changes.

docker run \
-v /etc/localtime:/etc/localtime:ro \
--rm \
--network=host \
dockerhub.visionlabs.ru/luna/luna-streams:v.0.5.9 \
alembic -x luna-config=http://127.0.0.1:5070/1 upgrade head

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 at http://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 at http://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="" and GROUPS_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 the CONFIG-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.