4 Service Deployment

This page describes detailed steps to install SenseID.

This chapter describes how to deploy and activate the SenseID service, primarily installing, configuring, launching critical services and potential issues and solutions.

4.1 Confirm the installation package

The installation package should have been unzipped to place the license files. See Section 3.3.1 for more details.

Change the directory to the root folder where you unzipped the SenseID installation package.

$ cd 1v1-private-cloud-v1.8
$ ls -1

The structure is as follows:

api.tar
docker-compose
docker-compose.yml
go-workers
load_image.sh
package.toml
product.toml

4.2 Deploy Go-Workers

This service is a major computing service, so it is recommended to allocate dedicated server resources if possible.

4.2.1 Adjust CPU cores

Before deploying Go-Workers, you need to get the number of physical CPU cores on your server. The command to get the physical CPU core information is as follows.

$ echo Cores=$(($(lscpu | awk '/^Socket/{print $2}') * $(lscpu | awk '/^Core/{print $4}')))

Change the directory to the Go-Workers folder, open the.envfile, and set theHANDLERSvalue to the number of physical CPU cores obtained above if you are using a dedicated server. Otherwise, specify a number. Save and close the.envfile.

$ cd go-workers
$ vi .env

HANDLERS cannot be set to a value that exceeds the number of physical CPU cores on the server. The higher theHANDLERSvalue is, the higher the number of concurrent services and the higher the memory and CPU consumption.

4.2.2 Start Go-Workers service

Before you start, make sure your license has been replaced.

Start the Go-Workers service.

$ sudo ./start.sh

You only need to execute this instruction once.

A script to stop the service is also provided in the same folder. Execute it only when you want to stop the service.

$ sudo ./stop.sh

4.2.3 Check Go-Workers service

To confirm whether the Go-Workers service started normally, try the following command to see the logs.

$ tail -f tmp/worker.log.0

If the tail command contains Server Listen on port 50050, the service has started successfully.

Also, perform the health check with the following command.

$ curl 127.0.0.1:50050/healthcheck

An example is as follows (This indicates that the service started successfully).

{"request_id":"07a41c21822e4223a373e77bfc186ed2","status":"ok"}

4.3 Deploy Ruby-Cloud-API

The deployment of the following services depends on Docker. Make sure you have Docker installed on your server.

4.3.1 Load service images

Load the Ruby-Cloud-API image file.

$ cd 1v1-private-cloud-v1.8
$ sudo ./load_image.sh

The execution result is as follows.

Loaded image: registry.sensetime.com/senseid-cloudv2/api-1v1:xxx

4.3.2 Set Go-Workers address

Get the IP address of the Go-Workers server.

$ hostname -I | cut -d' ' -f1

Open the .env file in the root folder of the SenseID installation package.

$ vi .env

Set the WORKER_IP value in the last line to the IP address of the server where the Go-Workers service is deployed.

4.3.3 Adjust CPU cores

Sets the number of physical CPU cores on the server, the same way as Go-Workers.

$ vi .env

Open the.envfile, and set theHANDLESvalue to the number of physical CPU cores obtained if you are using a dedicated server. Otherwise, specify a number. Save and close the.envfile.

HANDLES cannot be set to a value that exceeds the number of physical CPU cores on the server. The higher theHANDLESvalue is, the higher the number of concurrent services and the higher the memory and CPU consumption.

4.3.4 Start Ruby-Cloud-API service

Start the Ruby-Cloud-API service.

$ sudo ./docker-compose up -d

The results are as follows.

Creating network "1v1-private-cloud-yyyymmdd_default" with the default driver
Creating 1v1-private-cloud_api_1 ... done

Confirm that the Docker is running.

$ sudo ./docker-compose ps

The results are as follows.

         Name                    Command             State               Ports
---------------------------------------------------------------------------------------
1v1-private-cloud_api_1   ./entrypoint.sh start   Up (healthy)   0.0.0.0:3000->3000/tcp

The service is now successfully deployed.

4.3.5 Check Ruby-Cloud-API service

Perform the health check with the following command.

$ curl 127.0.0.1:3000/healthcheck

An example is as follows (This indicates that the service started successfully).

{"code":1000,"status":"ok"}

Last updated