Update FindFace Security to 4.x

In this section:

Update from 1.x to 4.x

To update FindFace Security from 1.x to 4.x, do the following:

  1. Stop the services:

    sudo systemctl stop findface-extraction*
    sudo systemctl stop findface-security*
    sudo systemctl stop findface-videomanager*
    
  2. Install a new version according to your architecture outline, following instructions in Deploy FindFace Security.

  3. Migrate data drom PostgreSQL to Tarantool.

    Important

    Before you proceed, make sure that the size of free disk space is equal or larger than the occupied space.

    sudo findface-security tnt_migrate
    

    Note

    To purge PostgreSQL after migration is completed, execute the command with the option --purge-sql. All old data will be LOST.

    sudo findface-security tnt_migrate --purge-sql
    

    Note

    It is absolutely data-safe to interrupt the migration process and resume it later.

Update from 2.x to 4.x

To update FindFace Security from 2.x to 4.x, do the following:

  1. Open the findface-security configuration file. Save the values of the following parameters for later use: EXTERNAL_ADDRESS, SECRET_KEY, VIDEO_DETECTOR_TOKEN, ROUTER_URL.

    sudo vi /etc/ffsecurity/config.py
    
    EXTERNAL_ADDRESS = "http://172.20.77.58"
    
    ...
    # use pwgen -sncy 50 1|tr "'" "." to generate your own unique key
    SECRET_KEY = 'c8b533847bbf7142102de1349d33a1f6'
    
    FFSECURITY = {
       'VIDEO_DETECTOR_TOKEN': '381b0f4a20495227d04185ab02f5085f',
       ...
       'ROUTER_URL': 'http://172.20.77.58',
       ...
    }
    
  2. Stop the findface-security service.

    sudo systemctl stop findface-security*
    
  3. Create a backup of the Tarantool-based biometric database in any directory of your choice, for example, /tmp/dump.

    Tip

    See Backup and Restore Data Storages for details.

    mkdir -p /tmp/dump
    cd /tmp/dump
    sudo findface-storage-api-dump -config /etc/findface-sf-api.ini
    
  4. Install the apt repository with the new FindFace Security, using the console installer as described in this section.

  5. Install the services from the repository, following your architecture outline.

    sudo apt update
    sudo apt install ffsecurity ffsecurity-ui findface-extraction-api findface-ntls findface-sf-api findface-tarantool-server findface-upload findface-video-manager findface-video-worker
    
  6. Open the findface-security configuration file and paste the saved EXTERNAL_ADDRESS, SECRET_KEY, VIDEO_DETECTOR_TOKEN, and ROUTER_URL into it.

    sudo vi /etc/ffsecurity/config.py
    
  7. Modify the Tarantool database structure by applying the tnt_schema.lua file from the new version.

    sudo findface-security make_tnt_schema | sudo tee /etc/ffsecurity/tnt_schema.lua
    
  8. Remove the Tarantool database (default database or shards).

    sudo rm -f /opt/ntech/var/lib/tarantool/default/{index,snapshots,xlogs}/*
    
    sudo rm -f /opt/ntech/var/lib/tarantool/shard-001/{index,snapshots,xlogs}/*
    ...
    sudo rm -f /opt/ntech/var/lib/tarantool/shard-00N/{index,snapshots,xlogs}/*
    
  9. Restart the Tarantool database.

    systemctl restart tarantool*
    
  10. Restore the Tarantool database from the backup.

    cd /tmp/dump
    for x in *.json; do curl -X POST "http://127.0.0.1:18411/v2/galleries/${x%%.json}"; done
    for x in *.json; do sudo findface-storage-api-restore -config /etc/findface-sf-api.ini < "$x"; done
    
  11. Migrate the main database architecture from FindFace Security to PostgreSQL, re-create user groups with predefined rights and the first user with administrator rights.

    sudo findface-security migrate
    sudo findface-security create_groups
    sudo findface-security create_default_user
    
  12. Restart the findface-security service.

    sudo systemctl restart findface-security.service