Wednesday, April 5, 2017

How to Set-Up jBPM 6.5.0.Final (on WildFly 10.1.0.Final) Development Environment in Eclipse Neon

In this tutorial we are going to see how to set up jBPM 6.5.0.Final development environment locally. jBPM team did a excellent job by providing a complete jBPM 6.5.0.Final environment for you to just download and extract the jBPM 6.5.0.Final-installer-full.zip bundle and run the ant script, ant will take care of all the installation task for you...sounds interesting, please checkout jBPM document for further details. I highly recommend you to use the automated (ant script) jbpm-installer bundle provided by jBPM team.
For others those who prefer the manual installation, then proceed with the rest of the document.
Please download the following software in your local machine.....

kie-wb is a web based workbench or console, dashboard is for building business dashboards and reports and kie-server is the runtime execution server. All of these three components are web applications (war), it can be deploy into any java enabled server like IBM WebSphere, Oracle WebLogic, WildFly, Red Hat JBoss EAP and Apache Tomcat etc.

jBPM-6.5.0.Final on WildFly-10.1.0.Final integrated with Eclipse Neon development Environment

You have two options for developer process development environment, you can use kie workbench(kie-wb) or IDE like eclipse or JBoss developer studio for process development, also you can combine these two options (above diagram) for your convenience.
jBPM uses the JPA 2 to allow users to config whatever the datasource you want to use to persist runtime data. Out of the box jBPM uses h2 java SQL database for persisting runtime data. In this demo we use MySQL database for jBPM.
In my environment RHEL 7 is my operating system, you can use CentOS 7 alternatively if you don't have RHEL 7 installed.

1. Install JDK 8 and set CLASSPATH environment variable

1.1 If you don't have java installed in your system, In RHEL7/CentOS7, open a terminal and please type the following and enter,
                    yum install java-1.8.0-openjdk-devel
1.2 Setting java class path in RHEL 7 / CentOS 7.
In the terminal window, type the below and enter, make sure you enter the right java installed location, it will installed in the /usr/lib/jvm folder.

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-0.b14.el7_2.x86_64

export PATH=$PATH:$JAVA_HOME/bin

2. Install maven and and set CLASSPATH

2.1 To install maven, type the following command in terminal and enter

[root@localhost ~]# wget http://mirrors.gigenet.com/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip

2.2 Unzip into your development home folder(eg, /opt)

root@localhost ~]# unzip apache-maven-3.3.9-bin.zip -C /opt/

2.3 Setting maven in CLASSPATH, please type the following command in your terminal window and enter...

[psingaram@localhost apache-ant-1.9.7]$ export M2_HOME=/opt/apache-maven-3.3.9

[psingaram@localhost apache-ant-1.9.7]$ export M2=$M2_HOME/bin

[root@localhost opt]# PATH=$M2:$PATH


3. Install Eclipse Neon and install JBoss Integration Tools/plug-ins

3.1 To download eclipse neon, please type the following command and enter, this will download the eclipse neon into your local machine...
[root@localhost utils]# wget
http://ftp.jaist.ac.jp/pub/eclipse/technology/epp/downloads/release/neon/3/eclipse-jee-neon-3-linux-gtk-x86_64.tar.gz
3.2 Update eclipse.ini for java home, add the following line into your eclipse.ini file
-vm /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-0.b14.el7_2.x86_64/bin/java
3.3 Update eclipse neon with required development tools and plus-ins...
3.3.1 Install JBoss Tools 4.4.2.Final plugins
                    http://download.jboss.org/jbosstools/neon/stable/updates/
3.3.2 JBoss Tools Integration Stack 4.4.1.Final
         http://download.jboss.org/jbosstools/neon/stable/updates/integration-stack/
3.3.3 Update bpmn2 modeler site
          http://download.eclipse.org/bpmn2-modeler/updates/neon/1.3.2/
3.3.4 Update gef-sdk
                    https://hudson.eclipse.org/gef/job/gef4-maintenance/lastSuccessfulBuild/      /artifact/update-site/
3.3.5 Update drools-jbpm plugins…
         http://downloads.jboss.org/jbpm/release/6.5.0.Final/updatesite/

4.0 Install MySQL and configuration

4.1 To download and install mysql in your local machine, please type the following commands and type one by one in sequence...
  • wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
  • yum install mysql-community-release-el7-5.noarch.rpm
  • yum install mysql-server
  • mysql --version
4.2 Update mysql config file….
[root@localhost /]# vi /etc/my.cnf
[mysqld]
lower_case_table_names=1
character-set-server=utf8
collation-server=utf8_general_c
4.3 Start mysql, type the following command and enter..
       systemctl start mysqld
4.4 To check your mysql server status, please type the following and enter.
       systemctl status mysqld
4.5 Login to your newly installed mysql server using the following command and follow the commands for jbpm schema creation.
          mysql -u root -p
mysql> CREATE DATABASE jbpm;
mysql> use jbpm;
mysql> source /home/psingaram/Downloads/jbpm-installer/db/ddl-scripts/mysql5/mysql5-jbpm-schema.sql
mysql> source /home/psingaram/Downloads/jbpm-installer/db/ddl-scripts/mysql5/quartz_tables_mysql.sql
the above listed sql fils will be available from the following link...
https://github.com/kiegroup/jbpm/tree/master/jbpm-installer/src/main/resources/db/ddl-scripts/mysql5

5.0 Install WildFly 10.1.0.Final Application Server

5.1 Type the following command in your terminal and type the following command and enter
[root@localhost jbpm]# wget http://download.jboss.org/wildfly/10.1.0.Final/wildfly-10.1.0.Final.zip
5.2 Unzip WildFly into your local development home folder



5.3 Update hibernate.4.3.11 module
5.4 Update mysql module in WildFly server and configure mysql datasource
  • Navigate to your installed WildFly configuration folder..
             SERVER_HOME/standalone/configuration
  • Open the standalone-full.xml and locate the datasources subsystem (<subsystem xmlns="urn:jboss:domain:datasources:1.1">) and add the following subsystem for mysql
    <subsystem xmlns="urn:jboss:domain:datasources:1.1">
    <datasources>
    <datasource jndi-name="java:jboss/datasources/jbpmDS" pool-name="jbpmDS" enabled="true" use-java-context="true">
    <connection-url>jdbc:mysql://localhost:3306/jbpm</connection-url>
    <driver>mysql</driver>
    <security>
     <user-name>{username}</user-name>
     <password>{password}</password>
     </security>
     </datasource>
     <drivers>
    <driver name="mysql" module="com.mysqldatabase.mysql">
     <driver-class>com.mysql.jdbc.Driver</driver-class> 
     <xa-datasource-class>
      com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
    </xa-datasource-class>
    </driver>
    </drivers>
    </datasources>
    </subsystem>

  • Navigate to SERVER_HOME/modules/system/layers/base/com
  • Create folder mysqldatabase/mysql/main (eg,SERVER_HOME/modules/system/layers/base/com/mysqldatabase/mysql/main)

  • Create module.xml file with following data

  • Download mysql jdbc driver (eg,mysql-connector-java-5.1.38-bin.jar) and put into this ((SERVER_HOME/modules/system/layers/base/com/mysqldatabase/mysql/main)) location.


6.0 Install KIE Workbench (kie-wb) on WildFly 10.1.0.Final Application Server and configuration

6.1 Download jBPM workbench (kie-wb) and rename to downloaded war file into kie-wb.war
[root@localhost jbpm]# wget https://repository.jboss.org/nexus/content/groups/public-jboss/org/kie/kie-wb-distribution-wars/6.5.0.Final/kie-wb-distribution-wars-6.5.0.Final-wildfly10.war

6.1 Unpack the war file in a temp folder, 

navigate to SERVER_HOME/standalone/deployments/business-central.war/WEB-INF


6.2 Open jboss-deployment-structure.xml and add the following line
<module name="com.mysqldatabase.mysql" export="true" services="import" meta-inf="import"/>

6.3 Move to SERVER_HOME/standalone/deployments/business-central.war/WEB-INF/classes/META-INF

6.4 Open persistence.xml, update the datasource name, make sure this is the same name you created in the standalone-full.xml datasource name
    <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>
6.5 Replace the default h2 dialect information with the following code
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
...
</properties>

6.7 Now re-create the war file (repack) from the unpacked , modified files,
                                  jar -cvf kie-wb *
 6.8 Navigate to Wildfly 10.1.0.Final/standalone/deployment folder,
6.9 Copy the created kie-wb.war and paste into deployment folder

7.0 Install dashboard on WildFly 10.1.0.Final Application Server and configuration

7.1 Download dashboard
[root@localhost jbpm]# wget https://repository.jboss.org/nexus/content/groups/public-jboss/org/jbpm/dashboard/jbpm-dashboard-distributions/6.5.0.Final/jbpm-dashboard-distributions-6.5.0.Final-wildfly10.war
7.2 Rename the downloaded war file into dashboard.war
7.1 Move to SERVER_HOME/standalone/deployments/dashbuilder.war/WEB-INF
6.7 Open jboss-deployment-structure.xml and add the the following code..
<deployment>
  <dependencies>
<module name="com.mysqldatabase.mysql" export="true" services="import" meta-inf="import"/>
.
..
 </dependencies>
<deployment>
6.8 Open jboss-web.xml and update the jndi name, make sure this is the same name you created in the standalone.xml datasource name in step6 ...
    <jndi-name>java:jboss/datasources/jbpmDS</jndi-name>
6.9 Make sure you save those above mentioned files as you modified.
6.10 Now, navigate to your Server_Home/standalone.configuration folder and open standalone-full.xml file and update the system properties as follows..what we are trying to do here is , jBPM by default creates the those git and kie repo in server bin folder, but maintenance purpose we are moving out of the server and store in in user home.
<system-properties>
<property name="org.kie.demo" value="${org.kie.demo:false}"/>
<property name="org.kie.example" value="${org.kie.example:false}"/>
<property name="org.uberfire.nio.git.dir" value="/home/psin/jbpmrepo" />
<property name="org.uberfire.metadata.index.dir" value="/home/username1/jbpmrepo" />
<property name="org.guvnor.m2repo.dir" value="/home/username/jbpmrepo" />
</system-properties>
6.11 At this point your are done with all the settings, this is the time to test your installation
6.12 Navigate to SERVER_HOME/bin/ folder, type the following command to start the WildFly sever in standalone-full mode
    SERVER_HOME/bin/./standalone.sh – c standalone-full.xml
6.13 Open your browser and enter the following url..
             http://localhost:8080/kie-wb/

6.14 Enter user Id/ Password


7.0 Integrating eclipse neon with jBPM Workbench (kie-wb)

Log in to kie workbench (kie-wb) and create a sample jbpm project, build and deploy.Open your eclipse neon IDE, clone the git repository from kie-wb workbench. From the cloned git repo, import the git project into java workspace, since git is version control system, you can able to check-out, edit save and check-in into git. Those modification will be updated in kie-wb. Modification done in kie-wb side will be available in eclipse vice versa.

Please watch the below youtube video for detailed instructions....
https://youtu.be/qimrdgROMQQ

    ---thanks for reading---



Wednesday, March 29, 2017

BRMS 6.5.0 VFS Cluster and Maven Repository HA Architecture


Before we start our installation first we need to understand one thing, BRMS development environment Vs runtime environment. BRMS rules development environment needs git repository for asset storage & versioning, kie maven repo for kjar (binary form of rules project) artifact repository management, but rules execution (runtime) environment needs only runtime dependency jars and kjar not git repo, if you are using kie execution server, you just need the kjar only. Runtime cluster just based on your application server (EAP) clustering, not required for any additional settings. You may just deploy the Rules Execution Server on EAP container. EAP cluster will take care of the kie server clustering just like any other web application deployed on the EAP server.
But In development environment, you need to cluster the git repository, to do that BRMS using Apache ZooKeeper and Apache Helix.

Now let us get back to the installation.....
In this installation process, we are going to see step by step instruction for JBoss BRMS development clustering and Maven repository HA. This is highly available business process management system, developers and users can use the system 24/7 without any interruption or downtime delay. In a team environment, authorized developers can see or get the updated (edited by other team member) copy of the assets or file. Here in this example we used 5 VMs to demonstrate this HA architecture. The below diagram explains the high level architecture of the BRMS HA development environment.

BRMS VFS Cluster and Maven Repository HA Architecture Diagram

BRMS Git Repository Cluster Architecture

1. BRMS VFS Cluster and Maven Repository HA - Environment Overview

In this BRMS cluster demonstration we used 5 VMs,

VM1

Load Balance setup done in the VM1, client system access the BPM development service using this VM1.
  • BRMS Git Cluster Software
    • ZooKeeper
    • Helix ( Helix Admin )

VM2

VM3

VM4

VM5

2. Installation Steps

In this step we are installing and clustering EAP server in standalone mode and then installing BRMS 6.4.0 on EAP cluster and also installing mod-cluster for load balancing.

2.1 Install EAP 7 and BRMS 6.4.0

  • Install EAP 7 in standalone mode on VM2& VM3 and cluster those two EAP 7 servers.
  • Install BRMS 6.4.0 on EAP 7 server cluster (on both VMs, 2&3)
  • Install Apache Web Server
  • Install mod_cluster for load balancing
  • Start EAP 7 server (VM2&VM3) cluster in standalone HA mode.

2.2 BRMS 6.4.0 Clustering (Git Repository Clustering)

(In this step we are about to cluster the BRMS on top the EAP cluster environment)
BRMS installed on both EAP server having and managing its own VFS based assert repository backed with GIT. This asset repositories stores all the assets such as rules, decision table, data model etc..Since this VFS resides on each local server, then it must be kept in sync between all servers of a cluster, Apache Zookeeper and Apache Helix to accomplish this.
Zookeeper glues all the parts together, Helix is the cluster management component that registers all cluster details (nodes, resources and the cluster itself). Uberfire (on top of which Workbench is build) uses those 2 components to provide VFS clustering.

2.2.1 Download Zookeeper
Download the jboss-bpms-brms-VERSION-redhat-supplementary-tools.zip, which contains Apache Zookeeper, Apache Helix.

2.2.2 Setting up a ZooKeeper server in standalone mode
Setting up a ZooKeeper server in standalone mode is straightforward. The server is contained in a single JAR file, so installation consists of creating a configuration.
  • Once you've downloaded ZooKeeper, Unzip Zookeeper into a directory, (eg,$ZOOKEEPER_HOME ).
  • Navigate to zookeeper_home/conf and make a copy of zoo_sample.conf to zoo.conf
  • Edit zoo.conf and adjust settings (dataDir and clientPort) if needed, these two are important in most of the cases. Change the value of dataDir to specify an existing (empty to start with) directory.
              # the directory where the snapshot is stored.
                 dataDir=/tmp/zookeeper
              # the port at which the clients will connect
                 clientPort=2181
  • Navigate to zookeeper bin directory:
                $ cd $ZOOKEEPER_HOME/bin
  • Start the Zookeeper server:
                 bin/zkServer.sh start
  • If the server fails to start, verify that the dataDir (as specified in zoo.conf) is accessible.
  • ZooKeeper logs messages using log4j. You will see log messages coming to the console (default) and / or a log file depending on the log4j configuration.
Running ZooKeeper in standalone mode is convenient for evaluation, some development, and testing. But in production, you should run ZooKeeper in replicated mode.

2.2.3 Configure the cluster in Helix

  • Unzip Helix into a directory, the extracted directory is your helix home ($HELIX_HOME).
  • Navigate to Helix bin directory
            $ cd $HELIX_HOME/bin
  • To create the cluster, please type the following command and enter,
             ./helix-admin.sh zkSvr XX.XX.XXX.XX:2181 addCluster repoCluster
Command format details:
($HELIX_HOME/bin/helixadmin.sh zkSvr ZOOKEEPER_HOST:ZOOKEEPER_PORT --addCluster CLUSTER_NAME)

2.2.4 Add nodes to the cluster

Usually the number of nodes in the cluster equal the number of application servers in the cluster.
The node names (node1, node2 ...) can be changed as needed.
Command format details:
( $HELIX_HOME/bin/helixadmin.sh zkSvr ZOOKEEPER_HOST:ZOOKEEPER_PORT addNode CLUSTER_NAME NODE_NAMEUNIQUE_ID)
  • Type the following script to add cluster node one
                ./helixadmin.sh zkSvr XX.XX.XXX.XX:2181 addNode repoCluster node1
  • Type the following script to add cluster node two
           ./helixadmin.sh zkSvr XX.XX.XXX.X:2181 addNode repoCluster node2

2.2.5 Add resources to the cluster

  • Type the following command and enter,
./helixadmin.sh zkSvr 10.11.164.80:2181 addResource repoCluster vfsrepo 1 LeaderStandby AUTO_REBALANCE
  • Rebalance the cluster.
          ./helixadmin.sh zkSvr 10.11.164.80:2181 rebalance repoCluster vfsrepo2
  • Start the Helix controller in BRMS Server 1
  • Log in to your server one machine and navigate to your Helix installation home folder.
           /opt/helixtools/helixcore0.6.2incubatingredhat1/bin
  • Navigate to helix bin directory and run the controller
./runhelixcontroller.sh zkSvr XX.XX.XXX.XX:2181 cluster repoCluster 2>&1 > /tmp/controller.log &
  • Start the Helix controller in BRMS Server 2
./runhelixcontroller.sh zkSvr XX.XX.XXX.XX:2181 cluster repoCluster 2>&1 > /tmp/controller.log &

2.2.6 Modify the standalone.xml file in the standalone EAP server ONE
  • Login to your standalone server one machine and navigate to your JBoss EAP server installation home folder
  • Navigate to server standalone/configuration folder folder
          /jbosseapserver1/standalone/configuration
  • Edit the standalone.xml
## your custom location of git repo and index directory, by default it created in the
server bin folder, if you want to change location you can use these property to change

<systemproperties>
<property name="kie.maven.settings.custom" value="/opt/apachemaven3.2.2/
conf/settings.xml"/>
<property name="org.kie.example" value="${org.kie.example:false}"/>
<property name="org.jbpm.designer.perspective"
value="${org.jbpm.designer.perspective:ruleflow}"/>
<property name="org.uberfire.nio.git.dir" value="/opt/bpmsgitDir/repo "/>##
<property name="org.uberfire.metadata.index.dir" value="/opt/bpmsgitDir/index" />##
<property name="jboss.node.name" value="node11"/>
<property name="org.uberfire.cluster.id" value="repoCluster" />
<property name="org.uberfire.cluster.zk" value="xx.xx.xxx.xx(host):2181" />**
<property name="org.uberfire.cluster.local.id" value="node1" />
<property name="org.uberfire.cluster.vfs.lock" value="vfsrepo"
/>
<property name="org.uberfire.nio.git.deamon.port" value="9418" />
<property name="org.uberfire.cluster.autostart" value="false" />
<property name="org.uberfire.nio.git.ssh.port" value="8003" />
<property name="org.uberfire.nio.git.daemon.host" value="provide your server 1 ip
address" />
<property name="org.uberfire.nio.git.ssh.host" value="provide your server 1 ip
address" />
</systemproperties>

2.2.7 Modify the standalone.xml file in the standalone EAP server TWO
  • Login to your standalone server two machine and navigate to your JBoss EAP server installation home folder
  • Navigate to server standalone/configuration folder folder
        /jbosseapserver2/standalone/configuration
  • Edit the standalone.xml
## your custom location of git repo and index directory, by default it created in the
server bin folder, if you want to change location you can use these property to change

<systemproperties>
<property name="kie.maven.settings.custom" value="/opt/apachemaven3.2.2/
conf/settings.xml"/>
<property name="org.kie.example" value="${org.kie.example:false}"/>
<property name="org.jbpm.designer.perspective"
value="${org.jbpm.designer.perspective:ruleflow}"/>
<property name="org.uberfire.nio.git.dir" value="/opt/bpmsgitDir/repo"/>##
<property name="org.uberfire.metadata.index.dir" value="/opt/bpmsgitDir/index"/>##
<property name="jboss.node.name" value="node22"/>
<property name="org.uberfire.cluster.id" value="repoCluster"/>
<property name="org.uberfire.cluster.zk" value="HOST_ID:2181"/>**
<property name="org.uberfire.cluster.local.id" value="node2"/>
<property name="org.uberfire.cluster.vfs.lock" value="vfsrepo"/>
<property name="org.uberfire.nio.git.deamon.port" value="9418" />
<property name="org.uberfire.cluster.autostart" value="false"/>
<property name="org.uberfire.nio.git.ssh.port" value="8003"/>
<property name="org.uberfire.nio.git.daemon.host" value="provide your server 2 ip
address" />
<property name="org.uberfire.nio.git.ssh.host" value="provide your server 2 ip
address" />
</systemproperties>
  • Start the Cluster Servers in in HA mode and Test the Installation
  • Start the Standalone EAP Server One in HA mode
          Djboss.node.name=node1 must match the standalone.xml file org.uberfire.cluster.local.id property value
./standalone.sh c standaloneha.xml b XX.XX.XXX.XX u 230.0.0.4 Djboss.node.name=node1
  • Start the Standalone EAP Server Two in HA mode
Djboss.node.name=node2 must match the standalone.xml file org.uberfire.cluster.local.id property value
./standalone.sh c standaloneha.xml b XX.XX.XXX.XX u 230.0.0.4 Djboss.node.name=node2
  • Check the mod_cluster console for server status, it should list all the running instances in the cluster
               http://HOST_NAME:6666/mod_cluster_manager
  • Open a new browser window, and enter BRMS business central url for server one
                 http://HOST_NAME_1:8080/businesscentral/
  • Log in to business central, and create a rule project in server one and save it
  • Open a new browser window, and enter BRMS business central url for server Two
              http://HOST_NAME_2:8080/businesscentral/
  • Log in to business central and you can able to see the rule project created in server one. Do some some changes in that project and save it.
  • Now log in back to server one business central and you can see the updated rules in the server one.

3. Maven Nexus Repository Manager HA Setting

3.1 Cluster Information

Red Hat Enterprise Linux HighAvailability clustering was configured on both nodes with communication via unicast in a cluster called "MavenHA". The cluster is comprised of 2 nodes maven{1,2}, a gfs2 volume (/repository), a floating ip (corresponding to the fqdn maven.rdu.salab.redhat.com), and a "Script" resource that will utilize the nexus provided init script to start and stop the service. The service is configured to prefer node 2 and only operate in an Active/Passive role as the Nexus software uses a lock file to restrict operation against a given repository to a single host.

Note:
In Red Hat Enterprise Linux 6, luci controlled both Red Hat Enterprise Linux 5 and Red Hat Enterprise Linux 6 high availability clusters.

Red Hat Enterprise Linux 7 removes luci and replaces it with pcspcs can control only Red Hat Enterprise Linux 7 pacemaker-based clusters. It cannot control Red Hat Enterprise Linux 6 rgmanager-based high availability clusters. If you want to use RHEL7 instead of RHEL6.5 for maven cluster, please use RED HAT document for pcs cluster information.

Thank You