Connecting WB and KIE showcase docker images

2,799 views
Skip to first unread message

Bill S

unread,
Feb 23, 2016, 5:18:40 PM2/23/16
to Drools Setup
Hello,

I have seen similar questions but have not been able to work out a solution using Drools-WB.  FYI, I never heard the word "Drools" until about a week ago, so beginner is an understatement.

I am working on a simple prototype of Drools to make sure that it meets our needs, so for simplicity I have deployed the Docker Showcase images to a single host machine.  I have not made any changes to the images, just want to connect the WB to the KIE server and run some simple rules (via Rest).


But then when I try to attach to the "mortgage" example that is part of the showcase I do not get an endpoint.

Any help that can be provided would be appreciated.


Bill


Roger Martinez

unread,
Feb 24, 2016, 6:04:39 PM2/24/16
to Drools Setup
Hello Bill!

Welcome to the Drools experience, I'm sure you'll enjoy it :)

I have just done exactly what you try to do in my local, so I have refreshed the steps and it's working for me. This are the basic steps in order to setup an execution server and deploy the mortgages example:
  1. Run the Drools WB showcase image as:
    1. Option 1 - Daemon mode -> docker run -p 8080:8080 -p 8001:8001 -d --name drools-workbench jboss/drools-workbench-showcase:6.3.0.Final
    2. Option 2 - Interactive mode ( blocks the current session but you can see the logs in your console output ) -> docker run -p 8080:8080 -p 8001:8001 -t -i --name drools-workbench jboss/drools-workbench-showcase:6.3.0.Final
  2. Once your above container up, run the Execution Server, as specified in the docs, by linking the container with the above one -> 
    1. Option 1 - Daemon mode -> docker run -p 8180:8080 -d --name kie-server --link drools-workbench:kie_wb jboss/kie-server-showcase:6.3.0.Final
    2. Option 2 - Interactive mode -> docker run -p 8180:8080 -t -i --name kie-server --link drools-workbench:kie_wb jboss/kie-server-showcase:6.3.0.Final
    3. (You should see logs on the drools worbkench's container when the execution server gets connected)
  3. Navigate into the authoring area on the Drools WB
    1. Visit http://localhost:8080/drools-wb/
    2. Use admin/admin
    3. Home menu -> Authoring -> Project authoring
  4. Build & deploy the mortgages example project
    1. Click on mortgages project 
    2. Click on "Open Project Editor"
    3. On the top right corner, click on Build -> Build & deploy -> A notification alert should appear saying that all is OK ;)
    4. ( At this point your projects assets have been compiled and deployed in to the local workbench's Maven repository, so accessible for others now  )
  5. Deploy your assets onto the execution server
    1. Home menu -> Deploy -> Rule deployments
    2. ( By default you should see the execution sever registered )
    3. Click on "+" ( add )  icon located at the right side the registered execution server's row
    4. ( A popup appears for creating a container )
    5. Click on search -> You should see the mortgages on the results table, click on "Select" -> The inputs above are filled with this concrete artifact information, if no name is set, add a name -> Click on OK
    6. Now on the screen you should see another row below the execution server one, that is the one for your recently new container created -> Click on the "open" icon  located at the right side this row
At this point, you should see and screen like the following one, with an endpoint available, so you can just go ahead now:


Please try to check if your steps are correct and give us some feedback! Hope this helps!

Roger

asdasf

Roger Martinez

unread,
Feb 24, 2016, 6:16:36 PM2/24/16
to Drools Setup
I'm not sure how your run this environment, the easiest way is to use the docker containers linking feature as on the example here, but if you don't have used the link argument or don't want to use it for whatever reason, you have to consider that in order to communicate both applications you have to specify some controller URL's and configure the Maven settings as well. Here you can find a post that explains that. Hopes helping again! 


El martes, 23 de febrero de 2016, 23:18:40 (UTC+1), Bill S escribió:

Bill S

unread,
Feb 24, 2016, 6:59:40 PM2/24/16
to Drools Setup
Roger,

I did finally figure it out.  Part of the problem is that there are different instructions on different pages.  The GitHub page has the correct instructions (with the --link option) while the link on the Drools.org hub.docker is incorrect (no --link and pointing to 6.2.0 release).
 
Ha ha ha... that is funny.  I just looked at the hub.docker page, and it was updated 21 hours ago with the correct information.

Bill

Roger Martinez

unread,
Feb 24, 2016, 8:15:11 PM2/24/16
to Drools Setup
Hi Bill,

No problem! :) 

The images are pushed using the docker hub automated builds, but it's not under my control and sometimes I realized that the docs ( due to the internal project structure ) are not on the right place when deployed  in docker hub. I added on the "short description" of each image page the link to the GitHub docs so people can redirect there when this happens. The last commit was 3 months ago! so not sure while the automated build has broken the docs 21 days ago..:( 

Sorry for the inconveniences! Will send an email to the docker team asking about it, thanks for the feedback!

Roger

Sasha S

unread,
Jul 20, 2016, 2:53:10 AM7/20/16
to Drools Setup
Hi Roger,

I have some another problem with execution of drools-workbench-showcase and kie-server-showcase docker images in conjunction on the same server.
I have started it according to the documentation:

docker run -p 8080:8080 -p 8001:8001 -d --name drools-workbench-showcase jboss/drools-workbench-showcase:6.4.0.Final
docker run -p 8180:8080 -d --name kie-server --link drools-workbench-showcase:kie_wb jboss/kie-server-showcase:6.4.0.Final

It looks fine till creation of the new container. I see the successfully started container from UI:


But it shows me no running containers via the REST Api of Kie Server:
HTTP/1.1 200 OK
Expires: 0
Cache-Control: no-cache, no-store, must-revalidate
X-Powered-By: Undertow/1
Server: WildFly/8
Pragma: no-cache
Date: Tue, 19 Jul 2016 15:39:35 GMT
Connection: keep-alive
Content-Type: application/xml
Content-Length: 149

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="List of created containers">
    <kie-containers/>
</response>

Looks like the reason is port forwarding in Docker, etc. Kie Server exposes itself running on port 8080, despite the fact that it on 8180 outside of the docker container.
Can I do something with it? Should I change some way the org.kie.server.location property inside kieserver docker container?



Roger Martinez

unread,
Jul 20, 2016, 2:56:07 PM7/20/16
to Drools Setup
Hello!

Thanks for the feedback, yeah you're right, there is an issue just opened here -> https://github.com/jboss-dockerfiles/drools/issues/13

As you can see, this guys has same error, the generated URL is something like "http://:8080/...", so the hostname is not added into the generated kie-server URLs. We are just fixing it, the problem is that the base jboss image has been moved to centos:7 and our startup script was build considering a fedora base, not centos, so it's generating a wrong url for the host.

Please keep updated on https://github.com/jboss-dockerfiles/drools/issues/13 as we're going to fix it during next days.

Thanks!
Roger

Sasha S

unread,
Jul 21, 2016, 5:02:49 AM7/21/16
to Drools Setup
Hi Roger,
First of all thank you for the quick response.

Second, I tried to investigate the problem and fixed manually the start_kie-server.sh file. 
>>>
# If this KIE execution server container is linked with some KIE Workbench container, the following environemnt variables will be present, so configure the application arguments based on their values.
if [ -n "$KIE_WB_PORT_8080_TCP" ] &&  [ -n "$KIE_WB_ENV_KIE_CONTEXT_PATH" ] &&  [ -n "$KIE_WB_PORT_8080_TCP_ADDR" ]; then
    # Obtain current container's IP address.
    #DOCKER_IP=$(ip addr show eth0 | grep -E '^\s*inet' | grep -m1 global | awk '{ print $2 }' | sed 's|/.*||')
    DOCKER_IP=myExternalHost.com
    DOCKER_PORT=8180
    # KIE Workbench environment variables are set. Proceed with automatic configuration.
    echo "Detected successfull KIE Workbench container linked. Applying automatic configuration for the linked containers..."
    export KIE_SERVER_LOCATION="http://$DOCKER_IP:$DOCKER_PORT/$KIE_CONTEXT_PATH/services/rest/server"
    export KIE_SERVER_CONTROLLER="http://$KIE_WB_PORT_8080_TCP_ADDR:8080/$KIE_WB_ENV_KIE_CONTEXT_PATH/rest/controller"
    export KIE_MAVEN_REPO="http://$KIE_WB_PORT_8080_TCP_ADDR:8080/$KIE_WB_ENV_KIE_CONTEXT_PATH/maven2"
fi
>>>

Now it creates correct KIE_SERVER_LOCATION (after container restart), but the main problem remains the same, I see successfully started container in WB UI, but when using the rest API of KIE Server:

curl -i 'http://myExternalHost.com:8180/kie-server/services/rest/server/containers' -u kieserver:kieserver1!
HTTP/1.1 200 OK
Expires: 0
Cache-Control: no-cache, no-store, must-revalidate
X-Powered-By: Undertow/1
Server: WildFly/8
Pragma: no-cache
Date: Thu, 21 Jul 2016 08:53:33 GMT
Connection: keep-alive
Content-Type: application/xml
Content-Length: 149

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="List of created containers">
    <kie-containers/>
</response>

There are no containers exist!
I thought, that the problem may be in my own Project, so I have built and started the supported mortgages:mortgages:0.0.1 example project, but the result is same.


Roger Martinez

unread,
Jul 21, 2016, 3:46:42 PM7/21/16
to Drools Setup
Hi Sasha,

Thanks for keep trying :) 

Tbh not sure yet why you don't obtain containers using the REST endpoint, but anyway there were some bugs on the images that probably were causing it. I have just merged and fired the builds on dockerhub for latest 6.4.0.Final-1 image tags, they'll be available in a few hours.

I have tried the scenario locally with new image tags and the result was successfull, see next lines ( take in account that I have used the public bind address for the container 0.0.0.0 ):

roger@roger:~$ curl -i 'http://0.0.0.0:8180/kie-server/services/rest/server/containers' -u kieserver:kieserver1!
HTTP/1.1 200 OK
Expires: 0
Cache-Control: no-cache, no-store, must-revalidate
X-Powered-By: Undertow/1
Server: WildFly/8
Pragma: no-cache
Date: Thu, 21 Jul 2016 18:46:54 GMT
Connection: keep-alive
Content-Type: application/xml
Content-Length: 964

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="List of created containers">
    <kie-containers>
        <kie-container container-id="testc" status="STARTED">
            <messages>
                <content>Container testc successfully created with module mortgages:mortgages:0.0.1.</content>
                <severity>INFO</severity>
                <timestamp>2016-07-21T18:45:00.190Z</timestamp>
            </messages>
            <release-id>
                <artifact-id>mortgages</artifact-id>
                <group-id>mortgages</group-id>
                <version>0.0.1</version>
            </release-id>
            <resolved-release-id>
                <artifact-id>mortgages</artifact-id>
                <group-id>mortgages</group-id>
                <version>0.0.1</version>
            </resolved-release-id>
            <scanner status="DISPOSED"/>
        </kie-container>
    </kie-containers>
</response>

Please, pull new docker tags when possible and try again, let's see if the issue is now solved. Note that you can undo your local change for the DOCKER_IP env on the script, it's fixed as well on latest tags.

Thanks!
Roger

Sasha S

unread,
Jul 24, 2016, 5:17:16 AM7/24/16
to Drools Setup
Hi Roger,

Thank you for the answers. Can you explain, please how can I pull the updated Docker Images.
Till now I tried to run the "latest" version, but, perhaps, this is the same 6.4.0.Final version? Should I wait for the next official release of WB & KIE Server containers?
Especially I need "rest-all" role for admin (WB) to be able to build & deploy my projects stored in Git of WB to Maven Repository.
You are right, practically I don't need Workbench Deploy UI, since I can manage containers and fire the rules via the Rest Api only. 

Nevertheless, I have examined more the synchronization issue between Workbench Deploy UI (as KIE Server controller) and rest API of the Kie Server and found the following strange behavior:
Step 1:
I have created the new Container M1 via WB GUI, but I can't view it via Rest API. At this stage I was reported you in the last mails.
Step 2: 
I tried to create the second new Container "MyRESTContainer", but this time via Rest API.
I have executed:
    curl -v -H "Content-Type: application/xml" -X PUT --data "@data.xml" -u kieserver:kieserver1! 'http://localhost:8180/kie-server/services/rest/server/containers/MyRESTContainer'
with the following data.xml file:

<kie-container container-id="MyRESTContainer" status="RUNNING">
<release-id>
  <group-id>com.traiana.pocs</group-id>
  <artifact-id>DroolsPOC1</artifact-id>
  <version>1.0.1</version>
</release-id>
<resolved-release-id>
  <group-id>com.traiana.pocs</group-id>
  <artifact-id>DroolsPOC1</artifact-id>
  <version>1.0.1</version>
</resolved-release-id>
</kie-container>

Here the magic: Now I can see the both running container via the rest Api:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="List of created containers">
    <kie-containers>
        <kie-container container-id="M1" status="STARTED">
            <messages>
                <content>Container M1 successfully created with module mortgages:mortgages:0.0.1.</content>
                <severity>INFO</severity>
                <timestamp>2016-07-21T14:29:26.754Z</timestamp>
            </messages>
            <release-id>
                <artifact-id>mortgages</artifact-id>
                <group-id>mortgages</group-id>
                <version>0.0.1</version>
            </release-id>
            <resolved-release-id>
                <artifact-id>mortgages</artifact-id>
                <group-id>mortgages</group-id>
                <version>0.0.1</version>
            </resolved-release-id>
            <scanner status="DISPOSED"/>
        </kie-container>
        <kie-container container-id="MyRESTContainer" status="STARTED">
            <messages>
                <content>Container MyRESTContainer successfully created with module com.traiana.pocs:DroolsPOC1:1.0.1.</content>
                <severity>INFO</severity>
                <timestamp>2016-07-21T14:38:08.215Z</timestamp>
            </messages>
            <release-id>
                <artifact-id>DroolsPOC1</artifact-id>
                <group-id>com.traiana.pocs</group-id>
                <version>1.0.1</version>
            </release-id>
            <resolved-release-id>
                <artifact-id>DroolsPOC1</artifact-id>
                <group-id>com.traiana.pocs</group-id>
                <version>1.0.1</version>
            </resolved-release-id>
        </kie-container>
    </kie-containers>
</response>

But the funny side, is that I still see only the first container via Workbench Deploy UI.

Conclusion:
The both APIs are not so synchronized at this stage and I should use only Rest API to be not confused.

 

Roger Martinez

unread,
Jul 24, 2016, 5:30:33 PM7/24/16
to Drools Setup
Hi Sasha,

The community docker images for 6.4.0.Final where updated last week with some fixes and improvements, so there is a new tag named "6.4.0.Final-1". You can use both commands:
- docker pull jboss/drools-workbench-showcase ( default to latest tag ) 
- docker pull jboss/drools-workbench-showcase:6.4.0.Final-1

The latest tag should point to same code as 6.4.0.Final-1, if you see different content please let us know! :)

About the strange behavior on the execution servers remote API, I'm not the right person for this sorry, can u please create a new post using a title references this concrete issue, so the team mates that takes care of this, or just report an issue on http://issues.jboss.org/ for the jBPM project?

Thanks!
Roger

Maciej Swiderski

unread,
Jul 25, 2016, 5:36:16 AM7/25/16
to drools...@googlegroups.com
make sure you look at the Runtime Servers in the Server Managment UI as then it will present all containers on given kie server instance. Assuming it is running in managed mode.

Maciej
--
You received this message because you are subscribed to the Google Groups "Drools Setup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-setup...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-setup/cbd2d502-9feb-4605-808e-4f2ae8219f10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages