Open Data Mesh Platform is a platform that manages the full lifecycle of a data product from deployment to retirement. It uses the Data Product Descriptor Specification to create, deploy and operate data product containers in a mesh architecture.
This repository contains an Adapter for OPA (i.e., Open Policy Agent) of the Policy Engine API service on the ODM Utility Plane.
*This project have dependencies from the project odm-platform
The project requires the following dependencies:
- Java 11
- Maven 3.8.6
- Project odm-platform
- OPA Rootless
This project need some artifacts from the odm-platform project.
Clone the repository and move to the project root folder
git git clone https://github.com/opendatamesh-initiative/odm-platform.git
cd odm-platform
Compile the project:
mvn clean install -DskipTests
*Dependencies must have been compiled to run this project.
Clone the repository and move to the project root folder
git git clone https://github.com/opendatamesh-initiative/odm-platform-adapter-validator-opa.git
cd odm-platform-adapter-validator-opa
Compile the project:
mvn clean package spring-boot:repackage -DskipTests
Run the application:
java -jar opa-policy-server/target/odm-platform-adapter-validator-opa-1.0.0.jar
Note: The application need a reachable OPA server listening on port 8181 to correctly work. See the section "Run OPA server" on how to run an OPA server with Docker.
To stop the application type CTRL+C or just close the shell. To start it again re-execute the following command:
java -jar opa-policy-server/target/odm-platform-adapter-validator-opa-1.0.0.jar
*Dependencies must have been compiled to run this project.
Clone the repository and move it to the project root folder
git git clone https://github.com/opendatamesh-initiative/odm-platform-adapter-validator-opa.git
cd odm-platform-adapter-validator-opa
Here you can find the Dockerfile which creates an image containing the application by directly copying it from the build executed locally (i.e. from target
folder).
You need to first execute the build locally by running the following command:
mvn clean package spring-boot:repackage -DskipTests
The image generated from Dockerfile contains only the application. It requires an OPA server to run properly. If you do not already have an OPA server available, you can create one by running the following commands:
docker run --name odm-opa-server -d -p 8181:8181 \
openpolicyagent/opa:latest-rootless \
run \
--server \
--log-level=debug \
--log-format=json-pretty \
--set=decision_logs.console=true
Check that the OPA server has started correctly:
docker logs odm-opa-server
Build the Docker image of the application and run it.
docker build -t odm-platform-up-validator-opa-server-app . -f Dockerfile
Run the Docker image.
Note: Before executing the following commands remove the argument --net host
if OPA server is not running on localhost
docker run --name odm-platform-up-validator-opa-server-app -p 9009:9009 --net host odm-platform-up-validator-opa-server-app
docker stop odm-platform-up-validator-opa-server-app
docker stop odm-opa-server
To restart a stopped application execute the following commands:
docker start odm-opa-server
docker start odm-platform-up-validator-opa-server-app
To remove a stopped application to rebuild it from scratch execute the following commands :
docker rm odm-platform-up-validator-opa-server-app
docker rm odm-opa-server
Create a .env
file in the root directory of the project similar to the following one:
OPA_PORT=8181
SPRING_PORT=9009
OPA_HOSTNAME="opa"
Run the docker-compose images.
docker-compose up
Stop the docker-compose images
docker-compose down
To restart a stopped application execute the following commands:
docker-compose up
You can invoke REST endpoints through OpenAPI UI available at the following url:
You can access to OPA Server browsing tho the following page: