Skip to content

Instantly share code, notes, and snippets.

@jkeam
Last active February 14, 2022 17:53
Show Gist options
  • Save jkeam/d86da9504a10e021a0d0580545083fb2 to your computer and use it in GitHub Desktop.
Save jkeam/d86da9504a10e021a0d0580545083fb2 to your computer and use it in GitHub Desktop.
Dashbuilder Quickstart

Dashbuilder Quickstart

There are a few pieces to this. We need a KIE server running to generate data and then we need Dashbuilder to connect to that database and visualize some of the data. Also I'll be starting a few services which I'll explain below using Docker. I prefer to have them run foreground instead of background so I can send the SIGTERM signal with my keyboard to end it.

Database

  1. Start Postgresql DB (in one terminal)
mkdir /tmp/app/db
docker run --rm --name postgres -p 5432:5432 -v /tmp/app/db:/var/lib/postgresql/data -e POSTGRES_PASSWORD=root -e POSTGRES_USER=postgres -e PGDATA=/var/lib/postgresql/data/pgdata postgres:9.4.5
  1. Start Adminer DB Client (in one terminal)
docker run --rm --name adminer -p 8080:8080 adminer
# navigate to localhost:8080
# System: PostgreSQL
# Server: <whatever your IP address is. for whatever reason 127.0.0.1 doesn't work>:5432
# Username: postgres
# Password: root
# DB: <leave blank>
  1. Using the UI, create a new db called jbpm

Business App

  1. Download from https://start.jbpm.org, unzip business application

  2. Build the kjar

cd business-application-kjar
mvn clean install -DskipTests -P docker
  1. Build the model
cd ../business-application-model
mvn clean install -DskipTests -P docker
  1. Build the service
cd ../business-application-service
# edit src/main/resources/application-postgres.properties and replace localhost with your own IP address, and replace username with 'postgres' and password with 'root'
mvn clean install -DskipTests -P postgres,docker
  1. Run the app
cd ../
docker run --rm -p 8090:8090 --name business-application-service apps/business-application-service:1.0-SNAPSHOT
  1. Check that it is up
# navigate to localhost:8080/rest/server
# Username: kieserver
# Password: kieserver1!
  1. Check Adminer for tables
# navigate to localhost:8080 and log in
# pick jbpm database and see all new tables were created
  1. Kill Adminer - We want to free up this port, so go ahead and kill it once you see the new tables

Business Central

This is required to author, but not necessarily view the reports.

  1. Start Business Central - Here's a great tutorial https://github.com/jbossdemocentral/rhpam7-install-demo. All software required for this can be downloaded here: https://access.redhat.com/jbossnetwork/restricted/listSoftware.html.
  2. Navigate to http://localhost:8080/business-central/
  3. After logging in (see instructions in Github Repo), click the gear icon in the upper right. Then click Data Sources
  4. Add Driver
# Check: jboss-eap-7.3/standalone/deployments/business-central.war/WEB-INF/classes/datasource-management.properties
Name: Postgres
Driver Class Name: org.postgresql.Driver
Group Id: org.postgresql
Artifact Id: postgresql
Version: 9.4.1207
  1. Add DataSource
Name: jbpm
Connection Url: jdbc:postgresql://192.168.1.58:5432/jbpm
User: postgres
Password: root
Driver: Postgres (Match from step 3)
Test Connection and should succeed
  1. Click the gear icon again and click Data Set
  2. Click New Data Set and select SQL
Name: Task
Data Source: jbpm
Schema: <blank>
Source: Table
  task
  1. Select the columns that are important, like id, name, priority, subject, status, etc.
# click Next
# Name: Simple Task
  1. Click Menu -> Design -> Pages -> New Page
Name: Jbpm
  1. Components -> Reporting -> Table (as an example)
Type: Table
Data: Task
  1. Save (in the upper right), put whatever comments
  2. Go to the upper right and click the gear icon again and go to Dashbuilder Data Transfer and click Export All
  3. Stop Business Central

References

  1. SQL Datasource for Dashboards

Dashbuilder

We are now going to standup the Dashbuilder Standalone by copying the installation for Business Central and modifying it. Make sure to go to https://access.redhat.com/jbossnetwork/restricted/listSoftware.html and download the jboss-eap-7.3.0.zip server, here we are using version 7.3.

  1. Install Dashbuilder Standalone
mkdir dashbuilder && cd dashbuilder
mv ~/Downloads ./jboss-eap-7.3.0.zip
mv ~/Downloads/rhpam-7.11.1-add-ons.zip .
unzip jboss-eap-7.3.0.zip
unzip rhpam-7.11.1-add-ons.zip
mv ~/Downloads/rhpam-7.11.1-dashbuilder-runtime.zip jboss-eap-7.3.0/standalone/deployment
./bin/add-user.sh -a -e -u admin -p admin -g admin
  1. Copy postgres jar from business central to dashbuilder
./jboss-eap-7.3/bin/jboss-cli.sh
connect
module add --name=org.postgres --resources=./rhpam7-business-central-only//target/jboss-eap-7.3/standalone/deployments/business-central.war/WEB-INF/lib/postgresql-42.2.14.redhat-00003.jar --dependencies=javax.api,javax.transaction.api

cp jboss-eap-7.3/standalone/deployments/business-central.war/WEB-INF/lib/postgresql-42.2.14.redhat-00003.jar ./jboss-eap-7.3.0/standalone/deployments/dashbuilder-runtime.war/WEB-INF/lib/
  1. Modify standalone-full.xml
# in ./standalone/configuration/standalone-full.xml add the following datasource in <datasources>, replace with your own IP address
<datasource jta="true" jndi-name="java:jboss/kie/datasources/2ee26369-baa9-43b9-8e58-f5815c1104b7_93dffa74-5a50-4837-a76d-5b93d1f8ee71" pool-name="kie#2ee26369-baa9-43b9-8e58-f5815c1104b7#_93dffa74-5a50-4837-a76d-5b93d1f8ee71" use-ccm="false">
   <connection-url>jdbc:postgresql://192.168.1.58:5432/jbpm</connection-url>
   <driver>postgresql</driver>
   <security>
      <user-name>postgres</user-name>
      <password>root</password>
   </security>
</datasource>

# in ./standalone/configuration/standalone-full.xml add the following driver in <drivers>
<driver name="postgresql" module="org.postgres">
  <driver-class>org.postgresql.Driver</driver-class>
</driver>
  1. Start server
cd bin
./standalone -c standalone-full.xml
  1. Login
# navigate to http://localhost:8080/login
# Username: admin
# Password: admin
  1. Import Dashboard
Click Import Dashboard, and select the zip file that you exported out of Business Central (most likely called export.zip)

References

  1. Dashbuilder Runtime Introduction
  2. Official Documentation

Future

In the future (community only at this point) Dashbuilder is being rewritten into a Quarkus app (https://quarkus.io) that allows for native compilation, resulting in a reduced memory footprint and faster boot time. Dashbuilder will also have two components in the future:

  1. Dashbuilder Runtime - for viewing reports
  2. Dashbuilder Authoring - for creating reports, eliminating the need for Business Central entirely

No timeline yet when this will be supported, but is exciting in the direction all this is going.

Dashbuilder Runtime

Here are the instructions to give Dashbuilder Runtime a spin. This might be good enough for a lot of users to simply be able to simply and easily see the analytics that are running. And using an executable binary that starts up quick with a low memory footprint as opposed to an EAP server can be very attractive to a lot of teams.

We can use a container image that the Red Hat team has previously built for another demo:

docker run --rm --name dashbuilder -p 8080:8080 -e JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Ddashbuilder.import.base.dir=/opt/dashbuilder" quay.io/redhat_naps_da/dashbuilder-rhpam-db:0.0.1

From there you can click the import button and import any previously exported reports that you want. If you need to add in JDBC information, you can pass that in by adding a few more Java options (JAVA_OPTIONS from above command):

-Ddashbuilder.datasources=sample \
-Ddashbuilder.datasource.sample.jdbcUrl=jdbc:mariadb://localhost:3306/sample \
-Ddashbuilder.datasource.sample.providerClassName=org.mariadb.jdbc.Driver \
-Ddashbuilder.datasource.sample.maxSize=10 \
-Ddashbuilder.datasource.sample.principal=repasse \
-Ddashbuilder.datasource.sample.credential=repasse

References

Here arew a few references that should help you understand and familiarize yourself with how to customize this:

  1. Announcing Dashbuilder - Explains JDBC configs referenced above
  2. Dashbuilder Runtime and Authoring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment