Service installation and deployment
1. Installation and deployment
The service is containerized with Docker, and a Docker image is available in a Facephi repository.
docker login facephicorp.jfrog.io
user: username
pass: tokendocker pull facephicorp.jfrog.io/docker-pro-fphi/facephi-backend1n-service:#VERSION#Where #VERSION# is the tag for the specific version we want to download. The tag has the prefix v (for example, v5.0.0).
2. Databases.
Before starting the service, the administrator must create and configure the relevant databases, as well as a dedicated user for the service. This username/password must be specified in the connection string. The database technology the service will use is determined at startup, based on the prefix of this connection string.
2.1 MongoDB
Set the environment variable DATABASE_CONNECT_STRING to point to MongoDB.
# Accepted MongoDB prefixes.
# mongodb://
# mongodb+srv://
export DATABASE_CONNECT_STRING=mongodb://user:pass@localhost:32902/?directConnection=true&serverSelectionTimeoutMS=5000The service itself will create a database named db-backend, if one does not already exist. It will contain three collections:
mediato store images.patternsto store biometric patterns.collectionsfor collections created usingPOST /collections(starting with version 5.0.0). If it is empty at startup, the service populates it from thecollectionIdvalues present inpatterns(see the version 5.0.0 release notes).
The user specified in the connection string needs read and write permissions on these three collections.
2.2 PostgreSQL
Similarly, set the environment variable DATABASE_CONNECT_STRING to point to PostgreSQL.
PostgreSQL differs slightly from MongoDB. A database named db_backend must be created in advance by the system administrator. PostgreSQL makes it difficult to create databases from the client itself. The administrator could run commands such as the following beforehand:
Within the PostgreSQL database, the service will create three tables, just as it does with MongoDB:
mediato store images.patternsto store biometric patterns.collectionsfor collections created usingPOST /collections(starting with version 5.0.0), following the same automatic migration rule.
The user specified in the connection string needs permission to create tables and to read and write data in them.
3. docker-compose
One way to deploy the service is to create a file named docker-compose.yml with the following contents, changing the variable values as needed. The example includes a MongoDB database; if you use an external database, remove the mongo service and point DATABASE_CONNECT_STRING to it (remember that inside the container 127.0.0.1 it is the container itself, not the host machine).
First, you must create a user directory with read and write permissions, for example ~/backend1n/config, and place these two files in it:
The SelphID license file
license.lic(required). This is an online license: the machine needs outbound access to the license servers listed in section 4.4. The service will not start without a valid license: it logs the reason and exits with code 1.The service configuration file
config.json(optional).
You must also provide the environment variable DATABASE_CONNECT_STRING with the database connection string (for example, mongodb://mongo:27017). If it is not defined, the service will not start. For debugging purposes, you can disable database operations by providing the value no-db. Example: DATABASE_CONNECT_STRING=no-db
Run the following command from the folder containing the file 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 different resource types, you can use 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_PATHis a folder (inside the container,/service/license) that contains the filelicense.lic. In this example, the host file is~/backend1n/license/license.lic.
4.2 Service configuration
You can specify another location for the file config.json containing the service parameters:
CONFIG_FILEis the path, inside the container, to the configuration file. Do not mount any volume over/service(contains the service executable): use a different directory, such as/service/custom.
If no config.jsonis specified, the following defaults are used:
Actual path of the log files:
logger_pathis only the base path. The final file is written to<logger_path>/<logger_file_prefix>-<AAAA-MM-DD>/logs/app_<AAAA-MM-DD>.log(a new directory each day). Withlogger_rotation=hourlythe filename includes the hour (UTC):app_<AAAA-MM-DD>_<HH>.log. For example, with the default values (logger_path=/service/config,logger_file_prefix=app), today's log is written to/service/config/app-2026-09-22/logs/app_2026-09-22.log, that is, inside the mounted configuration directory. If you setlogger_path=./logs(relative to/service), the log is written to./logs/app-2026-09-22/logs/app_2026-09-22.log. Each log line is a JSON object containing at leasttimestamp,humanized_timestampandlevel.
Parameters
metrics_*: are classification policy only. They do not change what the service does, only how an already-collected snapshot is summarized in the fieldsstate.classificationandalertsofGET /metrics. They are read only once at startup, whenconfig.json;POST /configdoes not modify them.
JWT authentication is optional and disabled by default. When enabled, GET /health, GET /version, GET /metrics and GET /metrics/prometheus remain public, while the rest of the endpoints require a valid HS256 JWT with an unexpired exp claim.
Authentication rules:
The token is sent in
Authorization: Bearer <jwt>(the scheme is case-insensitive) and/or in the API key header (x-api-keyby default, or the name specified inauth_api_key_header_name; header names are case-insensitive), according toauth_accept_authorization_headerandauth_accept_api_key_header. If both headers are present,Authorization.Tokens signed with a different secret or a different algorithm (HS384, HS512,
alg: none), withoutexpwithexpa non-numeric value, withexpan expired value, or withnbfin the future are rejected.An unauthenticated request or a request with an invalid token returns
401the body{"status":401,"error":"Unauthorized","message":"…","timeStamp":"…"}and the headerWWW-Authenticate: Bearer. Authentication is evaluated before request body validation.Each unauthorized attempt is counted in
unauthorizedinGET /metrics.
Any of these parameters can be set using environment variables with the prefix FACEPHI_BACKEND1N_REST_ (the key name in uppercase), which take precedence over config.json:
Additionally, the underlying biometric SDK (SelphID) supports the environment variable FACEPHI_SELPHID_FACIALAUTHENTICATION_THRESHOLD (optional). It is the similarity value, between 0 and 100, at which the SDK considers a facial authentication successful. The default is 65. This variable does not filter the results of POST /search/* (which return similarity between 0 and 1): to discard candidates below a threshold, send options.minSimilarity (e.g. 0.65).
JWT authentication configuration parameters can only be set at startup:
Set them in
config.jsonor in the environment variablesFACEPHI_BACKEND1N_REST_AUTH_*before the service starts.GET /confignever returns those JWT authentication keys.POST /configrejects those keys with400and cannot be used to modify them at runtime.
4.3 Debug and usage paths
Finally, you can specify a specific volume/path with read and write permissions for the SDK debug information and SDK usage data using the environment variables DEBUG_PATH and USAGE_PATH. The SDK creates the files selphidDebug.log, selphidUsage.db and cntrs.db. If none are specified, they are written to /service/config:
4.4 Network configuration
To connect to our license servers, you must add the following rules to your firewall rules:
52.223.22.71
443
TCP/IP
35.71.188.31
443
TCP/IP
75.2.113.112
443
TCP/IP
99.83.149.57
443
TCP/IP
Next, add the following DNS to your allowlist:
Last updated