This is the multi-page printable view of this section. Click here to print.
Docker Compose
1 - Docker Compose Deployment
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 composecommand syntax. Ensure that the the installation supports this version.
For Apple Macbook users, refer Additional Notes.
Starting the Containers
- 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.
- 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
Run the following script to stop, remove the Docker services. Also, remove the created Docker network created.
docker compose downTo 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.
- Open Docker Desktop.
- Navigate to Settings > General.
- Enable Use Virtualization Framework and Use Rosetta for x86/amd64 emulation on Apple Silicon.
- 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
Run the following steps to edit the environment variables:
Navigate to the
docker_composedirectory.Open the
.envfile and set the following variables as required:
| Variable | Description | Required |
|---|---|---|
| DOCKER_CLASSIFICATION_IMAGE | Repository path where the docker image of Classification Service is stored. | Yes |
| DOCKER_PATTERN_PROVIDER_IMAGE | Repository path where the docker image of Pattern classification Service is stored. | Yes |
| DOCKER_CONTEXT_PROVIDER_IMAGE | Repository path where the docker image of Context clarification Service is stored. | Yes |
| DOCKER_NETWORK_NAME | Name of the Docker network. | No |
| PATTERN_PROVIDER_LOGGING_CONFIG | a valid JSON python logging configuration for the Pattern Classification Provider. | No |
| CONTEXT_PROVIDER_LOGGING_CONFIG | a valid JSON python logging configuration for the Context Classification Provider. | No |
| CLASSIFICATION_LOGGING_CONFIG | a valid JSON python logging configuration for the Classification Service. | No |
| ENABLE_ALL_SECURITY_CONTROLS | Controls whether security mitigations are enabled. Accepted values: true (default) or false | No |
- Save the changes.
3 - Viewing Application 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.
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 PATTERN_PROVIDER_LOGGING_CONFIG, configure the parameter as follows.
PATTERN_PROVIDER_LOGGING_CONFIG={"root":{"level":"ERROR"}}
Save the changes.
Run the folllwing command to undeploy the application.
docker compose down -d
- 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"