Skip to content

Commit de6d109

Browse files
authored
DBACLD-160991 - Validate Instructions for BOM Dynamic Domain sample
DBACLD-160991 - Validate Instructions for BOM Dynamic Domain sample
2 parents 03421c0 + abdc7fb commit de6d109

File tree

9 files changed

+136
-56
lines changed

9 files changed

+136
-56
lines changed

decisioncenter/dynamicdomain/README-DOCKER.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ Before following the steps below, make sure you have built the customization JAR
1111

1212
## 1. Build the Sample Code
1313

14-
The following steps show how to compile the sample code into a JAR file using a Docker container with Maven and JDK 17.
14+
The following steps show how to compile the sample code into a JAR file using a Docker container with Maven and JDK 21.
1515

1616
1. Navigate to the project directory:
1717
```bash
1818
cd decisioncenter/dynamicdomain/src/ilog.rules.studio.samples.bomdomainpopulate
1919
```
2020

21-
2. Run the command below to build the JAR file:
21+
1. Run the command below to build the JAR file:
2222
```bash
2323
docker run --rm \
2424
-v "$(pwd)":/usr/src/sample \
2525
-w /usr/src/sample \
26-
maven:3.8.5-openjdk-17 \
26+
maven:3.9.9-ibm-semeru-21-jammy \
2727
mvn clean install -Dtarget.docker
2828
```
2929
> **Result**: The generated JAR file will be located in the `target` directory with the name `bomdomainpopulate-1.0.jar`.
@@ -39,7 +39,7 @@ To set up the ODM container with dynamic domain support:
3939
```
4040
> **Explanation**: This command initializes the ODM environment required for the sample.
4141
42-
2. Copy and configure the H2 database library for Decision Center:
42+
1. Copy and configure the H2 database library for Decision Center:
4343
```bash
4444
docker-compose exec odm-dynamic-domain sh -c "cp /config/resources/h2*.jar /config/apps/decisioncenter.war/WEB-INF/lib/h2.jar"
4545
docker-compose restart odm-dynamic-domain
@@ -65,20 +65,20 @@ To set up and populate the dynamic domains database:
6565
6666
# Using the sample
6767

68-
1. Log in into the [Business Console](http://localhost:9060/decisioncenter).<!-- markdown-link-check-disable-line -->
68+
1. Log in to the Business Console at [http://localhost:9060/decisioncenter](http://localhost:9060/decisioncenter).<!-- markdown-link-check-disable-line -->
6969
- user = `rtsAdmin`
7070
- password = `rtsAdmin`
7171
1. Navigate to the **Administration** tab. In the **Settings** sub-tab, click **Custom Settings** and click the *Add custom setting* **icon** and set:
7272
- name = `teamserver.derbyDataBaseDomainProvider`
7373
- description = `derbyDataBaseDomainProvider`
7474
- type = `String`
75-
- leave `default value` empty
76-
1. Set the value of the new custom setting to `ilog.rules.studio.samples.bomdomainpopulate.DataBaseDomainValueProvider`
75+
- leave `default value` empty. Save the setting.
76+
1. Set the value of this new custom setting to `ilog.rules.studio.samples.bomdomainpopulate.DataBaseDomainValueProvider`.
7777
1. Navigate to the **Library** tab.
78-
1. Import the rule project archive `projects/bomdomainpopulate-rules.zip`.
78+
1. Import the rule project archive `dynamicdomain/projects/bomdomainpopulate-rules.zip`.
7979
> Note: this rule project `bomdomainpopulate-rules` is only aimed at editing rules to demonstrate loading domains from a database. It is missing a deployment configuration and cannot be executed.
80-
1. **Navigate to the Library** tab. Select the **bomdomainpopulate-rules** box (click anywhere except the name) and choose the **main branch**.
81-
1. Display the rule `CheckOrder > OrderType`. Notice the error **Value (string) 'CompanyX' is incorrect**. Edit the rule and either remove **"CompanyX"** and press SPACE or double-click **"CompanyX"**. A list of suitable companies gets displayed in a drop-down. Close down the rule without saving.
80+
1. Once the archive is imported, the **bomdomainpopulate-rules** decision service will be displayed. Click the **main** branch to access to the decision artifacts.
81+
1. Display the rule `CheckOrder > OrderType`. An error **Value (string) 'CompanyX' is incorrect** is displayed. Edit the rule and either remove **"CompanyX"** and press SPACE or double-click **"CompanyX"**. A list of suitable companies gets displayed in a drop-down. `CompanyX` is not one of these companies. Close down the rule **without** saving.
8282
1. Display the rule `CheckCurrency > CurrencyRestriction`. No warning is displayed.
8383
1. Let's now make some changes in the dynamic domains in the database. Run:
8484
```bash
@@ -90,10 +90,16 @@ To set up and populate the dynamic domains database:
9090
-script /script/sql/modifyTables.sql \
9191
-showResults"
9292
```
93-
1. Display the rule `CheckOrder > OrderType` back again. Notice that there is no error anymore. The effects of the changes done in the database are taken into account automatically because the values that the field `stock` can take are dynamically fetched from the database (and not stored in the BOM).
93+
1. Display the rule `CheckOrder > OrderType` back again. Notice that there is no error anymore. The effects of the changes (the addition of `CompanyX` and `CompanyY`) done in the database are taken into account automatically because the values that the field `stock` can take are dynamically fetched from the database (and not stored in the BOM).
9494
1. Conversely if you display the rule `CheckCurrency > CurrencyRestriction`, there is still no warning. So let's now import the changes done in the database into the BOM. Click the **Model** tab, and then the **Dynamic Domains** sub-tab. Expand all the three domains. You should see this: (Notice that the **Australian Dollar** was removed)
9595
9696
![Dynamic Domains update](images/dynamicDomainsUpdate.png)
9797
9898
1. Tick **Domain** to select all the domains, and click the **Apply changes** button. Confirm the change.
9999
1. Display the rule `CheckCurrency > CurrencyRestriction` back again. Now a warning `'Australian Dollar' is deprecated` is displayed as the result of the update of the Dynamic Domains in the BOM.
100+
101+
# Stopping the sample
102+
103+
```bash
104+
docker-compose down
105+
```

decisioncenter/dynamicdomain/README-KUBERNETES.md

Lines changed: 73 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,28 @@ This README explains how to run the BOM dynamic domain sample in Kubernetes.
55
# Configuring the sample in Kubernetes
66
## 1. Build the sample code
77

8-
The instructions below enable to build the JAR using a Docker container featuring Maven and a JDK version 17.
8+
The instructions below enable to build the JAR using a Docker container featuring Maven and a JDK version 21.
99

10-
Run command below in the `decisioncenter/dynamicdomain/src/ilog.rules.studio.samples.bomdomainpopulate` directory:
10+
Run the command below in the `decisioncenter/dynamicdomain/src/ilog.rules.studio.samples.bomdomainpopulate` directory:
1111

1212
This will compile the source code
1313
```bash
1414
docker run --rm \
1515
-v "$(pwd)":/usr/src/sample \
1616
-w /usr/src/sample \
17-
maven:3.8.5-openjdk-17 \
17+
maven:3.9.9-ibm-semeru-21-jammy \
1818
mvn clean install
1919
```
20+
> **Result**: The generated JAR file will be located in the `target` directory with the name `bomdomainpopulate-1.0.jar`.
2021
2122
## 2. Uploading JARs on a file server
2223

23-
The customization JARs can be made available to Decision Center in two ways:
24-
1. the **legacy way**: by copying the JARs to a PVC and referencing this PVC using the parameter `decisionCenter.customlibPvc`
25-
1. or the **new way** (since 9.0 only): by copying the JARs on a file server and referencing the files to download from this file server using the parameter `decisionCenter.downloadUrl`
24+
Any file server reachable by Decision Center is suitable.
2625

27-
This document explains how to follow the **new way**. Any file server reachable by Decision Center is suitable. You can either use an existing one or follow the instructions [here](https://github.com/DecisionsDev/odm-docker-kubernetes/blob/vnext-release/contrib/file-server/README.md#setup-an-httpd-file-server) to deploy a httpd file server in a new pod.
28-
29-
However you must use the **legacy way** if you deploy a version of ODM older than 9.0. Here are some [instructions](https://www.ibm.com/docs/en/odm/9.0.0?topic=kubernetes-customizing-decision-center-business-console) in the documentation.
26+
You can either use an existing one or follow the instructions [here](https://github.com/DecisionsDev/odm-docker-kubernetes/blob/vnext-release/contrib/file-server/README.md#setup-an-httpd-file-server) to deploy a httpd file server in a new pod.
3027

3128
Two JARs must be made available:
32-
1. the Decision Center extension JAR built [previously](README.md#building-the-decision-center-extension-jar),
29+
1. the Decision Center extension JAR built [previously](README-KUBERNETES.md#1-build-the-sample-code)
3330
1. the JDBC driver of the database storing the data of the dynamic domains.
3431

3532
Download the JDBC driver (if the internal PostgreSQL database is used):
@@ -43,21 +40,59 @@ curl -T target/bomdomainpopulate-1.0.jar $FILESERVER_URL
4340
curl -T jdbc-driver.jar $FILESERVER_URL
4441
```
4542

43+
If all goes well, you should have an output with `201` status for the uploading of the JARs. For example:
44+
```console
45+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
46+
<html>
47+
<head>
48+
<title>201 Created</title>
49+
</head><body>
50+
<h1>Created</h1>
51+
<p>Resource /bomdomainpopulate-1.0.jar has been created.</p>
52+
</body></html>
53+
```
54+
4655
## 3. Deploying ODM
4756

48-
Add the public IBM Helm charts repository:
57+
To get access to the ODM material, you must have an IBM entitlement key to pull the images from the IBM Cloud Container registry.
58+
59+
### a. Retrieve your entitled registry key
60+
61+
- Log in to [MyIBM Container Software Library](https://myibm.ibm.com/products-services/containerlibrary) with the IBMid and password that are associated with the entitled software.
62+
63+
- In the **Container Software and Entitlement Keys** tile, verify your entitlement on the **View library page**, and then go to *Entitlement keys* to retrieve the key.
64+
65+
### b. Create a pull secret by running the kubectl create secret command
66+
67+
```bash
68+
kubectl create secret docker-registry my-odm-docker-registry --docker-server=cp.icr.io \
69+
--docker-username=cp --docker-password="<ENTITLEMENT_KEY>" --docker-email=<USER_EMAIL>
70+
```
71+
Where:
72+
73+
- `<ENTITLEMENT_KEY>`: The entitlement key from the previous step. Make sure to enclose the key in double quotes.
74+
- `<USER_EMAIL>`: The email address associated with your IBMid.
75+
76+
> **Note**
77+
> The `cp.icr.io` value for the docker-server parameter is the only registry domain name that contains the images. You must set the docker-username to `cp` to use the entitlement key as the docker-password.
78+
79+
The `my-odm-docker-registry` secret name must be used for the `image.pullSecrets` parameter when you run a Helm install of your containers. The `image.repository` parameter should also set to `cp.icr.io/cp/cp4a/odm`.
80+
81+
### c. Add the public IBM Helm charts repository:
82+
4983
```bash
50-
helm repo add ibmcharts https://raw.githubusercontent.com/IBM/charts/master/repo/ibm-helm
84+
helm repo add ibm-helm https://raw.githubusercontent.com/IBM/charts/master/repo/ibm-helm
5185
helm repo update
52-
````
86+
```
87+
88+
### d. Check that you can access the ODM charts:
5389

54-
Check that you can access the ODM charts:
5590
```bash
5691
helm search repo ibm-odm-prod
5792
```
5893
```bash
59-
NAME CHART VERSION APP VERSION DESCRIPTION
60-
ibmcharts/ibm-odm-prod <version> <version> IBM Operational Decision Manager License By in...
94+
NAME CHART VERSION APP VERSION DESCRIPTION
95+
ibm-helm/ibm-odm-prod 25.0.0 9.5.0.0 IBM Operational Decision Manager License By in...
6196
```
6297

6398
Create a file named `values.yaml`. This file will be used by the `helm install` command to specify the configuration parameters.
@@ -82,33 +117,42 @@ internalDatabase:
82117

83118
Add all the other parameters suitable to your platform in `values.yaml`. Check this [link](https://github.com/DecisionsDev/odm-docker-kubernetes/tree/master/platform) for help.
84119

85-
Install an ODM release named `myodmsample` (if you choose a different release name, you need to edit the file [database.properties](src/ilog.rules.studio.samples.bomdomainpopulate/src/main/resources/data/database.properties)):
120+
If you are on Openshift, you can use this [values.yaml](./src/ilog.rules.studio.samples.bomdomainpopulate/values.yaml) file by replacing `<FILESERVER_URL>` with the actual URL of the file server hosting the JARs.
121+
122+
Install an ODM release named `myodmsample`:
86123
```bash
87-
helm install myodmsample ibmcharts/ibm-odm-prod -f values.yaml
124+
helm install myodmsample ibm-helm/ibm-odm-prod -f values.yaml
88125
```
126+
> **NOTE**: If you choose a **different** release name, you must edit the value of `database.url` parameter accordingly in the [database.properties](src/ilog.rules.studio.samples.bomdomainpopulate/src/main/resources/data/database.properties), [rebuild](README-KUBERNETES.md#1-build-the-sample-code) the `bomdomainpopulate-1.0.jar`, and upload the JAR to the file server again.
89127

90128
## 4. Configuring Decision Center
91129

92130
The class that implements the customization must be declared:
93-
- either using a custom setting
94-
- or using a JVM parameter
131+
- either using a custom setting at Business Console
132+
- *or* using a JVM parameter
95133

96134
### 4.1 Using a custom setting
97-
1. Log in into the Business Console as an admin
135+
1. Log in to the Business Console. Use the following credentials if you install with the [values.yaml](./src/ilog.rules.studio.samples.bomdomainpopulate/values.yaml) for OCP:
136+
- **Username**: `odmAdmin`
137+
- **Password**: `odmAdmin`
98138
1. Navigate to **Administration > Settings > Custom Settings**
99139
1. Click the *Add custom setting* **icon** and set:
100140
- name = `teamserver.derbyDataBaseDomainProvider`
101141
- description = `derbyDataBaseDomainProvider`
102142
- type = `String`
103-
- leave `default value` empty
104-
1. Set the value to `ilog.rules.studio.samples.bomdomainpopulate.DataBaseDomainValueProvider`
143+
- leave `default value` empty. Save the setting.
144+
1. Set the value of this new custom setting to `ilog.rules.studio.samples.bomdomainpopulate.DataBaseDomainValueProvider`.
105145

106146
### 4.2 Using a JVM parameter
107147

108-
Follow instructions similar to [here](https://www.ibm.com/docs/en/odm/9.0.0?topic=kubernetes-persisting-decision-center-ruleset-cache) to add the JVM parameter below: (using in a Config Map referenced by the Helm parameter **decisionCenter.jvmOptionsRef**)
148+
Follow instructions as described [here](https://www.ibm.com/docs/en/odm/9.0.0?topic=kubernetes-persisting-decision-center-ruleset-cache) to create a Config Map with the additional JVM parameter below:
109149
```
110150
-Dilog.rules.teamserver.derbyDataBaseDomainProvider=ilog.rules.studio.samples.bomdomainpopulate.DataBaseDomainValueProvider
111151
```
152+
You need to set this new Config Map using the Helm parameter **decisionCenter.jvmOptionsRef**. To do so, apply an upgrade to your helm release:
153+
```bash
154+
helm upgrade myodmsample ibm-helm/ibm-odm-prod --reuse-values --set decisionCenter.jvmOptionsRef=<your_updated_dc_jvm_options_ref_configmap>
155+
```
112156

113157
## 5. Initializing the database
114158

@@ -129,21 +173,21 @@ Follow instructions similar to [here](https://www.ibm.com/docs/en/odm/9.0.0?topi
129173
kubectl exec $DBSERVER -- psql -U odmusr -d odmdb -f /tmp/createAndPopulate.sql
130174
```
131175

132-
## 6. Using the Sample
176+
## 6. Using the sample
133177

134-
1. Log in into the Business Console.
178+
1. Log in to the Business Console.
135179
1. Navigate to the **Library** tab.
136-
1. Import the rule project archive `projects/bomdomainpopulate-rules.zip`.
180+
1. Import the rule project archive `dynamicdomain/projects/bomdomainpopulate-rules.zip`.
137181
> Note: this rule project `bomdomainpopulate-rules` is only aimed at editing rules to demonstrate loading domains from a database. It is missing a deployment configuration and cannot be executed.
138-
1. Display the rule `CheckOrder > OrderType`. Notice the error **Value (string) 'CompanyX' is incorrect**. Edit the rule and either remove **"CompanyX"** and press SPACE or double-click **"CompanyX"**. A list of suitable companies gets displayed in a drop-down. Close down the rule without saving.
182+
1. Display the rule `CheckOrder > OrderType`. An error **Value (string) 'CompanyX' is incorrect** is displayed. Edit the rule and either remove **"CompanyX"** and press SPACE or double-click **"CompanyX"**. A list of suitable companies gets displayed in a drop-down. Close down the rule **without** saving.
139183
1. Display the rule `CheckCurrency > CurrencyRestriction`. No warning is displayed.
140184
1. Let's now make some changes in the dynamic domains in the database. Run:
141185
```bash
142186
kubectl cp ./sql_scripts/modifyTables.sql $DBSERVER:/tmp
143187
kubectl exec $DBSERVER -- psql -U odmusr -d odmdb -f /tmp/modifyTables.sql
144188
```
145189

146-
1. Display the rule `CheckOrder > OrderType` back again. Notice that there is no error anymore. The effects of the changes done in the database are taken into account automatically because the values that the field `stock` can take are dynamically fetched from the database (and not stored in the BOM).
190+
1. Display the rule `CheckOrder > OrderType` back again. Notice that there is no error anymore. The effects of the changes (the addition of `CompanyX` and `CompanyY`) done in the database are taken into account automatically because the values that the field `stock` can take are dynamically fetched from the database (and not stored in the BOM).
147191
1. Conversely if you display the rule `CheckCurrency > CurrencyRestriction`, there is still no warning. So let's now import the changes done in the database into the BOM. Click the **Model** tab, and then the **Dynamic Domains** sub-tab. Expand all the three domains. You should see this: (Notice that the **Australian Dollar** was removed)
148192

149193
![Dynamic Domains update](images/dynamicDomainsUpdate.png)

decisioncenter/dynamicdomain/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# BOM dynamic domain Sample
1+
# BOM dynamic domain sample
22

33
## Introduction
44

@@ -19,9 +19,9 @@ In this sample, you will :
1919
- store new values of the dynamic domains in a database,
2020
- update the rule project with the new values of the dynamic domains.
2121

22-
## Running this sample in Rule Designer
22+
## 1. Running the sample in Rule Designer
2323

24-
### 1) Building the Eclipse plugin
24+
### 1.1 Building the Eclipse plugin
2525

2626
To use the sample in Rule Designer, you need to build an Eclipse plugin.
2727
- In Eclipse, make sure that,
@@ -31,27 +31,27 @@ To use the sample in Rule Designer, you need to build an Eclipse plugin.
3131
- Select the folder `decisioncenter/dynamicdomain/src/ilog.rules.studio.samples.bomdomainpopulate`
3232
- Tick the project `ilog.rules.studio.samples.bomdomainpopulate` and click **Finish**
3333
- Right-click the `build-bomdomainepopulate.xml` file and click **Run as > Ant Build**. A file named `bomdomainpopulate.jar` gets generated at the root of the project.
34-
- Click **Export > Plug-in Development > Deployable Plug-ins and fragments** to build the plugin. Click **Next**, choose `<ECLIPSE_HOME>/dropins` as the destination directory (where `<ECLIPSE_HOME` should be replaced by the HOME directory of the running Eclipse), and click **Finish**.
34+
- Right-click on the project and click **Export > Plug-in Development > Deployable Plug-ins and fragments** to build the plugin. Click **Next**, enter `<ECLIPSE_HOME>/dropins` as the destination directory (where `<ECLIPSE_HOME>` should be replaced by the HOME directory of the running Eclipse), and click **Finish**.
3535
- Restart Eclipse.
3636

3737
>Note: if you modify the plugin and deploy it again, start Eclipse with the `-clean` parameter to force a cache update.
3838
39-
### 2) Instructions to use the sample in Rule Designer
39+
### 1.2 Instructions to use the sample in Rule Designer
4040

4141
- Import the projects below located in the `decisioncenter/dynamicdomain/projects/` directory:
4242
- bomdomainpopulate-bd-helper
4343
- bomdomainpopulate-rules
4444
- bomdomainpopulate-xom
4545

46-
- Follow the [instructions from the documentation](https://www.ibm.com/docs/en/odm/9.0.0?topic=domains-data-sources-bom-sample-details).
46+
- Follow the [instructions from the documentation](https://www.ibm.com/docs/en/odm/9.0.0?topic=domains-data-sources-bom-sample-details) to try out how the sample works in Rule Designer.
4747

48-
## Running this sample in Decision Center
48+
## 2. Running the sample in Decision Center
4949

50-
### 1) Prerequisites
50+
### 2.1 Prerequisites
5151

5252
Ensure you have at least Docker 24.0.x (and optionally Kubernetes 1.27+).
5353

54-
### 2) Configuring how to connect to the database (kubernetes only)
54+
### 2.2 Configuring how to connect to the database (kubernetes only)
5555

5656
If you deploy ODM on Docker, there is nothing to configure.
5757

0 commit comments

Comments
 (0)