-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'vnext-release' into group-synchro
- Loading branch information
Showing
7 changed files
with
289 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
# Introduction | ||
|
||
This readme explains how to run the sample in Docker. | ||
|
||
Doing so, you do not need to have ODM installed. Instead we are relying on the [ODM for developers](https://github.com/DecisionsDev/odm-for-developers) container image. | ||
|
||
# Starting the ODM Container | ||
|
||
Start the ODM container: | ||
```bash | ||
docker-compose up odm & | ||
``` | ||
|
||
# Running the sample | ||
|
||
Follow the instructions in [README](README.md) | ||
|
||
# Stopping the ODM Container | ||
|
||
```bash | ||
docker-compose down | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Introduction | ||
|
||
This page explains how to deploy ODM in Kubernetes. | ||
|
||
## Deploying ODM | ||
|
||
#### a. Retrieve your entitled registry key | ||
|
||
- Log in to [My IBM Container Software Library](https://myibm.ibm.com/products-services/containerlibrary) with the IBMid and password that are associated with the entitled software. | ||
|
||
- 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. | ||
|
||
#### b. Create a pull secret by running the kubectl create secret command | ||
|
||
```bash | ||
oc create secret docker-registry my-odm-docker-registry --docker-server=cp.icr.io \ | ||
--docker-username=cp --docker-password="<ENTITLEMENT_KEY>" --docker-email=<USER_EMAIL> | ||
``` | ||
|
||
Where: | ||
|
||
- `<ENTITLEMENT_KEY>`: The entitlement key from the previous step. Make sure to enclose the key in double quotes. | ||
- `<USER_EMAIL>`: The email address associated with your IBMid. | ||
|
||
> **Note** | ||
> 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. | ||
#### c. Add the public IBM Helm charts repository | ||
|
||
```bash | ||
helm repo add ibmcharts https://raw.githubusercontent.com/IBM/charts/master/repo/ibm-helm | ||
helm repo update | ||
```` | ||
|
||
Check that you can access the ODM charts: | ||
```bash | ||
helm search repo ibm-odm-prod | ||
``` | ||
```bash | ||
NAME CHART VERSION APP VERSION DESCRIPTION | ||
ibmcharts/ibm-odm-prod <version> <version> IBM Operational Decision Manager License By in... | ||
``` | ||
|
||
### d. Create the `values.yaml` parameter file | ||
|
||
Create a file named `values.yaml`. This file will be used by the `helm install` command to specify the configuration parameters. | ||
|
||
Find the parameters suitable to your platform in [link](https://github.com/DecisionsDev/odm-docker-kubernetes/tree/master/platform). | ||
|
||
If you are on Openshift you can use this [values.yaml](values.yaml). | ||
|
||
### e. Install an ODM release | ||
```bash | ||
helm install myodmsample ibmcharts/ibm-odm-prod -f values.yaml | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# Automating the deployment and execution of rulesets with the REST API | ||
|
||
## Introduction | ||
|
||
This sample demonstrates how to automate the deployment and execution of a ruleset using the REST API. | ||
|
||
In this sample, you will: | ||
- deploy ODM either on Kubernetes or in Docker, | ||
- deploy a ruleset from Decision Center to Decision Server, | ||
- execute this ruleset. | ||
|
||
## Prerequisites | ||
|
||
- Ensure you have at least Docker 24.0.x or Kubernetes 1.27+ | ||
- Install [jq](https://jqlang.github.io/jq/download/) | ||
|
||
## Installation of ODM | ||
|
||
Click one of the links below depending on how you prefer to deploy ODM: | ||
* [Kubernetes](README-KUBERNETES.md) | ||
* [Docker](README-DOCKER.md) | ||
|
||
## Configuration | ||
|
||
### 1. Set Environment Variables | ||
|
||
Set the following environment variables: | ||
|
||
<!-- markdown-link-check-disable --> | ||
|
||
| Name | Description | Value for Docker | | ||
| - | - | - | | ||
| DC_API_URL | Decision Center API URL | http://localhost:9060/decisioncenter-api | | ||
| DSR_URL | Decision Server Runtime URL | http://localhost:9060/decisioncenter/DecisionService | | ||
|
||
<!-- markdown-link-check-enable--> | ||
|
||
### 2. Deploy the `Loan Validation Service` Decision Service | ||
|
||
If the `Loan Validation Service` Decision Service is not available in Decision Center yet, run: | ||
|
||
```bash | ||
# configure the Authentication (using Basic Auth) | ||
export auth_credentials=(--user "odmAdmin:odmAdmin") | ||
|
||
export decision_service_name="Loan Validation Service" | ||
export filename="${decision_service_name// /_}.zip" # replace spaces by underscores | ||
export filename_urlencoded="${decision_service_name// /%20}.zip" # replace spaces by %20 | ||
|
||
# download the Decision Service zip file | ||
curl -sL -o ${filename} "https://github.com/DecisionsDev/odm-for-dev-getting-started/blob/master/${filename_urlencoded}?raw=1" | ||
|
||
# upload the Decision Service in Decision Center | ||
curl -sk -X POST ${auth_credentials[@]} -H "accept: application/json" -H "Content-Type: multipart/form-data" \ | ||
--form "file=@${filename};type=application/zip" \ | ||
"${DC_API_URL}/v1/decisionservices/import" | ||
``` | ||
|
||
## Running the sample | ||
|
||
```bash | ||
# configure the Authentication (using Basic Auth) | ||
export auth_credentials=(--user "odmAdmin:odmAdmin") | ||
|
||
# get the ID of the Decision Service in Decision Center | ||
export decision_service_name="Loan Validation Service" | ||
export decision_service_name_urlencoded="${decision_service_name// /%20}" # replace spaces by %20 | ||
export get_decisionService_result=$(curl -sk -X GET ${auth_credentials[@]} -H "accept: application/json" "${DC_API_URL}/v1/decisionservices?q=name%3A${decision_service_name_urlencoded}") | ||
export decisionServiceId=$(echo ${get_decisionService_result} | jq -r '.elements[0].id') | ||
|
||
# get the ID of the deployment configuration in Decision Center | ||
export deployment_name="production deployment" | ||
export deployment_name_urlencoded="${deployment_name// /%20}" # replace spaces by %20 | ||
export get_deployment_result=$(curl -sk -X GET ${auth_credentials[@]} -H "accept: application/json" "${DC_API_URL}/v1/decisionservices/${decisionServiceId}/deployments?q=name%3A${deployment_name_urlencoded}") | ||
export deploymentConfigurationId=$(echo ${get_deployment_result} | jq -r '.elements[0].id') | ||
|
||
# deploy the ruleapp from Decision Center | ||
curl -sk -X POST ${auth_credentials[@]} -H "accept: application/json" "${DC_API_URL}/v1/deployments/${deploymentConfigurationId}/deploy" | jq | ||
|
||
# execute the ruleset that was deployed | ||
export ruleset_path="/production_deployment/loan_validation_production" | ||
curl -sk -X POST ${auth_credentials[@]} -H "accept: application/json" -H "Content-Type: application/json" -d "@payload.json" ${DSR_URL}/rest${ruleset_path} | jq | ||
``` | ||
|
||
> [!NOTE] | ||
> The commands above rely on the Basic Authentication. | ||
> | ||
> - In an environment with OpenID Connect, the authentication can be performed using an access token retrieved with the `client_credentials` grant type by: | ||
> - setting the environment variables | ||
> - CLIENT_ID | ||
> - CLIENT_SECRET | ||
> - OPENID_TOKEN_URL | ||
> - and replacing `export auth_credentials=(--user "odmAdmin:odmAdmin")` by the commands below: | ||
> ```bash | ||
> export access_token=$(curl -sk -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "client_id=${CLIENT_ID}&scope=openid&client_secret=${CLIENT_SECRET}&grant_type=client_credentials" ${OPENID_TOKEN_URL} | jq -r '.access_token') | ||
> export auth_credentials=(-H "Authorization: Bearer ${access_token}") | ||
> ``` | ||
> - In a CP4BA environment, the authentication can be performed using a [Zen API key](https://www.ibm.com/docs/en/cloud-paks/cp-biz-automation/24.0.1?topic=access-using-zen-api-key-authentication). To do so: | ||
> - set the environment variables | ||
> - USERNAME | ||
> - ZEN_API_KEY | ||
> - replace `export auth_credentials=(--user "odmAdmin:odmAdmin")` by the commands below: | ||
> ```bash | ||
> export base64encoded_username_and_APIkey=$(echo "${USERNAME}:${ZEN_API_KEY}" | openssl base64) | ||
> export auth_credentials=(-H "Authorization: ZenApiKey ${base64encoded_username_and_APIkey}") | ||
> ``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
services: | ||
odm: | ||
image: icr.io/cpopen/odm-k8s/odm:9.0.0 | ||
mem_limit: 4G | ||
memswap_limit: 4G | ||
user: "1001:0" | ||
environment: | ||
- SAMPLE=true | ||
- LICENSE=accept | ||
ports: | ||
- 9060:9060 | ||
- 9453:9453 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"loan": { | ||
"numberOfMonthlyPayments": 3, | ||
"startDate": "2025-08-19T19:27:14.000+0200", | ||
"amount": 3, | ||
"loanToValue": 10517320 | ||
}, | ||
"borrower": { | ||
"firstName": "string", | ||
"lastName": "string", | ||
"birth": "1988-09-29T03:49:45.000+0200", | ||
"SSN": { | ||
"areaNumber": "string", | ||
"groupCode": "string", | ||
"serialNumber": "string" | ||
}, | ||
"yearlyIncome": 3, | ||
"zipCode": "string", | ||
"creditScore": 3, | ||
"spouse": { | ||
"birth": "1982-12-08T15:13:09.850+0100", | ||
"SSN": { | ||
"areaNumber": "", | ||
"groupCode": "", | ||
"serialNumber": "" | ||
}, | ||
"yearlyIncome": 0, | ||
"creditScore": 0, | ||
"latestBankruptcy": { | ||
"chapter": 0 | ||
} | ||
}, | ||
"latestBankruptcy": { | ||
"date": "2014-09-19T01:18:33.000+0200", | ||
"chapter": 3, | ||
"reason": "string" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
customization: | ||
runAsUser: '' # only needed in Openshift | ||
image: | ||
pullSecrets: | ||
- my-odm-docker-registry | ||
repository: cp.icr.io/cp/cp4a/odm | ||
internalDatabase: | ||
persistence: | ||
enabled: false | ||
useDynamicProvisioning: false | ||
populateSampleData: true | ||
runAsUser: '' # only needed in Openshift | ||
license: true | ||
service: | ||
enableRoute: true # only needed in Openshift | ||
usersPassword: odmAdmin |