Skip to content

Commit 5f24d3b

Browse files
authored
Merge pull request #6 from DecisionsDev/dynamicdomain-review-lolo
Dynamicdomain review lolo - Docker part
2 parents f779a06 + 6a468e2 commit 5f24d3b

File tree

4 files changed

+112
-103
lines changed

4 files changed

+112
-103
lines changed

decisioncenter/docker-compose.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

decisioncenter/dynamicdomain/README-DOCKER.md

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,61 @@ Doing so, you do not need to have ODM installed. Instead we are relying on the [
77

88
Before following the steps below, make sure you have built the customization JAR as explained in [README.md](README.md).
99

10-
# Configuring the sample for Docker
10+
# Configuring the Sample for Docker
1111

12-
## 1. Start the ODM container
12+
## 1. Build the Sample Code
1313

14-
- Run
15-
```bash
16-
docker-compose up odm-dynamic-domain &
17-
```
14+
The following steps show how to compile the sample code into a JAR file using a Docker container with Maven and JDK 17.
1815

19-
- Then, run
20-
```bash
21-
docker-compose exec odm-dynamic-domain sh -c "cp /config/resources/h2*.jar /config/apps/decisioncenter.war/WEB-INF/lib/h2.jar"
22-
docker-compose restart odm-dynamic-domain
23-
```
16+
1. Navigate to the project directory:
17+
```bash
18+
cd decisioncenter/dynamicdomain/src/ilog.rules.studio.samples.bomdomainpopulate
19+
```
2420

25-
## 2. Initializing the dynamic domains database
21+
2. Run the command below to build the JAR file:
22+
```bash
23+
docker run --rm \
24+
-v "$(pwd)":/usr/src/sample \
25+
-w /usr/src/sample \
26+
maven:3.8.5-openjdk-17 \
27+
mvn clean install -Dtarget.docker
28+
```
29+
> **Result**: The generated JAR file will be located in the `target` directory with the name `bomdomainpopulate-1.0.jar`.
2630
27-
- Run
28-
```bash
29-
docker-compose exec odm-dynamic-domain sh -c "java \
30-
-cp /config/resources/h2*.jar \
31-
org.h2.tools.RunScript \
32-
-url jdbc:h2:/config/dbdata/bomdomain \
33-
-user sa \
34-
-script /script/sql/createAndPopulate.sql \
35-
-showResults"
36-
```
31+
32+
## 2. Start the ODM Container
33+
34+
To set up the ODM container with dynamic domain support:
35+
36+
1. Start the ODM container:
37+
```bash
38+
docker-compose up odm-dynamic-domain &
39+
```
40+
> **Explanation**: This command initializes the ODM environment required for the sample.
41+
42+
2. Copy and configure the H2 database library for Decision Center:
43+
```bash
44+
docker-compose exec odm-dynamic-domain sh -c "cp /config/resources/h2*.jar /config/apps/decisioncenter.war/WEB-INF/lib/h2.jar"
45+
docker-compose restart odm-dynamic-domain
46+
```
47+
> **Explanation**: The H2 database library is needed to support the dynamic domains sample. Restarting ensures all configurations take effect.
48+
49+
50+
## 3. Initialize the Dynamic Domains Database
51+
52+
To set up and populate the dynamic domains database:
53+
54+
1. Run the initialization script:
55+
```bash
56+
docker-compose exec odm-dynamic-domain sh -c "java \
57+
-cp /config/resources/h2*.jar \
58+
org.h2.tools.RunScript \
59+
-url jdbc:h2:/config/dbdata/bomdomain \
60+
-user sa \
61+
-script /script/sql/createAndPopulate.sql \
62+
-showResults"
63+
```
64+
> **Explanation**: This command initializes the H2 database schema for the sample and populates it with the necessary data, enabling ODM to recognize and use the dynamic domain setup.
3765
3866
# Using the sample
3967

@@ -49,6 +77,7 @@ Before following the steps below, make sure you have built the customization JAR
4977
1. Navigate to the **Library** tab.
5078
1. Import the rule project archive `projects/bomdomainpopulate-rules.zip`.
5179
> 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**.
5281
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.
5382
1. Display the rule `CheckCurrency > CurrencyRestriction`. No warning is displayed.
5483
1. Let's now make some changes in the dynamic domains in the database. Run:

decisioncenter/dynamicdomain/README-KUBERNETES.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,22 @@
33
This README explains how to run the BOM dynamic domain sample in Kubernetes.
44

55
# Configuring the sample in Kubernetes
6+
## 1. Build the sample code
67

7-
## 1. Uploading JARs on a file server
8+
The instructions below enable to build the JAR using a Docker container featuring Maven and a JDK version 17.
9+
10+
Run command below in the `decisioncenter/dynamicdomain/src/ilog.rules.studio.samples.bomdomainpopulate` directory:
11+
12+
This will compile the source code
13+
```bash
14+
docker run --rm \
15+
-v "$(pwd)":/usr/src/sample \
16+
-w /usr/src/sample \
17+
maven:3.8.5-openjdk-17 \
18+
mvn clean install
19+
```
20+
21+
## 2. Uploading JARs on a file server
822

923
The customization JARs can be made available to Decision Center in two ways:
1024
1. the **legacy way**: by copying the JARs to a PVC and referencing this PVC using the parameter `decisionCenter.customlibPvc`
@@ -29,7 +43,7 @@ curl -T target/bomdomainpopulate-1.0.jar $FILESERVER_URL
2943
curl -T jdbc-driver.jar $FILESERVER_URL
3044
```
3145

32-
## 2. Deploying ODM
46+
## 3. Deploying ODM
3347

3448
Add the public IBM Helm charts repository:
3549
```bash
@@ -73,13 +87,13 @@ Install an ODM release named `myodmsample` (if you choose a different release na
7387
helm install myodmsample ibmcharts/ibm-odm-prod -f values.yaml
7488
```
7589

76-
## 3. Configuring Decision Center
90+
## 4. Configuring Decision Center
7791

7892
The class that implements the customization must be declared:
7993
- either using a custom setting
8094
- or using a JVM parameter
8195

82-
### 3.1 Using a custom setting
96+
### 4.1 Using a custom setting
8397
1. Log in into the Business Console as an admin
8498
1. Navigate to **Administration > Settings > Custom Settings**
8599
1. Click the *Add custom setting* **icon** and set:
@@ -89,14 +103,14 @@ The class that implements the customization must be declared:
89103
- leave `default value` empty
90104
1. Set the value to `ilog.rules.studio.samples.bomdomainpopulate.DataBaseDomainValueProvider`
91105

92-
### 3.2 Using a JVM parameter
106+
### 4.2 Using a JVM parameter
93107

94108
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**)
95109
```
96110
-Dilog.rules.teamserver.derbyDataBaseDomainProvider=ilog.rules.studio.samples.bomdomainpopulate.DataBaseDomainValueProvider
97111
```
98112

99-
## 4. Initializing the database
113+
## 5. Initializing the database
100114

101115
1. If the data of the dynamic domains are stored in the internal PostgreSQL database, you can find the name of that pod by running:
102116
```bash
@@ -115,7 +129,7 @@ Follow instructions similar to [here](https://www.ibm.com/docs/en/odm/9.0.0?topi
115129
kubectl exec $DBSERVER -- psql -U odmusr -d odmdb -f /tmp/createAndPopulate.sql
116130
```
117131

118-
## 5. Using the Sample
132+
## 6. Using the Sample
119133

120134
1. Log in into the Business Console.
121135
1. Navigate to the **Library** tab.

decisioncenter/dynamicdomain/README.md

Lines changed: 40 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -62,63 +62,46 @@ Edit that file otherwise.
6262

6363
> Note: The data of the dynamic domains are stored in a separate schema named `BOMDOMAINSAMPLE`
6464
65-
### 3) Building the Decision Center extension JAR
66-
67-
To use the sample in Decision Center, you need to build a JAR.
68-
69-
1. Retrieve ODM libraries:
70-
71-
ODM libraries are required to compile the JAR.
72-
73-
- Navigate to the source directory of the BOM dynamic domain sample:
74-
```bash
75-
cd decisioncenter/dynamicdomain/src/ilog.rules.studio.samples.bomdomainpopulate
76-
```
77-
78-
- Deploy ODM for Developer public docker image (to quickly download the ODM libraries):
79-
```
80-
docker-compose up odm &
81-
```
82-
83-
- Download the decision-center-client-api.zip file :
84-
```bash
85-
wget http://localhost:9060/decisioncenter/assets/decision-center-client-api.zip
86-
```
87-
88-
- Then, run:
89-
```bash
90-
unzip decision-center-client-api.zip -d "lib"
91-
```
92-
93-
- Undeploy ODM for developer (especially if you continue this tutorial on [Docker](README-DOCKER.md) to avoid a TCP/IP port usage conflict) :
94-
```
95-
docker-compose down
96-
```
97-
98-
1. Build the JAR
99-
100-
The instructions below enable to build the JAR using a Docker container featuring Maven and a JDK version 17. For ODM 8.12, you must use `maven:3.8.1-openjdk-11` instead and `maven:3.8-adoptopenjdk-8` for earlier releases.
101-
102-
Run one of the command below in the `decisioncenter/dynamicdomain/src/ilog.rules.studio.samples.bomdomainpopulate` directory:
103-
- to use the sample on **Kubernetes** :
104-
```bash
105-
docker run --rm \
106-
-v "$(pwd)":/usr/src/sample \
107-
-w /usr/src/sample \
108-
maven:3.8.5-openjdk-17 \
109-
mvn clean install
110-
```
111-
112-
- to use the sample on **Docker** :
113-
```bash
114-
docker run --rm \
115-
-v "$(pwd)":/usr/src/sample \
116-
-w /usr/src/sample \
117-
maven:3.8.5-openjdk-17 \
118-
mvn clean install -Dtarget.docker
119-
```
120-
121-
The JAR is generated in the `target` directory and is named `bomdomainpopulate-1.0.jar`.
65+
### 3) Retrieve ODM Libraries
66+
67+
To use the sample in Decision Center, you need to build a JAR file that depends on IBM ODM libraries for compilation.
68+
69+
#### Steps:
70+
71+
1. **Navigate to the Sample Source Directory**
72+
73+
Move to the source directory for the BOM dynamic domain sample:
74+
```bash
75+
cd decisioncenter/dynamicdomain/src/ilog.rules.studio.samples.bomdomainpopulate
76+
```
77+
78+
2. **Deploy ODM for Developer Using Docker**
79+
80+
Start the ODM for Developer Docker image to quickly access the necessary libraries:
81+
```bash
82+
docker-compose up odm &
83+
```
84+
85+
3. **Download the Decision Center Client API**
86+
87+
Retrieve the required libraries by downloading `decision-center-client-api.zip` from the local ODM instance:
88+
```bash
89+
wget http://localhost:9060/decisioncenter/assets/decision-center-client-api.zip
90+
```
91+
92+
4. **Extract Libraries**
93+
94+
Unzip the downloaded archive into a directory called `lib` to make the libraries available for compilation:
95+
```bash
96+
unzip decision-center-client-api.zip -d "lib"
97+
```
98+
99+
5. **Stop the ODM for Developer Container**
100+
Undeploy ODM for developer (especially if you continue this tutorial on [Docker](README-DOCKER.md) to avoid a TCP/IP port usage conflict) :
101+
```bash
102+
docker-compose down
103+
```
104+
122105

123106
### 4) Instructions to use the sample in Decision Center
124107

0 commit comments

Comments
 (0)