This backend is to serve (data to) the UI for Custom Policies
For some functionality it relies on the Engine part.
To get started (locally) you can build a local docker image with Postgres, that has example tables set up and then run this via Docker-Compose, which starts Postgres and a local Kafka instance for use with the Engine.
cd helpers
sh build-local-pg.sh
docker-compose up
The UI backend is written in Java and can be compiled via
mvn package
Which also runs some Rest-API tests (under the hood it starts a postgres instance in a container).
When developing you can use Quarkus hot-reload
mvn compile quarkus:dev
The backend requires a valid x-rh-identity
to be supplied on calls.
For testing purposes you can take the one that is stored in
link:src/test/resources/rhid.txt
curl -Hx-rh-identity:`cat src/test/resources/rhid.txt` http://localhost:8080/api/custom-policies/v1.0/policies/<id> # id = 1 or 2
curl -Hx-rh-identity:`cat src/test/resources/rhid.txt` http://localhost:8080//api/custom-policies/v1.0/facts
OpenAPI spec of the API is available under http://localhost:8080/api/custom-policies/v1.0/openapi.json
When the server is running in dev mode, there is also the Swagger-UI available under http://localhost:8080/swagger-ui/