This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Docker Compose

Deploying the application on Docker Compose

Deploying Data Discovery Classification service on a non-production environment using Docker Compose.

1 - Prerequisites

Prerequisites for Docker.

Ensure that the following points are completed before deploying the application.

  • The development package provided by Protegrity is obtained from the portal and extracted.

  • The Docker CLI is installed to manage Docker containers.

  • The Docker Compose is installed for local containerized deployments. This application supports Docker Compose V2. Ensure that your installation supports this version.

  • The images for Classification service, Presidio service, and Roberta services provided in the images folder are uploaded to the required image repository and available for deployment.

2 - Configuring Environment Variables

Setting the environment variables for Docker.

Run the following steps to configure the environment variables.

  1. Navigate to the docker_compose directory.

  2. Open the .env file and set the following variables:

VariableDescriptionMandatory
CLASSIFICATION_DOCKER_IMAGERepository path where the docker image of Classification service is stored.Yes
PRESIDIO_DOCKER_IMAGERepository path where the docker image of Presidio service is stored.Yes
ROBERTA_DOCKER_IMAGERepository path where the docker image of Roberta service is stored.Yes
DOCKER_NETWORK_NAMEName of the Docker network.No
PRESIDIO_LOGGING_CONFIGLogging level for Presidio.No
ROBERTA_LOGGING_CONFIGLogging level for Roberta.No
CLASSIFICATION_LOGGING_CONFIGLogging level for the classification service.No
  1. Save the changes.

3 - Deploying the Application

Deploying the application on Docker and verifying it.

Run the following steps to deploy the Data Discovery application on Docker.

  1. Navigate to the docker_compose directory.
cd /docker_compose
  1. Run the compose_up script.
./compose_up.sh 

The network is set up based on the values provided in the docker-compose.yaml file. The images are extracted from the repositories provided in the .env file and the respective containers are started.
After the deployment is successful, the following message is displayed.
...[OK]

Verifying the Deployment

After the deployment is complete, verify the deployment on Docker.

Verifying the deployment from the Docker network. For example, verifying the deployment from another container.

curl -XPOST classification_service/pty/data-discovery/v1.0/classify --data 'You can reach Dave Elliot by phone 203-555-1286' -H "Content-Type: text/plain" 
  

Verifying the deployment from a host machine.

curl -XPOST http://localhost:8580/pty/data-discovery/v1.0/classify --data 'You can reach Dave Elliot by phone 203-555-1286' -H "Content-Type: text/plain"
    

The response generated will be similar to the following snippet.

{
  "providers": [
    {
      "name": "Presidio Classification Provider",
      "version": "1.0.0",
      "status": 200,
      "elapsed_time": 1.014178991317749,
      "exception": null,
      "config_provider": {
        "name": "Presidio",
        "address": "http://presidio_provider_service",
        "supported_content_types": []
      }
    },
    {
      "name": "Roberta Classification Provider",
      "version": "1.0.0",
      "status": 200,
      "elapsed_time": 19.091534852981567,
      "exception": null,
      "config_provider": {
        "name": "Roberta",
        "address": "http://roberta_provider_service",
        "supported_content_types": []
      }
    }
  ],
  "classifications": {
    "PERSON": [
      {
        "score": 0.9236000061035157,
        "location": {
          "start_index": 14,
          "end_index": 25
        },
        "classifiers": [
          {
            "provider_index": 0,
            "name": "SpacyRecognizer",
            "score": 0.85,
            "details": {}
          },
          {
            "provider_index": 1,
            "name": "roberta",
            "score": 0.9972000122070312,
            "details": {}
          }
        ]
      }
    ],
    "PHONE_NUMBER": [
      {
        "score": 0.8746500015258789,
        "location": {
          "start_index": 35,
          "end_index": 47
        },
        "classifiers": [
          {
            "provider_index": 0,
            "name": "PhoneRecognizer",
            "score": 0.75,
            "details": {}
          },
          {
            "provider_index": 1,
            "name": "roberta",
            "score": 0.9993000030517578,
            "details": {}
          }
        ]
      }
    ]
  }
}
 

4 - Viewing the Logs

Viewing logs in Docker.

Viewing Logs

The application logs can be viewed using the following commands:

docker logs -f classification_service
docker logs -f roberta_provider
docker logs -f presidio_provider

Setting the Log Level

The log level can be updated in the .env file.

To set the log level, run the following steps.

  1. Navigate to the docker_compose directory.

  2. Edit the .env file.

  3. Uncomment the required logging configuration and set the logging level to one of the following:

  • INFO
  • DEBUG
  • ERROR
  • WARNING

For example, to change the log level for PRESIDIO_LOGGING_CONFIG, configure the parameter as follows.

PRESIDIO_LOGGING_CONFIG={"root":{"level":"ERROR"}} 
  1. Save the changes.

  2. Run the compose_down.sh file to undeploy the application.

  3. Run the compose_up.sh file to redeploy the application.

5 - Removing the Application

Remove the application from Docker.

To remove the application from Docker, run the following steps.

  1. Navigate to the docker_compose directory.
cd /docker_compose
  1. Run the compose_down script.
./compose_down.sh 

Note: To remove the application completely, ensure that the images uploaded to the image repository are also deleted.

6 -

    ./compose_up.sh

7 -

    ./compose_up.sh

8 -

  1. Navigate to the /deployment/docker_compose directory.

  2. Run the compose_up.sh file.

9 -

  1. Navigate to the /deployment/docker_compose directory.

  2. Run the compose_up.sh file.

10 -

Verifying the deployment from a host machine.

curl -XPOST http://localhost:8580/pty/data-discovery/v1.0/classify --data 'You can reach Dave Elliot by phone 203-555-1286' -H "Content-Type: text/plain"

11 -

Verifying the deployment from the Docker network. For example, verifying the deployment from another container.

curl -XPOST classification_service/pty/data-discovery/v1.0/classify --data 'You can reach Dave Elliot by phone 203-555-1286' -H "Content-Type: text/plain"