Where #VERSION# is the specific version number we want to download (for example, 4.2.0).
2. Databases.
Before starting the service, the administrator must create and configure the relevant databases, as well as a specific user for the service. This user/password must be specified in the connection string. The DB technology the service will use will be decided at startup, depending on the prefix of this connection string.
2.1 MongoDB
The environment variable DATABASE_CONNECT_STRING pointing to MongoDB.
The service itself will create a database called db-backend, if it does not already exist. It will host two collections:
media to store images.
patterns to store biometric patterns.
2.2 PostgreSQL
Likewise, the environment variable DATABASE_CONNECT_STRING pointing to PostgreSQL.
The PostgreSQL case differs slightly from MongoDB. A DB named db_backend must have been previously created by the system administrator. PostgreSQL makes it difficult to create databases from the client itself. An example of the prior commands the administrator should run would be:
Inside the PostgreSQL DB, the service will create two tables, just as with MongoDB:
media to store images.
patterns to store biometric patterns.
3. docker-compose
One way to deploy the service is to create a file docker-compose.yml with the following content, changing the value of the variables as necessary.
First, you must create a user directory with read and write permissions, for example ~/backend1n/config, and place these two files:
The SelphID license file license.lic (required).
The service configuration file config.json (optional).
In that same directory, the service will write the log files.
In addition, you must provide the environment variable DATABASE_CONNECT_STRING with the connection string to the database (for example, mongodb://127.0.0.1:27017). For debugging purposes, you can disable database operations by providing the value no-db. Example: DATABASE_CONNECT_STRING=no-db
Run the following command, inside the folder where the file is located docker-compose.yml, to deploy the service:
4. Additional configuration
Following the steps in section 2, the service is ready to start. If you need to create additional volumes for the different types of resources, you can follow these additional configurations.
4.1 License
You can mount an additional volume and define the environment variable LICENSE_PATH, if you want to install the license outside the usual configuration directory.
LICENSE_PATH is a folder with the file license.lic and read and write permissions. In this example, ~/backend1n/license/license.lic.
4.2 Service configuration
You can specify another location for the file config.json with the service parameters:
CONFIG_FILE is the path to the configuration file in the additional volume.
If no config.jsonis specified, these default values will be used:
The same JWT parameters can be injected via environment variables using the prefix FACEPHI_BACKEND1N_REST_. For example:
4.3 Debug and usage path
Finally, you can specify a specific volume/path with read and write permissions for the SDK debug information and the SDK usage data, using the environment variables DEBUG_PATH and USAGE_PATH:
4.4 Network configuration
To connect to our license servers, you must add the following rules to your firewall:
{
"port": 6969, # Service port number.
"number_of_threads": 0, # The number of I/O threads, 0 = number of CPU cores.
"connection_timeout": 0, # The connection lifetime without reading or writing.
"keep_alive_request_number": 0, # Sets the maximum number of requests that can be served through a keep-alive connection.
# Once the maximum number of requests is reached, the connection is closed.
# The default value of 0 means unlimited.
"client_max_body_size": 100, # The maximum allowed body size in requests, in Mb.
# The default value is 100 Mb.
"logger_path" : "./logs", # Sets the path where log files are stored.
"logger_level" : "info", # Possible values are [trace|debug|info|warning|error|critical|off].
"logger_rotation" : "daily", # Possible values are [hourly|daily].
"logger_max_files" : 0, # The default value of 0 means unlimited.
"auth_enabled": false, # Enables JWT authentication for protected endpoints.
"auth_jwt_secret": "", # Shared secret used to validate HS256 JWT signatures.
"auth_accept_authorization_header": true, # Accepts Authorization: Bearer <jwt>.
"auth_accept_api_key_header": true, # Accepts the API Key header with the JWT token.
"auth_api_key_header_name": "x-api-key" # API Key header name when enabled.
}