Deploying Data Discovery Classification service on a non-production environment using Docker Compose.
This is the multi-page printable view of this section. Click here to print.
Docker Compose
- 1: Prerequisites
- 2: Configuring Environment Variables
- 3: Deploying the Application
- 4: Viewing the Logs
- 5: Removing the Application
- 6:
- 7:
- 8:
- 9:
- 10:
- 11:
1 - Prerequisites
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
Run the following steps to configure the environment variables.
Navigate to the
docker_composedirectory.Open the
.envfile and set the following variables:
| Variable | Description | Mandatory |
|---|---|---|
| CLASSIFICATION_DOCKER_IMAGE | Repository path where the docker image of Classification service is stored. | Yes |
| PRESIDIO_DOCKER_IMAGE | Repository path where the docker image of Presidio service is stored. | Yes |
| ROBERTA_DOCKER_IMAGE | Repository path where the docker image of Roberta service is stored. | Yes |
| DOCKER_NETWORK_NAME | Name of the Docker network. | No |
| PRESIDIO_LOGGING_CONFIG | Logging level for Presidio. | No |
| ROBERTA_LOGGING_CONFIG | Logging level for Roberta. | No |
| CLASSIFICATION_LOGGING_CONFIG | Logging level for the classification service. | No |
- Save the changes.
3 - Deploying the Application
Run the following steps to deploy the Data Discovery application on Docker.
- Navigate to the
docker_composedirectory.
cd /docker_compose
- Run the
compose_upscript.
./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
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.
Navigate to the
docker_composedirectory.Edit the
.envfile.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"}}
Save the changes.
Run the
compose_down.shfile to undeploy the application.Run the
compose_up.shfile to redeploy the application.
5 - Removing the Application
To remove the application from Docker, run the following steps.
- Navigate to the
docker_composedirectory.
cd /docker_compose
- Run the
compose_downscript.
./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 -
Navigate to the
/deployment/docker_composedirectory.Run the
compose_up.shfile.
9 -
Navigate to the
/deployment/docker_composedirectory.Run the
compose_up.shfile.
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"