Check how you can use OpenShift Pipelines (a.k.a Tekton) to automate the delivery of decision services implemented with Red Hat PAM (a.k.a. jBPM). In this showcase you can see:
- The automation of repeatable decisions using the DMN specification;
- Decision tables implementation using XLS.
- Usage of the rules engine based on KIE Server and running on top of SpringBoot;
- CI/CD Pipeline implemented using Tekton;
- How to configure webhooks in your pipeline to deploy based on changes on a git repository;
- Automated tests for decisions (with Test Scenarios ) that are considered during the pipeline execution;
- Deployment with zero downtime with OpenShift rolling deployment strategy;
-
Java 8
-
OpenShift 4.7
-
oc client
-
Fork this repository, in jbossdemocentral.
-
Clone your fork to your local machine.
$ git clone https://github.com/${yourgithubuser}/business-automation-showcase.git $ cd business-automation-showcase
-
Run the provisioning script (Linux/MacOS):
$ sh provision.sh
At the end you'll get two URLs: one to a client web application and one to use in the GitHub integration settings. Something like:
******************************************************************
Use this URL in your GitHub Webhook configuration for automatic deployment
http://el-ba-cicd-event-listener-rhdm-kieserver-cicd.apps.cluster- (...)
Use this URL to access the front-end application:
http://business-application-webclient-rhdm-kieserver-cicd.apps.cluster- (...)
******************************************************************
-
To configure the webhook for automated deployment, open your fork in your GitHub. Next, add a new webhook by opening "Settings -> Webhook -> Add webhook button".
-
Fill the form with the information below:
- Payload URL: provided after the provisioning. You can also get it using the command:
$ echo "$(oc get route el-ba-cicd-event-listener --template='http://{{.spec.host}}')"
- Content type:
application/json
- Secret: empty
- "Which events would you like to trigger this webhook?:
Just the push event
.
- Payload URL: provided after the provisioning. You can also get it using the command:
At this point, you should already have a fully automated integration and deployment lifecycle for the business application. Any changes pushed to your repository will trigger the pipeline in your OpenShift cluster.
If you run this test, a new deployment should be triggered. The pipeline will deploy the decision service for the first time.
-
In your terminal, access your project folder.
-
Commit and push. You can use this empty commit sample if you need:
git commit -m "an empty commit to test the pipeline" --allow-empty git push origin master
-
In OpenShift, access: "Pipelines -> ba-cicd-pipeline -> Pipeline Runs " and check the progress of your application deployment.
The web application allows you to interact with the deployed rules and decisions in a specific KIE Server. To use the deployed web app to interact with the deployed decisions, first you need to set the KIE Server URL in the web app settings.
-
The deployed decision service is now deployed and accessible. Get your deployed KIE Server route. You can use the command:
echo "http://"$(oc get route business-application-service-route -n rhdm-kieserver-cicd | awk 'FNR > 1 {print $2}')"/rest/server"
-
Open your web application. The URL was provided in the installation step. If you lost it, use the command
oc get route business-application-webclient --template='http://{{.spec.host}}' -n rhdm-kieserver-cicd
-
In the web application, click on the settings icon on the top right corner. In the field
Kie Server Base URL
, insert KIE Server URL. -
You can use the "Test Connection" button to validate the communication between the two services, then Save.
-
You should be able to test the available decisions and rules.
With this, the whole demo is now set up and ready to use.
The provisioning script provision.sh
will:
- Create a new namespace called rhdm-kieserver-cicd
- Install OpenShift Pipelines
- Create the pipeline resources
- Deploy a front-end application that you can use to interact with the decision service once you deploy it.
At the moment there are 5 projects in this repository:
- decisions-showcase: Decision use cases using Business Rules (Drools) and Decision Logic (DMN)
- business-application-service: Spring Boot runtime based Kie Server exposing the API for Decisions and Processes
- business-application-webclient: ReactJS Web client App UI used to interact with the Kie Server API to exercise the Use Cases provided with this Showcase demo
- cicd: Tekton Pipeline resources to implement a fully automated CI/CD pipeline for your Business Application Services
- monitoring: working in progress...
To see a detailed instruction on each service and each deployment processes (with images), check: