Skip to content

fix(tutorials): Update API health check commands and add JSON parsing with jq #570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

22 changes: 11 additions & 11 deletions docs/tutorials/e2e/boost/provideData.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ curl --location 'http://localhost/bob/management/v2/assets' \
"type": "HttpData",
"baseUrl": "https://jsonplaceholder.typicode.com/todos/3"
}
}'
}' | jq
```

## Request catalog
Expand All @@ -51,7 +51,7 @@ curl --location 'http://localhost/alice/management/v2/catalog/request' \
"offset": 0,
"limit": 100
}
}'
}' | jq
```

## Create first access policy
Expand All @@ -73,11 +73,11 @@ curl --location 'http://localhost/bob/management/v2/policydefinitions' \
"odrl": "http://www.w3.org/ns/odrl/2/"
},
"@type": "PolicyDefinitionRequestDto",
"@id": "31",
"@id": "3-1",
"policy": {
"@type": "Policy"
}
}'
}' | jq
```

## Request catalog - second try
Expand All @@ -98,7 +98,7 @@ curl --location 'http://localhost/alice/management/v2/catalog/request' \
"offset": 0,
"limit": 100
}
}'
}' | jq
```

## Create first contract definition
Expand Down Expand Up @@ -133,11 +133,11 @@ curl --location 'http://localhost/bob/management/v2/policydefinitions' \
"odrl": "http://www.w3.org/ns/odrl/2/"
},
"@type": "PolicyDefinitionRequestDto",
"@id": "32",
"@id": "3-2",
"policy": {
"@type": "Policy"
}
}'
}' | jq
```

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

## Request catalog - third try
Expand All @@ -178,7 +178,7 @@ curl --location 'http://localhost/alice/management/v2/catalog/request' \
"offset": 0,
"limit": 100
}
}'
}' | jq
```

:::info
Expand Down
42 changes: 36 additions & 6 deletions docs/tutorials/e2e/connect/deployComponents.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,39 @@ For the most bare-bones installation of the dataspace, execute the following com
```shell
# get the tutorial including the config file for the cluster by cloning the repository locally
git clone https://github.com/eclipse-tractusx/tutorial-resources.git
```

```shell
# will install the mxd directory under <current working directory>/tutorial-resources/mxd
# the directory should contain the config file for kind: kind.config.yaml
cd <path/of/mxd>
```

```shell
kind create cluster -n mxd --config kind.config.yaml
```

```shell
#
# Now we activate ingress for the later port forwarding ?
# the next step is specific to KinD and will be different for other Kubernetes runtimes!
kubectl apply -f \
https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
```

```shell
# wait until the ingress controller is ready
kubectl wait --namespace ingress-nginx \
--for=condition=ready pod \
--selector=app.kubernetes.io/component=controller \
--timeout=90s
```

```shell
terraform init
```

```shell
terraform apply
# type "yes" and press enter when prompted to do so
```
Expand Down Expand Up @@ -114,6 +132,9 @@ of simplicity we will use a plain Kubernetes port-forwarding:
```shell
# find out about the names of your pods
kubectl get pods
```

```shell
# you should see a list like:
NAME READY STATUS RESTARTS AGE
alice-tractusx-connector-controlplane-6f7555bcb7-mhxh6 1/1 Running 0 4m
Expand All @@ -125,10 +146,13 @@ bob-vault-0 1/1 Running 0
keycloak-6bdf4d7689-8mwfd 1/1 Running 0 4m58s
miw-574bf87bc-c4n6c 1/1 Running 0 4m58s
postgres-66677b8665-lxxp2 1/1 Running 0 5m14s
```

```shell
#
# 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.
# now we activtae the kuberntes port-forwarding:
kubectl port-forward postgres-66677b8665-lxxp2 5432:5423
kubectl port-forward postgres-66677b8665-lxxp2 5432:5432
```

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

```shell
curl -X GET http://localhost/bob/health/api/check/liveness
curl -X GET http://localhost/alice/health/api/check/liveness
curl -X GET http://localhost/bob/health/api/check/liveness | jq
```

```shell
curl -X GET http://localhost/alice/health/api/check/liveness | jq
```

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

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

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

```shell
# policies:
curl -X POST http://localhost/bob/management/v2/policydefinitions/request -H "x-api-key: password" -H "content-type: application/json"
curl -X POST http://localhost/bob/management/v2/policydefinitions/request -H "x-api-key: password" -H "content-type: application/json" | jq
```

```shell
# contract defs:
curl -X POST http://localhost/bob/management/v2/contractdefinitions/request -H "x-api-key: password" -H "content-type: application/json"
curl -X POST http://localhost/bob/management/v2/contractdefinitions/request -H "x-api-key: password" -H "content-type: application/json" | jq
```

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