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

Return to the regular view of this page.

Docker Compose

Set up Data Discovery using Docker Compose for development and testing.

1 - Docker Compose Deployment

Use Docker Compose for a non-production environment. This set up has been designed for a local deployment and testing.

Prerequisites

  • The Deployment Package provided by Protegrity is obtained from the portal and extracted.

  • Docker CLI version greater than or equal to 28.3.0 is installed. This is required for managing Docker containers.

  • Docker Compose version greater than or equal to 2.37.3 is installed. This is required for local containerized deployments.

Docker Compose v2 that uses the docker compose command syntax. Ensure that the the installation supports this version.

For Apple Macbook users, refer Additional Notes.

Starting the Containers

  1. If a Docker network does not exist, run the following command to create a Docker network.
docker network create protegrity-network

This step ensures that all services communicate with each other within the same Docker network.

  1. Run the following script to launch the services in detached mode.
docker compose up -d

The classification_service is exposed on port 8050.

Verifying the Deployment

When running command from outside the docker network, e.g., from your host machine, use the published port mapping. e.g.,

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

When running commands from inside the Docker network (for example, from another container), use the service name directly. This leverages Docker’s internal DNS. e.g.,

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

Stopping the Containers

  1. Run the following script to stop, remove the Docker services. Also, remove the created Docker network created.

    docker compose down
    
  2. To remove a Docker network that has been created, run the following command:

    docker network rm protegrity-network
    

Additional Notes

For Apple users running containers on Apple Silicon (M1/M2/M3/M4).

  • For Docker Desktop on a MacBook.

    1. Open Docker Desktop.
    2. Navigate to Settings > General.
    3. Enable Use Virtualization Framework and Use Rosetta for x86/amd64 emulation on Apple Silicon.
    4. Click Apply & Restart.
  • For Colima. Start Colima using Rosetta and Apple’s virtualization framework:

      colima start --vm-type vz --vz-rosetta
    

2 - Configuring Environment Variables

Setting the environment variables for Docker Compose.

Run the following steps to edit the environment variables:

  1. Navigate to the docker_compose directory.

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

VariableDescriptionRequired
DOCKER_CLASSIFICATION_IMAGERepository path where the docker image of Classification Service is stored.Yes
DOCKER_PATTERN_PROVIDER_IMAGERepository path where the docker image of Pattern classification Service is stored.Yes
DOCKER_CONTEXT_PROVIDER_IMAGERepository path where the docker image of Context clarification Service is stored.Yes
DOCKER_NETWORK_NAMEName of the Docker network.No
PATTERN_PROVIDER_LOGGING_CONFIGa valid JSON python logging configuration for the Pattern Classification Provider.No
CONTEXT_PROVIDER_LOGGING_CONFIGa valid JSON python logging configuration for the Context Classification Provider.No
CLASSIFICATION_LOGGING_CONFIGa valid JSON python logging configuration for the Classification Service.No
ENABLE_ALL_SECURITY_CONTROLSControls whether security mitigations are enabled. Accepted values: true (default) or falseNo
  1. Save the changes.

3 - Viewing Application Logs

Viewing Docker Logs.

The application logs can be viewed using the following commands:

docker logs -f classification_service
docker logs -f context_provider
docker logs -f pattern_provider

Setting the Log Level and other logging configuration

The log level and other valid Python Logging configuration can be set in the .env file using JSON.

Run the following steps to set the overall logging level.

  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 PATTERN_PROVIDER_LOGGING_CONFIG, configure the parameter as follows.

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

  2. Run the folllwing command to undeploy the application.

docker compose down -d
  1. Run the following command to redeploy the application.
docker compose up -d

4 -

When running commands from inside the Docker network (for example, from another container), use the service name directly. This leverages Docker’s internal DNS. e.g.,

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

5 -

When running command from outside the docker network, e.g., from your host machine, use the published port mapping. e.g.,

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