Chapter 7. Example Workflow: Deploying Red Hat JBoss BRMS Application on Realtime Decision Server for OpenShift

This tutorial prepares a Red Hat JBoss BRMS application to be deployed as Realtime Decision Server for OpenShift. The Red Hat JBoss BRMS application may require modification to be deployed as an image.

Preparing the Application
The Red Hat JBoss BRMS project must be configured to have a stateless knowledge session, use a remote repository, and have defined KIE container deployment.
Refer to the Red Hat JBoss BRMS User Guide for more information on any of these tasks.

  1. Log in to the Red Hat JBoss BRMS console and edit the project settings in the Project Explorer.
  2. Click Open Project Editor and in the Project Settings:

    1. Under Knowledge bases and sessions, ensure that the Knowledge Session is set to Stateless. OpenShift does not support stateful sessions on KIE servers.
    2. Using Repository View, ensure the pom.xml is configured to use a remote repository by containing xml similar to the following:

      ...
      <distributionManagement>
        <repository>
          <id>deployment</id>
          <name>OpenShift Maven repo</name>
          <url>http://maven.example/content/repo/deployments/</url>
        </repository>
      
        <snapshotRepository>
          <id>deployment</id>
          <name>OpenShift Maven repo</name>
          <url>http://maven.example.xas/content/repo/snapshots/</url>
        </snapshotRepository>
      </distributionManagement>
      ...

      For more information, see the Red Hat JBoss BRMS Administration and Configuration Guide.

  3. In the application’s repository, ensure the settings.xml and the .s2i/environment files define the Maven repository and the KIE container deployment respectively:

    1. The Maven repository should be defined in the settings.xml so that OpenShift can download the application artefacts. It should contain xml similar to the following:

      ...
      <profiles>
        <profile>
          <id>openshift-mirror-repositories</id>
          <repositories>
            <repository>
              <id>openshift-mirror</id>
              <url>http://maven.example/content/group/public/</url>
            </repository>
          </repositories>
      
          <pluginRepositories>
            <pluginRepository>
              <id>openshift-mirror</id>
              <url>http://maven.example/content/group/public/</url>
            </pluginRepository>
          </pluginRepositories>
        </profile>
      </profiles>
      ...

      For more information, see the Red Hat JBoss BRMS Installation Guide.

    2. The .s2i/environment file must define the KIE container deployment, including which KIE jars to use and the location from which to retrieve them. The pod name is derived from the deployment alias, which is defined as DemoContainer in this example:

      KIE_CONTAINER_DEPLOYMENT_OVERRIDE=DemoContainer=com.example.openshift:example_workflow:1.0

7.1. Preparing Decision Server Deployment

  1. Create a new project:

    $ oc new-project rds-app-demo
  2. Create a service account to be used for the deployment of the Decision Server application:

    $ oc create serviceaccount rds-service-account
  3. Add the view role to the service account. This enables the service account to view all the resources in the rds-app-demo namespace, which is necessary for managing the cluster.

    $ oc policy add-role-to-user view system:serviceaccount:rds-app-demo:rds-service-account
  4. The Decision Server template requires an SSL keystore and a JGroups keystore.
    These keystores are expected even if the application will not use https.
    This example uses ‘keytool’, a package included with the Java Development Kit, to generate self-signed certificates for these keystores. The following commands will prompt for passwords.

    1. Generate a secure key for the SSL keystore:

      $ keytool -genkeypair -alias https -storetype JKS -keystore keystore.jks
    2. Generate a secure key for the JGroups keystore:

      $ keytool -genseckey -alias jgroups -storetype JCEKS -keystore jgroups.jceks
  5. Use the SSL and JGroup keystore files to create the secret for the project:

    $ oc create secret generic rds-app-secret --from-file=jgroups.jceks --from-file=keystore.jks
  6. Add the secret to the service account created earlier:

    $ oc secret add sa/rds-service-account secret/rds-app-secret

7.2. Deployment

  1. Log in to the OpenShift web console and select the rds-app-demo project space.
  2. Click Add to Project to list all of the default image streams and templates.
  3. Use the Filter by keyword search bar to limit the list to those that match decisionserver. You may need to click See all to show the desired application template.
  4. Select and configure the desired template and click Deploy.

During the build, the Maven repository is downloaded and build into the container so that no additional packages or dependencies are downloaded at runtime.

The application is available once the pod is running. To connect to the Decision Server web console, navigate to the pod and click Open Java Console button.