Open Editions

 View Only

Use OpenShift CLI to setup IBM PAM Open Editions

By Marco Antonioni posted Sun October 09, 2022 06:06 AM

  

Introduction

IBM Process Automation Manager Open Edition (PAM) and IBM Decision Manager Open Edition (DM) are application development platforms for developers to create highly customized, modern, cloud-native applications that automate business operations.
These platforms are built on open source projects: Drools, jBPM and Kogito.

IBM Process Automation Manager is an Open-Source platform for modeling and automating business processes, including case and decision support.


Purpose of this article

The purpose of this article is to demonstrate how easy it is to setup one or more development environments of "IBM PAM Open Edition" in an OpenShift cluster.

We will use the "IBM Business Automation" resources in YAML format.

The example assumes that the Openshift cluster has connectivity to the public network and therefore you will not need to perform any downloads; the operator will take care of all installation and configuration activities.

In these examples we will use only the OpenShift CLI interface to install and configure the development environment.


Prerequisites

A little bit of knowledge about OCP commands using the console.
An Openshift cluster (you will need a new namespace so if you don't have admin privileges ask to your admin for a new namespace administered by you).
Very little disk space and free memory on the cluster.
20 minutes of your free time to complete the setup and the scenarios


Overview of YAML resources

The resources that we are going to use to create a development environment are described by the YAML format and refer to the OperatorGroup, Subscription and KieApp, the first two identify the operator and relative subscription which, when properly feed by a KieApp configuration, will create and configure all the pods necessary for correct operations of a work environment.

Resources definition and details are available at https://github.com/kiegroup/kie-cloud-operator

In this post the focus is on automating the setup and therefore we will work with the yaml format.
These are the three skeletons of the resources we will use

# OperatorGroup
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  generateName:
  name:
spec:
  targetNamespaces:
    -

# Subscription
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name:
spec:
  channel:
  installPlanApproval:
  name:
  source:
  sourceNamespace:
  startingCSV:

# KieApp
apiVersion: app.kiegroup.org/v2
kind: KieApp
metadata:
  name:
  namespace:
spec:
  commonConfig:
    adminPassword:
    adminUser:
  objects:
    servers:
      - name:
        id:
        replicas:
    upgrades:
      enabled:
      minor:
    environment:


Install the operator

Now let's start installing the resources.
Log in to the Openshift cluster with your credentials.

oc login <your-ocp-cluster-host-name>:<port> --username=<your-user-id> --password=<your-pass>


Create a namespace within which to deploy the development environment or ask to your cluster administrator for a new namespace you may administer.

# set env var and create the namespace
TNS=my-ibamoe-cli
oc new-project ${TNS}


If you have admin rights and you want to know what resources will be installed into your cluster execute this command before installing the IBM BAM OE resources

echo "CRD total in your cluster: "$(oc get crd | wc -l)
echo "CRD total KieGroup: "$(oc get crd | grep kie | wc -l)

oc get $(oc get crd -o=custom-columns=CR_NAME:.spec.names.singular --no-headers | awk '{printf "%s%s",sep,$0; sep=","}') --ignore-not-found -o=custom-columns=KIND:.kind,NAME:.metadata.name,NAMESPACE:.metadata.namespace | grep -E 'bamoe|kie'
oc get Subscription -A | grep bamoe


You should see zero CRD for KieGroup, otherwise it means previous installations have been done.


Create the development environment

# enter the namespace
oc project ${TNS}

# set env vars for Environment Type
ENV_TYPE=rhpam-trial

# set env vars for KieApp (for a minimal setup)
APP_NAME=my-rhpam
APP_ADMINUSER=admin
APP_ADMINPASSW=passw0rd


Now with a single smart command we will create the resources into the selected namespace (OperatorGroup, Subscription for stable version 8 channel and later the KieApp).


echo "
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  generateName: my-ibamoe-operator-
  name: my-ibamoe-operator-marco
spec:
  targetNamespaces:
    - ${TNS}
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: bamoe-businessautomation-operator
  namespace: ${TNS}
spec:
  channel: 8.x-stable
  installPlanApproval: Automatic
  name: bamoe-businessautomation-operator
  source: redhat-operators
  sourceNamespace: openshift-marketplace
  startingCSV: bamoe-businessautomation-operator.8.0.0-1
" | oc create -f -


Use the following command to verify the operator status

oc get ClusterServiceVersion | grep Succeeded

Wait until the operator get to Succeeded status

output: 'bamoe-businessautomation-operator.8.0.0-1 IBM Business Automation 8.0.0-1 Succeeded'

then create the KieApp resource with the following command

echo "
apiVersion: app.kiegroup.org/v2
kind: KieApp
metadata:
  name: my-rhpam
  namespace: ${TNS}
spec:
  commonConfig:
    adminPassword: ${APP_ADMINPASSW}
    adminUser: ${APP_ADMINUSER}
  objects:
    servers:
      - name: my-server1
        id: my-server1-id
        replicas: 1
    upgrades:
      enabled: true
      minor: true
    environment: ${ENV_TYPE}
" | oc create -f -


Verify the creation of KieApp resource

oc get KieApp

output: 'my-rhpam 8.0.0 rhpam-trial Deployed 18s'

Then list the pods

oc get pods

output like this

NAME                                                   READY STATUS RESTARTS AGE
bamoe-business-automation-operator-6f59c4cd89-67hpb    1/1   Running 0 5m18s
console-cr-form                                        2/2   Running 0 4m34s
my-rhpam-rhpamcentr-1-bwwrf                            0/1   ContainerCreating 0 19s
my-rhpam-rhpamcentr-1-deploy                           1/1   Running 0 25s
my-server1-1-deploy                                    1/1   Running 0 25s
my-server1-1-hx75r                                     0/1   ContainerCreating 0 18s


Wait until all pods get to Running status

Now you may want to rerun the following commands to investigate about the new installed resources

echo "CRD total in your cluster: "$(oc get crd | wc -l)
echo "CRD total KieGroup: "$(oc get crd | grep kie | wc -l)

oc get $(oc get crd -o=custom-columns=CR_NAME:.spec.names.singular --no-headers | awk '{printf "%s%s",sep,$0; sep=","}') --ignore-not-found -o=custom-columns=KIND:.kind,NAME:.metadata.name,NAMESPACE:.metadata.namespace | grep -E 'bamoe|kie'
oc get Subscription -A | grep bamoe


Now you should see something like this

[marco@rhbox ibamoe]$ echo "CRD total KieGroup: "$(oc get crd | grep kie | wc -l)
CRD total KieGroup: 1

[marco@rhbox ibamoe]$ oc get $(oc get crd -o=custom-columns=CR_NAME:.spec.names.singular --no-headers | awk '{printf "%s%s",sep,$0; sep=","}') --ignore-not-found -o=custom-columns=KIND:.kind,NAME:.metadata.name,NAMESPACE:.metadata.namespace | grep -E 'bamoe|kie'
APIRequestCount kieapps.v2.app.kiegroup.org <none>
ClusterServiceVersion bamoe-businessautomation-operator.8.0.0-1 my-ibamoe-cli
ConsoleLink my-ibamoe-cli-link-my-rhpam <none>
ConsoleYAMLSample kieapp-kafka-config <none>
ConsoleYAMLSample kieapp-rhdm-authoring <none>
ConsoleYAMLSample kieapp-rhdm-authoring-ha <none>
ConsoleYAMLSample kieapp-rhdm-production-immutable <none>
ConsoleYAMLSample kieapp-rhdm-production-immutable-jms <none>
ConsoleYAMLSample kieapp-rhdm-trial <none>
ConsoleYAMLSample kieapp-rhpam-authoring <none>
ConsoleYAMLSample kieapp-rhpam-authoring-ha <none>
ConsoleYAMLSample kieapp-rhpam-process-migration <none>
ConsoleYAMLSample kieapp-rhpam-production <none>
ConsoleYAMLSample kieapp-rhpam-production-immutable <none>
ConsoleYAMLSample kieapp-rhpam-production-immutable-jms <none>
ConsoleYAMLSample kieapp-rhpam-standalone-dashbuilder <none>
ConsoleYAMLSample kieapp-rhpam-trial <none>
ConsoleYAMLSample kieapp-snippet-common-config <none>
ConsoleYAMLSample kieapp-snippet-controller-based-startup-strategy <none>
......
ConsoleYAMLSample kieapp-snippet-use-imagetags <none>

InstallPlan install-2ncp2 my-ibamoe-cli
KieApp my-rhpam my-ibamoe-cli
OperatorCondition bamoe-businessautomation-operator.8.0.0-1 my-ibamoe-cli
OperatorGroup my-ibamoe-operator-marco my-ibamoe-cli
Operator bamoe-businessautomation-operator.my-ibamoe-cli <none>
Project my-ibamoe-cli <none>
ServiceMonitor bamoe-business-automation-operator-metrics my-ibamoe-cli
Subscription bamoe-businessautomation-operator my-ibamoe-cli

[marco@rhbox ibamoe]$ oc get Subscription -A | grep bamoe
my-ibamoe-cli bamoe-businessautomation-operator bamoe-businessautomation-operator redhat-operators 8.x-stable


Now that your environment is ready, let's import a sample application and then deploy it on the runtime server with subsequent checks via the server log file.


Use Business Center to deploy a new app and run some process instances

Get the routes with following command

oc get routes

You should see something like this

NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
console-cr-form console-cr-form-my-ibamoe-cli.itzroks-120000c7nk-n5nfhl-6ccd7f378ae819553d37d5f2ee142bd6-0000.eu-gb.containers.appdomain.cloud console-cr-form <all> reencrypt None
my-rhpam-rhpamcentr my-rhpam-rhpamcentr-my-ibamoe-cli.itzroks-120000c7nk-n5nfhl-6ccd7f378ae819553d37d5f2ee142bd6-0000.eu-gb.containers.appdomain.cloud my-rhpam-rhpamcentr https passthrough/Redirect None
my-rhpam-rhpamcentr-http my-rhpam-rhpamcentr-http-my-ibamoe-cli.itzroks-120000c7nk-n5nfhl-6ccd7f378ae819553d37d5f2ee142bd6-0000.eu-gb.containers.appdomain.cloud my-rhpam-rhpamcentr http None
my-server1 my-server1-my-ibamoe-cli.itzroks-120000c7nk-n5nfhl-6ccd7f378ae819553d37d5f2ee142bd6-0000.eu-gb.containers.appdomain.cloud my-server1 https passthrough/Redirect None
my-server1-http my-server1-http-my-ibamoe-cli.itzroks-120000c7nk-n5nfhl-6ccd7f378ae819553d37d5f2ee142bd6-0000.eu-gb.containers.appdomain.cloud my-server1 http None

Use the URL of 'my-rhpam-rhpamcentr' route for https protocol, for example
https://my-rhpam-rhpamcentr-my-ibamoe-cli.itzroks-120000c7nk-....-0000.eu-gb.containers.appdomain.cloud

You should see in your browser 'Your connection is not private', authorize and access the Business Center console
Then login using the credentials you have set in APP_ADMINUSER and APP_ADMINPASSW env vars.

Select Design tile, then select MySpace.
Click Try Samples button and select an application, for example Mortgage_Process, click Ok button (upper right side) and wait until all resources have been imported.
Have a look at 'MortgageApprovalProcess' Business Process if you are curious to see the BPMN diagram.
Click back to 'Mortgage_Process' in 'Spaces MySpace Mortgage_Process master MortgageApprovalProcess' breadcrumbs menu.
The click Build and wait for completion message.

Now before deploy the app use the CLI with the following command (adjust the pod name suffix, use 'oc get pods' to get the pods list)
Then show logs from server pod using the command

oc logs -f my-server1-1-hx75r

The command will follow the pod log.

Now back in the browser and click 'Deploy' button, look at log you should see some new lines with

...
07:24:29,085 INFO [org.kie.server.services.openshift.impl.OpenShiftStartupStrategy] (OkHttp https://172.21.0.1/...) KieServer: kieserver-85c1c934-036c-4a58-914d-9c7afe33fc6b, DC rollout - Begin
07:24:29,860 INFO [org.kie.server.services.openshift.impl.OpenShiftStartupStrategy] (OkHttp https://172.21.0.1/...) Triggering rollout for DeploymentConfig: my-server1
07:24:32,079 INFO [org.drools.compiler.kie.builder.impl.InternalKieModuleProvider] (default task-4) Creating KieModule for artifact mortgage-process:mortgage-process:1.0.0-SNAPSHOT
...

the pod will be killed and a new one spin up in few seconds, get the new pod name then get logs and grep for 'mortgage-process:mortgage-process:1.0.0-SNAPSHOT', the pod is serving the app.

[marco@rhbox ibamoe]$ oc logs my-server1-2-7c78x | grep 'mortgage-process:mortgage-process:1.0.0-SNAPSHOT'
KieContainerResource [containerId=mortgage-process_1.0.0-SNAPSHOT, releaseId=mortgage-process:mortgage-process:1.0.0-SNAPSHOT, resolvedReleaseId=null, status=STARTED]
07:25:27,575 INFO [org.drools.compiler.kie.builder.impl.InternalKieModuleProvider] (ServerService Thread Pool -- 89) Creating KieModule for artifact mortgage-process:mortgage-process:1.0.0-SNAPSHOT
07:25:27,586 INFO [org.drools.modelcompiler.CanonicalKieModuleProvider] (ServerService Thread Pool -- 89) No executable model found for artifact mortgage-process:mortgage-process:1.0.0-SNAPSHOT. Falling back to resources parsing.
07:25:32,069 INFO [org.kie.server.services.impl.KieServerImpl] (ServerService Thread Pool -- 89) Container mortgage-process_1.0.0-SNAPSHOT (for release id mortgage-process:mortgage-process:1.0.0-SNAPSHOT) successfully started

Use the 'Home >> Manage Process Instances' page from Business Central to start a new process instance and then complete the process.


Conclusions

As you have seen, starting to use a development environment in an OpenShift cluster is really simple and allows each developer to create multiple work environments.

In a centralized development environment on OpenShift, each setup activity can be automated, thus achieving high levels of automation and productivity.
Furthermore, even the eventual turnover of the developers will not involve wasting time for the classic initial setup of work, the versions used by the various developers will always be aligned in order to eliminate any risk deriving from private configurations of the individual developer.


References

IBM Expands Business Automation Portfolio with Open Source Process and Decision Automation
https://www.ibm.com/cloud/blog/announcements/ibm-expands-business-automation-portfolio-with-open-source-process-and-decision-automation

Getting started with IBM Business Automation Manager Open Editions
https://www.ibm.com/docs/en/ibamoe?topic=getting-started-business-automation-manager-open-editions

IBM Business Automation Manager Open Editions 8.0 download document
https://www.ibm.com/support/pages/node/6596913

Deploying IBM Business Automation Manager Open Editions on Red Hat OpenShift Container Platform
https://access.redhat.com/documentation/en-us/ibm_business_automation_manager_open_editions/8.0/html/deploying_ibm_business_automation_manager_open_editions_on_red_hat_openshift_container_platform/index

Developing process services in IBM Business Automation Manager Open Editions
https://access.redhat.com/documentation/en-us/ibm_business_automation_manager_open_editions/8.0/html-single/developing_process_services_in_ibm_business_automation_manager_open_editions/index?_ga=2.175135970.1133731700.1663598949-1120342785.1663598949

Kie Cloud Operator in GitHub
https://github.com/kiegroup/kie-cloud-operator

My previous posts for this topic:

'Setup IBM Process Automation Manager Open Edition (PAM/DM) using docker images'
https://community.ibm.com/community/user/automation/blogs/marco-antonioni/2022/09/24/setup-ibm-process-automation-manager-open-edition

'Setup IBM Process Automation Manager Open Edition (PAM/DM) in OpenShift'
https://community.ibm.com/community/user/automation/blogs/marco-antonioni/2022/09/28/setup-ibm-process-automation-manager-open-edition


0 comments
37 views

Permalink