Lab 10 - Deploying your retail web shop

Lab Goal

To deploy the retail web shop frontend application and run the online retail web shop demo

Retail web shop application

The online web shop frontend application is a source proejct you can download and build from scatch. Get the project in one of the two following ways:
  • $ git clone https://gitlab.com/bpmworkshop/rhdm-retail-webshop-frontend-repo.git
  • Download and unzip

Retail web shop application

Next step is to build the front end for your web shop. If you used the git clone option to get the code project:
  • $ cd rhdm-retail-webshop-frontend-repo
If you used the DOWNLOAD AND UNZIP option to get the code, unzip it and then:
  • $ cd rhdm-retail-webshop-frontend-repo-master
Finally, build the project with the following Maven command:
  • $ mvn clean install

Retail web shop application

After the build finishes, you'll find a new target directory with the deployable artifact labeled webstore-demo.war:

Retail web shop application

To deploy the built webshop application, copy it to the application server deployments directory as follows:
  • $ cp target/webstore-demo.war [path-to-project-root]/target/jboss-eap-7.2/standalone/deployments/

Retail web shop application

If you watch the server log from the console where you started the application server, you'll notice the application kicks of a lot of action:
17:15:38,486 INFO [org.jboss.as.repository] (DeploymentScanner-threads - 2) WFLYDR0001: Content added at location rhdm-install-demo/target/jboss-eap-7.2/standalone/data/content/be/29fc6a90596/content
17:15:38,488 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0027: Starting deployment of "webstore-demo.war" (runtime-name: "webstore-demo.war")

Retail web shop application

The server log should show the deployment of your webshop application end with something like this:
17:15:42,220 INFO [com.vaadin.cdi.internal.ContextDeployer] (ServerService Thread Pool -- 98) Mapping VaadinServlet to /*
17:15:42,220 INFO [com.vaadin.cdi.internal.ContextDeployer] (ServerService Thread Pool -- 98) Done deploying Vaadin UIs
17:15:42,221 INFO [org.wildfly.extension.undertow] WFLYUT0021: Registered web context: '/webstore-demo' for server 'default-server'
17:15:42,231 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0010: Deployed "webstore-demo.war" (runtime-name : "webstore-demo.war")

Welcome to the web shop

Open the online web shop application at:

Demo the web shop

We'll demo a shopper using the shopping cart and the shipping values being calculated by the decsion table we created:
  • select Forge Laptop Sticker and click ADD TO CART
  • shipping is 2.99, cart total is 8.50 + 2.99 = 11.49

Demo the web shop

Now go back to your project and change the shipping table value for tier 1:
  • login and open the guided decision table Shipping Rules
  • change Shipping Tier 1 Shipping Total value to 22.99

Demo the web shop

Now we are going to redeploy the rules with a new version:
  • Save the rule, open settings tab for retail-webshop project
  • Bump up the Version: 1.0.1 and SAVE settings

Demo the web shop

Deploy the new version of your rules project:
  • click the DEPLOY button and wait for green conformation pop-up
  • check the server log and you'll notice the KieScanner from your application picks up the new version of your rules you just deployed:
19:35:56,968 INFO [org.kie.api.builder.KieScanner] (Timer-2) The following artifacts have been updated: {com.redhat.demo.retail:retail-webshop:1.0.0=com.redhat. demo.retail:retail-webshop:jar:1.0.1}

Demo the web shop

Now let's see if the new rules are in effect without re-deploying our application, CLEAR the shopping cart and re-run scenario:
  • select Forge Laptop Sticker and click ADD TO CART
  • shipping is 22.99, cart total is 8.50 + 22.99 = 31.49

The End

This completes the workshop, thanks for your time and feedback is welcome!
Eric D. Schabell
Portfolio Architect Director
@ericschabell
http://schabell.org
More Red Hat Decision Manager Workshops

Red Hat Decision Manager Articles

Red Hat Decision Manager Demos