Skip to content

Instantly share code, notes, and snippets.

@r00ta
Last active February 6, 2022 16:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save r00ta/ad4776043da4ef836db552dca131b428 to your computer and use it in GitHub Desktop.
Save r00ta/ad4776043da4ef836db552dca131b428 to your computer and use it in GitHub Desktop.
END 2 END TRUSTY INFRASTRUCTURE TESTING

END 2 END TRUSTY INFRASTRUCTURE TESTING

In order to run this test, you have to setup your environment with java, mvn, docker and docker-compose. Tested with

  • openjdk 11.0.6 2020-01-14
  • apache-maven-3.6.3
  • Docker version 20.10.3, build 48d30b5
  • docker-compose version 1.25.2, build 698e2846.
  1. Clone the repositories kiegroup/kogito-runtimes, kiegroup/kogito-apps and kiegroup/kogito-examples. In addition to that, checkout to the release branch: for example if the release is 1.8.x, then run
git clone -b 1.8.x git@github.com:kiegroup/kogito-runtimes.git
git clone -b 1.8.x git@github.com:kiegroup/kogito-apps.git
git clone -b 1.8.x git@github.com:kiegroup/kogito-examples.git
  1. Compile kogito-runtimes and kogito-apps
mvn clean install -Dquickly -f kogito-runtimes/pom.xml
mvn clean install -DskipTests -f kogito-apps/pom.xml
  1. Ensure that explainability, trusty and trusty-ui images have been created with the command
docker images

the output should look like

REPOSITORY                                              TAG                  IMAGE ID       CREATED          SIZE
org.kie.kogito/trusty-ui                                1.8.0-SNAPSHOT       fdeea29feca3   53 seconds ago   302MB
org.kie.kogito/trusty-service-infinispan                1.8.0-SNAPSHOT       49f8e61ddab6   4 minutes ago    291MB
org.kie.kogito/explainability-service-messaging         1.8.0-SNAPSHOT       391cd64555bb   7 minutes ago    312MB
  1. Compile and build the docker image for the kogito-example dmn-tracing-quarkus with
mvn clean package -Dquickly -f kogito-examples/kogito-quarkus-examples/dmn-tracing-quarkus/pom.xml
docker build -t quay.io/test/dmn-tracing-quarkus:1.0.0 kogito-examples/dmn-tracing-quarkus/
  1. Edit the file kogito-examples/trusty-demonstration/docker-compose/docker-compose.yml and replace the kogito-app, explainability, trusty and trusty-ui images with the images you've just created.

  2. In the file kogito-examples/trusty-demonstration/docker-compose/docker-compose.yml, add the following env variable under the trusty-service spec:

TRUSTY_EXPLAINABILITY_ENABLED: "true"

Remember to replace in the following commands the release tag according to the release you are testing

sed -i 's/quay.io\/kiegroup\/kogito-explainability.*/org.kie.kogito\/explainability-service-messaging:1.8.0-SNAPSHOT/g' kogito-examples/trusty-demonstration/docker-compose/docker-compose.yml
sed -i 's/quay.io\/kiegroup\/kogito-trusty-infinispan.*/org.kie.kogito\/trusty-service-infinispan:1.8.0-SNAPSHOT/g' kogito-examples/trusty-demonstration/docker-compose/docker-compose.yml
sed -i '/QUARKUS_INFINISPAN_CLIENT_USE_AUTH.*/a \      TRUSTY_EXPLAINABILITY_ENABLED: "true"'  kogito-examples/trusty-demonstration/docker-compose/docker-compose.yml
sed -i 's/quay.io\/kiegroup\/kogito-trusty-ui.*/org.kie.kogito\/trusty-ui:1.8.0-SNAPSHOT/g' kogito-examples/trusty-demonstration/docker-compose/docker-compose.yml
sed -i 's/KOGITO_TRUSTY_ENDPOINT/KOGITO_TRUSTY_HTTP_URL/g' kogito-examples/trusty-demonstration/docker-compose/docker-compose.yml
sed -i 's/<your_namespace>/test/g' kogito-examples/trusty-demonstration/docker-compose/docker-compose.yml
  1. Run docker-compose
docker-compose -f kogito-examples/trusty-demonstration/docker-compose/docker-compose.yml up
  1. Wait until the applications are deployed. Ensure that trusty, trusty-ui, exaplainability and dmn-tracing-quarkus applications are up and running with
docker ps

the ouput should contain

40178dfef614   org.kie.kogito/trusty-ui:1.8.0-SNAPSHOT                          "java -Djava.util.lo…"   2 minutes ago   Up 2 minutes        8778/tcp, 9779/tcp, 0.0.0.0:1338->8080/tcp 
c390af97142b   org.kie.kogito/explainability-service-messaging:1.8.0-SNAPSHOT   "java -Djava.util.lo…"   2 minutes ago   Up 2 minutes        8778/tcp, 9779/tcp, 0.0.0.0:1336->8080/tcp 
fbdb71b52ec6   quay.io/test/dmn-tracing-quarkus:1.0.0                           "/usr/local/s2i/run"     2 minutes ago   Up 2 minutes        0.0.0.0:8080->8080/tcp                                                         
552551c42e6d   org.kie.kogito/trusty-service-infinispan:1.8.0-SNAPSHOT          "java -Djava.util.lo…"   About a minute ago   Up Less than a second   8778/tcp, 9779/tcp, 0.0.0.0:1337->8080/tcp
  1. Execute a decision
curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d \
  '{
  "Credit Score": 600,
  "Loan Amount": 300000,
  "Appraised Value": 500000,
  "Best Rate": 0.03,
  "Borrower": {
    "Monthly Income": 10000,
    "Monthly Other Debt": 1000
  }
}' http://localhost:8080/Prequalification
  1. Open http://localhost:1338/ and
  • check that the execution is present in the list
  • check that the outcomes of the decision are set
  • check that the explainability graph is present
  • check that the inputs are properly set in the UI
  • check that the model section is showing the model properly
  1. Once you are done, you can do a bit of cleanup with
rm -rf kogito-examples kogito-runtimes kogito-apps
docker rmi -f $(docker images | grep '1.8.0-SNAPSHOT' | awk '{str = sprintf("%s:%s", $1, $2)} END {print str}')

Note that the command above will remove all the docker images that contain 1.8.0-SNAPSHOT in the name. If you have any docker image that matches that and that you'd like to keep, don't use that command!

@manstis
Copy link

manstis commented Jul 14, 2021

I found mvn clean install -Dquickly -f kogito-apps/pom.xml did not generate any docker images.

I ran with mvn clean install -DskipTests within the kogito-apps folder and everything was OK.

@manstis
Copy link

manstis commented Jul 14, 2021

I had to tidy up docker a little more manually:

docker image prune --all
docker container prune
docker image prune --all

More convoluted but certainly emptied my local docker registry!

@r00ta
Copy link
Author

r00ta commented Oct 25, 2021

Thanks @manstis , I've updated the instructions!

@ruivieira
Copy link

@r00ta I think that in step 4.

  • mvn clean package -Dquickly -f kogito-examples/dmn-tracing-quarkus/pom.xml is now
  • mvn clean package -Dquickly -f kogito-examples/kogito-quarkus-examples/dmn-tracing-quarkus/pom.xml
    Thanks!

@r00ta
Copy link
Author

r00ta commented Feb 6, 2022

Thank you very much for the update @ruivieira 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment