Skip to content

Commit fc28850

Browse files
author
Frederic Mercier
committed
DBACLD-160994 - review the webhook sample
1 parent 42c0acf commit fc28850

File tree

5 files changed

+47
-12
lines changed

5 files changed

+47
-12
lines changed

decisioncenter/webhooknotifier/README-DOCKER.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Before following the steps below, make sure you have built the images as explain
1919
1. For the File Notifier:
2020
```shell
2121
curl -X 'PUT' \
22-
'http://localhost:9060/decisioncenter-api/v1/webhook/notify?url=http%3A%2F%2Flogifle%3A3000%2Fprint' \
22+
'http://localhost:9060/decisioncenter-api/v1/webhook/notify?url=http%3A%2F%2Flogfile%3A3000%2Fprint' \
2323
-H 'accept: */*' \
2424
-H 'Content-Type: application/json' \
2525
-d 'null' \

decisioncenter/webhooknotifier/README-KUBERNETES.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Also, before following the steps below, make sure you have built the images as e
6767

6868
```shell
6969
curl -k -X 'PUT' \
70-
'https://$DC_HOST/decisioncenter-api/v1/webhook/notify?url=http%3A%2F%2Fwebhooknotifier-logfile.$NAMESPACE.svc.cluster.local%3A3000%2Fprint' \
70+
"https://$DC_HOST/decisioncenter-api/v1/webhook/notify?url=http%3A%2F%2Fwebhooknotifier-logfile.$NAMESPACE.svc.cluster.local%3A3000%2Fprint" \
7171
-H 'accept: */*' \
7272
-H 'Content-Type: application/json' \
7373
-d 'null' \
@@ -85,7 +85,7 @@ Also, before following the steps below, make sure you have built the images as e
8585
export SLACK_TOKEN=`kubectl exec -ti webhooknotifier-slack -- curl 'http://localhost:3000/token.generate' -H 'accept: */*' -H 'Content-Type: application/json'`
8686
8787
curl -X 'PUT' -k \
88-
'https://$DC_HOST/decisioncenter-api/v1/webhook/notify?url=http%3A%2F%2Fwebhooknotifier-slack.$NAMESPACE.svc.cluster.local%3A3000%2Fslack' \
88+
"https://$DC_HOST/decisioncenter-api/v1/webhook/notify?url=http%3A%2F%2Fwebhooknotifier-slack.$NAMESPACE.svc.cluster.local%3A3000%2Fslack" \
8989
-H 'accept: */*' \
9090
-H 'Content-Type: application/json' \
9191
-d "$SLACK_TOKEN" \
@@ -130,7 +130,7 @@ After creating this snapshot, a notification will be triggered.
130130
To view the content of the generated log file, run the following command:
131131

132132
```shell
133-
kubectl exec -ti <webhooknotifier-logfile-container-id> sh -c 'cat /app/results/default.txt'
133+
kubectl exec -ti <webhooknotifier-logfile-container-id> -- sh -c 'cat /app/results/default.txt'
134134
```
135135

136136

@@ -218,9 +218,10 @@ and a message should appear your slack channel :
218218
To remove the webhooks configured in Decision Center, first list them:
219219
220220
```bash
221-
curl -X 'GET' \
222-
'https://$DC_HOST/decisioncenter-api/v1/webhooks/notify' \
223-
-H 'accept: */*'
221+
curl -k -X 'GET' \
222+
"https://$DC_HOST/decisioncenter-api/v1/webhooks/notify" \
223+
-H 'accept: */*' \
224+
-u odmAdmin:odmAdmin
224225
```
225226
226227
where `$DC_HOST` should be set to the hostname of Decision Center.
@@ -241,9 +242,10 @@ The expected output looks like:
241242
You can then remove a webhook from Decision Center, by running the command below:
242243
243244
```bash
244-
curl -X 'DELETE' \
245-
'https://$DC_HOST/decisioncenter-api/v1/webhooks/$WEBHOOK_ID/notify' \
246-
-H 'accept: */*'
245+
curl -k -X 'DELETE' \
246+
"https://$DC_HOST/decisioncenter-api/v1/webhooks/$WEBHOOK_ID/notify" \
247+
-H 'accept: */*' \
248+
-u odmAdmin:odmAdmin
247249
```
248250
249251
where

decisioncenter/webhooknotifier/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ This NodeJS sample code will be packaged in two docker images.
3535
```bash
3636
docker-compose build
3737
```
38-
> Note: The docker-compose build command will produce images based on your local machine’s architecture. If you plan to deploy this sample on a Kubernetes cluster, ensure the target environment uses the same architecture (e.g., x86_64 vs. arm64) to avoid compatibility issues. You may also need to specify a platform explicitly if building for a different architecture.
38+
39+
> Note: The docker-compose build command will produce images based on your local machine’s architecture. If you plan to deploy this sample on a Kubernetes cluster, ensure the target environment uses the same architecture (e.g., amd64 vs. arm64) to avoid compatibility issues. You may also need to specify a platform explicitly if building for a different architecture.
40+
> For instance, you can make sure that the images are built for the `amd64` architecture by running:
41+
```bash
42+
docker-compose build -f docker-compose-amd64.yaml
43+
```
3944

4045
### Run the sample
4146

decisioncenter/webhooknotifier/compose-odm-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
odm:
3-
image: icr.io/cpopen/odm-k8s/odm:9.0.0
3+
image: icr.io/cpopen/odm-k8s/odm:9.5
44
mem_limit: 4G
55
memswap_limit: 4G
66
user: "1001:0"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Comments are provided throughout this file to help you get started.
2+
# If you need more help, visit the Docker Compose reference guide at
3+
# https://docs.docker.com/go/compose-spec-reference/
4+
5+
# Here the instructions define your application as a service called "server".
6+
# This service is built from the Dockerfile in the current directory.
7+
# You can add other services your application may depend on here, such as a
8+
# database or a cache. For examples, see the Awesome Compose repository:
9+
# https://github.com/docker/awesome-compose
10+
services:
11+
slack:
12+
build:
13+
context: ./slack
14+
platforms:
15+
- "linux/amd64"
16+
environment:
17+
NODE_ENV: production
18+
ports:
19+
- 3000:3000
20+
logfile:
21+
build:
22+
context: ./files
23+
platforms:
24+
- "linux/amd64"
25+
environment:
26+
NODE_ENV: production
27+
ports:
28+
- 3010:3000

0 commit comments

Comments
 (0)