Configuration

The service allowed two variant of configuration:

  1. use the Configurator service

  2. use the configuration file

The service reads settings from the configuration file by default.

You can specify the –luna-config option for pulling settings from the Configurator service, see configurator.

Auto reload configuration

The service supports an auto-reload of configurations. You can enable this feature by specifying a config-reload option in the command line. The service periodically checks new settings. If current settings and new pulled settings are the same the service will not perform any actions. You can specify the check period in the pulling-time command line argument (10 seconds by default).

If a configuration fetching has failed, the service will work without applying any changes to the existing configurations.

If check connections with the new configuration have failed, the service will retry pulling new configuration after pulling-time seconds. The service will shut down after 10 failed attempts.

Warning

Service can work incorrectly while the new settings are being applied. It is strongly recommended not to send requests to the service when you change important settings (database configuration, work plugins list, and others).

Configuration file for administrator

# Luna-api configuration file

[LUNA_CONFIGURATOR]
#: load configs from LUNA Configurator
USE_CONFIGURATOR = 0
#: LUNA Configurator protocol, IP address, and port
LUNA_CONFIGURATOR_ORIGIN = http://127.0.0.1:5070
#: API version of the LUNA Configurator
LUNA_CONFIGURATOR_API  = 1


[LUNA_HANDLERS_DB]

#: type of database: "postgres" or "oracle"; "postgres" type is used by default
DB_TYPE = postgres
#: database username
DB_USER = luna
#: database password
DB_PASSWORD = luna
#: database name for "postgres" type, SID name for "oracle" type
DB_NAME = luna_handlers
#: database IP address
DB_HOST = 127.0.0.1
#: database listener port, 5432 - default for "postgres" type, 1521 - default for "oracle" type
DB_PORT = 5432


[LUNA_HANDLERS_DB.DB_SETTINGS]

#: [integer] database connection pool size
CONNECTION_POOL_SIZE = 5


[LUNA_MONITORING]

#: [string] storage type
STORAGE_TYPE = influx
#: [integer] send data for monitoring to InfluxDB
SEND_DATA_FOR_MONITORING = 1
#: [string] InfluxDB 2.x workspace
ORGANIZATION = luna
#: [string] InfluxDB 2.x authentication token
TOKEN = kofqt4Pfqjn6o0RBtMDQqVoJLgHoxxDUmmhiAZ7JS6VmEnrqZXQhxDhad8AX9tmiJH6CjM7Y1U8p5eSEocGzIA==
#: [string] InfluxDB 2.x bucket name
BUCKET = luna_monitoring
#: [string] InfluxDB IP address
HOST = 127.0.0.1
#: [integer] InfluxDB port
PORT = 8086
#: [integer] use HTTPS to connect to InfluxDB
USE_SSL = 0
#: [integer] frequency of sending monitoring data to InfluxDB (in seconds)
FLUSHING_PERIOD = 1


[LUNA_HANDLERS_LOGGER]

#: folder, where logs are saved
FOLDER_WITH_LOGS = ./
#: level of debug print, by priority: "ERROR", "WARNING", "INFO", "DEBUG"
LOG_LEVEL = INFO
#: time format used in log records: "LOCAL" or "UTC"
LOG_TIME = LOCAL
#: maximum log file size in megabytes before performing rotation (0 - without rotation)
MAX_LOG_FILE_SIZE = 1024
#: send log to stdout
LOG_TO_STDOUT = 1
#: send log to file
LOG_TO_FILE = 0
#: allow multiline stack trace in logs
MULTILINE_STACK_TRACE = 1


[LUNA_REMOTE_SDK_ADDRESS]

#: LUNA Remote SDK protocol, IP address, and port
ORIGIN = http://127.0.0.1:5220
#: API version of the LUNA Remote SDK
API_VERSION = 1


[LUNA_REMOTE_SDK_TIMEOUTS]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60


[LUNA_FACES_ADDRESS]

#: LUNA Faces protocol, IP address, and port
ORIGIN = http://127.0.0.1:5030
#: API version of the LUNA Faces
API_VERSION = 3


[LUNA_FACES_TIMEOUTS]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60


[LUNA_IMAGE_STORE_FACES_SAMPLES_ADDRESS]

#: LUNA Image Store protocol, IP address, and port (for samples)
ORIGIN = http://127.0.0.1:5020
#: API version of the LUNA Image Store (for samples)
API_VERSION = 1
#: *bucket* name, where samples will be stored
BUCKET = visionlabs-samples

[LUNA_IMAGE_STORE_BODIES_SAMPLES_ADDRESS]

#: LUNA Image Store protocol, IP address, and port (for samples)
ORIGIN = http://127.0.0.1:5020
#: API version of the LUNA Image Store (for samples)
API_VERSION = 1
#: *bucket* name, where samples will be stored
BUCKET = visionlabs-bodies-samples

[LUNA_IMAGE_STORE_IMAGES_ADDRESS]

#: LUNA Image Store protocol, IP address, and port (for origin images)
ORIGIN = http://127.0.0.1:5020
#: API version of the LUNA Image Store (for origin images)
API_VERSION = 1
#: *bucket* name, where origin images will be stored
BUCKET = visionlabs-image-origin

[LUNA_IMAGE_STORE_FACES_SAMPLES_TIMEOUTS]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60

[LUNA_IMAGE_STORE_BODIES_SAMPLES_TIMEOUTS]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60

[LUNA_IMAGE_STORE_IMAGES_TIMEOUTS]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60

[ADDITIONAL_SERVICES_USAGE]

#: [integer] send events to LUNA Events for storing
LUNA_EVENTS = 1
#: [integer] use LUNA Tasks
LUNA_TASKS = 1
#: [integer] send events to the LUNA Sender subscription service
LUNA_SENDER = 1
#: [integer] use LUNA Python Matcher Proxy instead of LUNA Python Matcher
LUNA_MATCHER_PROXY = 1
#: [integer] use Luna Image store for images/samples storages
LUNA_IMAGE_STORE = 1
#: [integer] use Luna Lambda
LUNA_LAMBDA = 0


[LUNA_EVENTS_ADDRESS]

#: LUNA Events protocol, IP address, and port
ORIGIN = http://127.0.0.1:5040
#: API version of the LUNA Events
API_VERSION = 2


[LUNA_EVENTS_TIMEOUTS]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60


[LUNA_PYTHON_MATCHER_ADDRESS]

#: LUNA Python Matcher protocol, IP address, and port
ORIGIN = http://127.0.0.1:5100
#: API version of the LUNA Python Matcher
API_VERSION = 1


[LUNA_PYTHON_MATCHER_TIMEOUTS]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60


[LUNA_MATCHER_PROXY_ADDRESS]

#: LUNA Python Matcher Proxy protocol, IP address, and port
ORIGIN = http://127.0.0.1:5110
#: API version of the LUNA Python Matcher Proxy
API_VERSION = 1


[LUNA_PYTHON_MATCHER_PROXY_TIMEOUTS]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60


[REDIS_DB_ADDRESS]

#: redis host for the service subscription
HOST = 127.0.0.1
#: redis port for the service subscription
PORT = 6379
#: [string] redis username for the service subscription
USER =
#: redis password for the service subscription
PASSWORD =
#: redis channel for the service subscription
CHANNEL = luna-sender


[REDIS_DB_ADDRESS.SENTINEL]
#: [string] sentinel master name
MASTER_NAME = luna_sender_master
#: [list(string)] list of Redis Sentinel listeners (example [127.0.0.1:26379, 10.0.4.1:26379]).
#: By setting this parameter, application will query Redis parameters (host and port) from sentinels
SENTINELS = []
#: [string] sentinel username
USER =
#: [string] sentinel password
PASSWORD =


[FETCH_IMAGE_TIMEOUTS]

#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60


[ATTRIBUTES_STORAGE_POLICY]
#: [integer] default time to live of temporary attributes (in seconds)
DEFAULT_TTL = 300
#: [integer] maximum time to live of temporary attributes (in seconds)
MAX_TTL = 86400


[LUNA_HANDLERS_LIMITS]

#: [integer] max number of images received in request
RECEIVED_IMAGES_LIMIT = 8
#: [integer] max detections in raw event
RAW_EVENT_DETECTIONS_LIMIT = 100
#: [integer] max length of arrays in raw event
RAW_EVENT_ARRAYS_LIMIT = 30
#: [integer] max number of matching results for the candidates' list returned in the response
RESULT_CANDIDATE_LIMIT = 100


[EXTERNAL_LUNA_API_ADDRESS]

#: external luna-api origin
ORIGIN = http://127.0.0.1:5000
#: external luna-api origin
API_VERSION = 6


[LUNA_HANDLERS_HTTP_SETTINGS]
#: web server http settings

#: [integer] service request timeout (in seconds)
REQUEST_TIMEOUT = 60
#: [integer] service response timeout (in seconds)
RESPONSE_TIMEOUT = 600
#: [integer] max request size (in bytes), default 1gb
REQUEST_MAX_SIZE = 1073741824
#: [integer] service http keep-alive timeout (in seconds)
KEEP_ALIVE_TIMEOUT = 15


[LUNA_LAMBDA_UNIT_TIMEOUTS]
#: timeouts for http-request to lambda unit

#: CONNECT TIMEOUT
CONNECT = 20
#: REQUEST TIMEOUT (total)
REQUEST =  60


[LUNA_SERVICE_METRICS]

#: [int] whether to enable /metrics path and statistics collection
ENABLED = 0
# [string] statistics data format (prometheus is the only option yet)
METRICS_FORMAT = prometheus

[DESCRIPTOR_ENCRYPTION]

#: [int] whether to enable descriptors encryption
ENABLED = 0
#: [string] encryption algorithm
ALGORITHM = aes256-gcm


[DESCRIPTOR_ENCRYPTION.PARAMS]

#: [string] encryption key source type
SOURCE = raw
#: [string] encryption key
KEY = 3gDyT4o+YlKLV4NZRjP/wznuhgxMI0mNNJWqc782Z9M=


[LUNA_SERVICE_METRICS.EXTRA_LABELS]


[OTHER]

#: list of active plugins
LUNA_HANDLERS_ACTIVE_PLUGINS = []
#: storage time - "LOCAL" or "UTC"
STORAGE_TIME = LOCAL
#: default face descriptor version
DEFAULT_FACE_DESCRIPTOR_VERSION = 62
#: default human body descriptor version
DEFAULT_HUMAN_DESCRIPTOR_VERSION = 116

Extended administrator configuration

Extended configuration.

configs.config.DEFAULT_VERIFICATION_THRESHOLD = 0.9

default verification threshold

configs.config.HANDLERS_CACHE_MAX_SIZE = 1024

int, maximum number of cached handlers

configs.config.HANDLERS_CACHE_POLLING_PERIOD = 10

seconds, cache invalidator polling period

configs.config.HANDLERS_CACHE_TTL = 60

seconds, time to live for cached handlers

configs.config.MAX_IMAGE_ORIGIN_EXTERNAL_URL_LENGTH = 256

max image origin external url