Skip to content

Commit 670a4b1

Browse files
Merge pull request #570 from awellnitz-materna/feature/improve-tutorials
fix(tutorials): Update API health check commands and add JSON parsing with jq
2 parents 0ba0454 + 34af763 commit 670a4b1

File tree

2 files changed

+47
-17
lines changed

2 files changed

+47
-17
lines changed

docs/tutorials/e2e/boost/provideData.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ curl --location 'http://localhost/bob/management/v2/assets' \
3030
"type": "HttpData",
3131
"baseUrl": "https://jsonplaceholder.typicode.com/todos/3"
3232
}
33-
}'
33+
}' | jq
3434
```
3535

3636
## Request catalog
@@ -51,7 +51,7 @@ curl --location 'http://localhost/alice/management/v2/catalog/request' \
5151
"offset": 0,
5252
"limit": 100
5353
}
54-
}'
54+
}' | jq
5555
```
5656

5757
## Create first access policy
@@ -73,11 +73,11 @@ curl --location 'http://localhost/bob/management/v2/policydefinitions' \
7373
"odrl": "http://www.w3.org/ns/odrl/2/"
7474
},
7575
"@type": "PolicyDefinitionRequestDto",
76-
"@id": "31",
76+
"@id": "3-1",
7777
"policy": {
7878
"@type": "Policy"
7979
}
80-
}'
80+
}' | jq
8181
```
8282

8383
## Request catalog - second try
@@ -98,7 +98,7 @@ curl --location 'http://localhost/alice/management/v2/catalog/request' \
9898
"offset": 0,
9999
"limit": 100
100100
}
101-
}'
101+
}' | jq
102102
```
103103

104104
## Create first contract definition
@@ -133,11 +133,11 @@ curl --location 'http://localhost/bob/management/v2/policydefinitions' \
133133
"odrl": "http://www.w3.org/ns/odrl/2/"
134134
},
135135
"@type": "PolicyDefinitionRequestDto",
136-
"@id": "32",
136+
"@id": "3-2",
137137
"policy": {
138138
"@type": "Policy"
139139
}
140-
}'
140+
}' | jq
141141
```
142142

143143
Action (Bob): Create a contract definition including the asset and the policies you have created. For this, use the following `curl` command:
@@ -150,15 +150,15 @@ curl --location 'http://localhost/bob/management/v2/contractdefinitions' \
150150
"@context": {},
151151
"@id": "3",
152152
"@type": "ContractDefinition",
153-
"accessPolicyId": "31",
154-
"contractPolicyId": "32",
153+
"accessPolicyId": "3-1",
154+
"contractPolicyId": "3-2",
155155
"assetsSelector": {
156156
"@type": "CriterionDto",
157157
"operandLeft": "https://w3id.org/edc/v0.0.1/ns/id",
158158
"operator": "=",
159159
"operandRight": "3"
160160
}
161-
}'
161+
}' | jq
162162
```
163163

164164
## Request catalog - third try
@@ -178,7 +178,7 @@ curl --location 'http://localhost/alice/management/v2/catalog/request' \
178178
"offset": 0,
179179
"limit": 100
180180
}
181-
}'
181+
}' | jq
182182
```
183183

184184
:::info

docs/tutorials/e2e/connect/deployComponents.md

+36-6
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,39 @@ For the most bare-bones installation of the dataspace, execute the following com
3939
```shell
4040
# get the tutorial including the config file for the cluster by cloning the repository locally
4141
git clone https://github.com/eclipse-tractusx/tutorial-resources.git
42+
```
43+
44+
```shell
4245
# will install the mxd directory under <current working directory>/tutorial-resources/mxd
4346
# the directory should contain the config file for kind: kind.config.yaml
4447
cd <path/of/mxd>
48+
```
49+
50+
```shell
4551
kind create cluster -n mxd --config kind.config.yaml
52+
```
53+
54+
```shell
4655
#
4756
# Now we activate ingress for the later port forwarding ?
4857
# the next step is specific to KinD and will be different for other Kubernetes runtimes!
4958
kubectl apply -f \
5059
https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
60+
```
61+
62+
```shell
5163
# wait until the ingress controller is ready
5264
kubectl wait --namespace ingress-nginx \
5365
--for=condition=ready pod \
5466
--selector=app.kubernetes.io/component=controller \
5567
--timeout=90s
68+
```
69+
70+
```shell
5671
terraform init
72+
```
73+
74+
```shell
5775
terraform apply
5876
# type "yes" and press enter when prompted to do so
5977
```
@@ -114,6 +132,9 @@ of simplicity we will use a plain Kubernetes port-forwarding:
114132
```shell
115133
# find out about the names of your pods
116134
kubectl get pods
135+
```
136+
137+
```shell
117138
# you should see a list like:
118139
NAME READY STATUS RESTARTS AGE
119140
alice-tractusx-connector-controlplane-6f7555bcb7-mhxh6 1/1 Running 0 4m
@@ -125,10 +146,13 @@ bob-vault-0 1/1 Running 0
125146
keycloak-6bdf4d7689-8mwfd 1/1 Running 0 4m58s
126147
miw-574bf87bc-c4n6c 1/1 Running 0 4m58s
127148
postgres-66677b8665-lxxp2 1/1 Running 0 5m14s
149+
```
150+
151+
```shell
128152
#
129153
# We will use the last entry for ingress for our port-forwarding, the name of the postgres pod will be slightly differnt in your local cluster.
130154
# now we activtae the kuberntes port-forwarding:
131-
kubectl port-forward postgres-66677b8665-lxxp2 5432:5423
155+
kubectl port-forward postgres-66677b8665-lxxp2 5432:5432
132156
```
133157

134158
> Note that the actual pod name will be slightly different in your local cluster.
@@ -148,8 +172,11 @@ assets, policies and contract definitions.
148172
In order to check that the connectors were deployed successfully, please execute the following commands in a shell:
149173

150174
```shell
151-
curl -X GET http://localhost/bob/health/api/check/liveness
152-
curl -X GET http://localhost/alice/health/api/check/liveness
175+
curl -X GET http://localhost/bob/health/api/check/liveness | jq
176+
```
177+
178+
```shell
179+
curl -X GET http://localhost/alice/health/api/check/liveness | jq
153180
```
154181

155182
which should return something similar to this, the important part being the `isSystemHealthy: true` bit:
@@ -175,7 +202,7 @@ which should return something similar to this, the important part being the `isS
175202
Once we've established the basic readiness of our connectors, we can move on to inspect a few data items:
176203

177204
```shell
178-
curl -X POST http://localhost/bob/management/v3/assets/request -H "x-api-key: password" -H "content-type: application/json"
205+
curl -X POST http://localhost/bob/management/v3/assets/request -H "x-api-key: password" -H "content-type: application/json" | jq
179206
```
180207

181208
This queries the `/assets` endpoint returning the entire list of assets that `bob` currently maintains. You should see
@@ -236,9 +263,12 @@ Note: the same thing can be done to inspect policies and contract definitions. T
236263

237264
```shell
238265
# policies:
239-
curl -X POST http://localhost/bob/management/v2/policydefinitions/request -H "x-api-key: password" -H "content-type: application/json"
266+
curl -X POST http://localhost/bob/management/v2/policydefinitions/request -H "x-api-key: password" -H "content-type: application/json" | jq
267+
```
268+
269+
```shell
240270
# contract defs:
241-
curl -X POST http://localhost/bob/management/v2/contractdefinitions/request -H "x-api-key: password" -H "content-type: application/json"
271+
curl -X POST http://localhost/bob/management/v2/contractdefinitions/request -H "x-api-key: password" -H "content-type: application/json" | jq
242272
```
243273

244274
Alternatively, please check out the [Postman collections here](./postman)

0 commit comments

Comments
 (0)