In 2016, I had the honor to work on writing some tutorials and onboarding documentations for the drools community.
My main contribution was on providing a GitBook book called droolsonboarding.
The book is divided in two parts : the first one is going through the main paradigms used when writing rules using the eclipse tooling and the second part is going through creating a drools project using the drools/kie workbench tooling.
In the current post, we are going to run that last part in a docker environnement.
The drools community is providing docker images to start with.
In the Chtjbug community, we build our own images with customized workbench and kie-server. Our customization mainly consists of plugins we added. In the next blog, I shall explain the kie-server runtime we created and in another blog the plugin we built for the workbench.
We assume here we have a docker environnement ready. In the gitbook, a chapter is present to explain how to install a docker machine on a windows environnement.
Once the needed software is installed, we can start a workbench
docker run -p 8080:8080 -p 8001:8001 -d --name kie-workbench chtijbug/kie-wb:latest
The we shall start the kie-serverdocker run -p 8180:8080 -d --name kie-server --link kie-workbench:kie_wb chtijbug/kie-server:latest
Please use the exact commands to avoid errors. The source code for building on your machine can be found here.We can now connect to the workbench at address http://192.168.99.100:8080/kie-wb. Adapt the url to the ip of your docker machine.
Once logged in (using admin as user name and admin as password),
we have to go on the Authoring/Project Authoring menu.
The following screen should appear :
The we shall select the onboarding-nautic-project and go in the package org/training/leisure/swimmingpool and the following screen should appear :
Now we shall build that project so it can be used by our execution server (kie-server). To do that, we shall push the "Open Project Editor" button.
Now just push the "Build" button and select "Build & Deploy" button.
A "Building .. "screen should appear and once done a popup should tell you "Build successful". Depending on the internet connection and cpu on which you are running, it may take a little time.
When we can select the "Deploy/Rule deployment" menu and the following should appear :
Note that we can see our kie-server that was added in the left list when it connected the first time.
We will now add a container for our rule project. To do that, push the "Add container" button or the "Add Container" in the left menu.
Enter "dev" as container name and select the second line in the "GAV"list. The screen should look like this :
Then push the "Finish" button.
The following screen should be displayed :
To start the container, we shall push the start button. After a few seconds, push the "Refresh" button and the following screen should be displayed :
The container is started and ready to work.
You can also select in the "Remote Servers" left menu, our kie-server, you should see the container we just created and started :
To test our container, we have deployed a small application for testing purpose : http://192.168.99.100:8180/swimmingpool-web. Adapt the ip to the one of your docker machine.
You should see the following screen :
Just press the "Calculate Price" button and the work should be done :
If you did the droolsonboarding gitbook example, you should recognize the message output. Change the quote date to /09/09/2016, and the Birthday promotion should be applied to the second person :
And the wonder of all that, is it works !!
In our next blog, we shall be much more technical on the kie-server part.












Aucun commentaire:
Enregistrer un commentaire