diff --git a/content/blog/advanced-dispatching-constraints.md b/content/blog/advanced-dispatching-constraints.md index 2fbfbd69..181e7230 100644 --- a/content/blog/advanced-dispatching-constraints.md +++ b/content/blog/advanced-dispatching-constraints.md @@ -50,14 +50,21 @@ As soon as it has been imported, new mock endpoints are available and you can st ```sh $ curl https://microcks.apps.example.com/rest/WeatherForecast+API/1.0.0/forecast\?region\=east -k -s | jq . +``` +Output: +```json { "region": "east", "temp": -6.6, "weather": "frosty", "visibility": 523 } - +``` +```sh $ curl https://microcks.apps.example.com/rest/WeatherForecast+API/1.0.0/forecast\?region\=north -k -s | jq . +``` +Output: +```json { "region": "north", "temp": -1.5, @@ -91,14 +98,21 @@ So far so good but now let's try adding the `apiKey` parameter to our requests: ```sh $ curl https://microcks.apps.example.com/rest/WeatherForecast+API/1.0.0/forecast\?region\=east\&apiKey\=qwertyuiop -k -s | jq . +``` +output: +```json { "region": "north", "temp": -1.5, "weather": "snowy", "visibility": 25 } - +``` +```sh $ curl https://microcks.apps.example.com/rest/WeatherForecast+API/1.0.0/forecast\?region\=west\&apiKey\=qwertyuiop -k -s | jq . +``` +output: +```json { "region": "north", "temp": -1.5, @@ -125,14 +139,21 @@ Once saved, you will be able to test again the different mock URLs for the four ```sh $ curl https://microcks.apps.example.com/rest/WeatherForecast+API/1.0.0/forecast\?region\=west\&apiKey\=qwertyuiop -k -s | jq . +``` +output: +```json { "region": "west", "temp": 12.2, "weather": "rainy", "visibility": 300 } - +``` +```sh $ curl https://microcks.apps.example.com/rest/WeatherForecast+API/1.0.0/forecast\?region\=south\&apiKey\=qwertyuiop -k -s | jq . +``` +output: +```json { "region": "south", "temp": 28.3, @@ -145,6 +166,9 @@ $ curl https://microcks.apps.example.com/rest/WeatherForecast+API/1.0.0/forecast ```sh $ curl https://microcks.apps.example.com/rest/WeatherForecast+API/1.0.0/forecast\?region\=center\&apiKey\=qwertyuiop -s | jq . +``` +outut: +```json { "region": "north", "temp": -1.5, @@ -169,6 +193,9 @@ Hit the **Save** button and test again the previous curl command, you'll see tha ```sh $ curl https://microcks.apps.example.com/rest/WeatherForecast+API/1.0.0/forecast\?region\=center\&apiKey\=qwertyuiop -k +``` +output: +```sh Region is unknown. Choose in north, west, east or south.% ``` diff --git a/content/blog/async-features-with-docker-compose.md b/content/blog/async-features-with-docker-compose.md index aa29672f..7a03997d 100644 --- a/content/blog/async-features-with-docker-compose.md +++ b/content/blog/async-features-with-docker-compose.md @@ -29,6 +29,9 @@ Then, clone a fresh copy of Microcks Git repository: ```sh $ git clone https://github.com/microcks/microcks +``` +output: +```sh Cloning into 'microcks'... remote: Enumerating objects: 10546, done. remote: Counting objects: 100% (1802/1802), done. @@ -43,6 +46,9 @@ Go to the `docker-compose` installation folder and launch docker-compose with `a ```sh $ cd microcks/install/docker-compose $ docker-compose -f docker-compose.yml -f docker-compose-async-addon.yml up -d +``` +output: +```sh Creating network "docker-compose_default" with the default driver Pulling postman (quay.io/microcks/microcks-postman-runtime:latest)... latest: Pulling from microcks/microcks-postman-runtime @@ -92,6 +98,9 @@ After some minutes, check everything is running. Microcks app is bound on `local ```sh $ docker ps +``` +output: +```sh CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3779d9672ea1 quay.io/microcks/microcks-async-minion:latest "/deployments/run-ja…" About a minute ago Up 38 seconds 8080/tcp microcks-async-minion c2d7f3e10215 quay.io/microcks/microcks:latest "/deployments/run-ja…" About a minute ago Up About a minute 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 8778/tcp, 0.0.0.0:9090->9090/tcp, :::9090->9090/tcp, 9779/tcp microcks @@ -114,8 +123,11 @@ You should have following result: Check the relevant logs on `microcks` container: -``` +```sh $ docker logs c2d7f3e10215 +``` +output: +```sh ... 12:49:09.245 DEBUG 1 --- [080-exec-9] io.github.microcks.web.JobController : Creating new job: io.github.microcks.domain.ImportJob@2c6712c7 12:49:09.404 DEBUG 1 --- [080-exec-6] io.github.microcks.web.JobController : Getting job list for page 0 and size 20 @@ -147,6 +159,9 @@ From now, you should start having messages on the Kafka broker. Check the releva ```sh $ docker logs 3779d9672ea1 +``` +output: +```sh 2021-08-30 12:49:11,234 INFO [io.git.mic.min.asy.AsyncMockDefinitionUpdater] (vert.x-eventloop-thread-0) Received a new change event [CREATED] for '612ca95fb327764983693ef1', at 1630327750357 2021-08-30 12:49:11,236 INFO [io.git.mic.min.asy.AsyncMockDefinitionUpdater] (vert.x-eventloop-thread-0) Found 'SUBSCRIBE user/signedup' as a candidate for async message mocking 2021-08-30 12:49:11,267 INFO [io.git.mic.min.asy.SchemaRegistry] (vert.x-eventloop-thread-0) Updating schema registry for 'User signed-up API - 0.1.1' with 1 entries @@ -163,6 +178,9 @@ Check the Kafka topic for messages, directly from your machine shell using `kafk ```sh $ kafkacat -b localhost:9092 -t UsersignedupAPI-0.1.1-user-signedup -o end +``` +output: +```sh % Auto-selecting Consumer mode (use -P or -C to override) % Reached end of topic UsersignedupAPI-0.1.1-user-signedup [0] at offset 356 {"id": "vcGIcN5mwytIFqtdaEljCRfDrDHg0u3u", "sendAt": "1630327965424", "fullName": "Laurent Broudoux", "email": "laurent@microcks.io", "age": 41} @@ -178,20 +196,33 @@ You can also connect to the running `microcks-kafka` container to use the built- ```sh $ docker exec -it 7e1f2d2c5305 /bin/sh +``` +```sh sh-4.2$ cd bin/ sh-4.2$ ./kafka-topics.sh --bootstrap-server kafka:19092 --list +``` +output: +```sh UsersignedupAPI-0.1.1-user-signedup __consumer_offsets microcks-services-updates - +``` +```sh sh-4.2$ ./kafka-console-consumer.sh --bootstrap-server kafka:19092 --topic UsersignedupAPI-0.1.1-user-signedup +``` +output: +```json {"id": "T1smkgqMAmyb2UVKXDAYKw5Vtx8KD9up", "sendAt": "1630328127425", "fullName": "Laurent Broudoux", "email": "laurent@microcks.io", "age": 41} {"id":"NvKLRGG91NsyoK9dj9CGlk2D8NrqaZuC","sendAt":"1630328127429","fullName":"John Doe","email":"john@microcks.io","age":36} {"id": "f85zgAtDzvku7Uztp58UDfTokvePJxlg", "sendAt": "1630328130425", "fullName": "Laurent Broudoux", "email": "laurent@microcks.io", "age": 41} {"id":"YbJA2ZeOKVaw0qNbMgMOi3TE3pPtwFM7","sendAt":"1630328130429","fullName":"John Doe","email":"john@microcks.io","age":36} ^CProcessed a total of 4 messages - -sh-4.2$ exit +``` +```sh +sh-4.2$ exit or press ctrl+D +``` +output: +```sh exit ``` @@ -203,6 +234,9 @@ Happy with your Microcks discovery? You can turn off everything and free resourc ```sh $ docker-compose -f docker-compose.yml -f docker-compose-async-addon.yml down +``` +output: +```sh Stopping microcks-async-minion ... done Stopping microcks ... done Stopping microcks-kafka ... done diff --git a/content/blog/extend-microcks-with-custom-libs.md b/content/blog/extend-microcks-with-custom-libs.md index f423bfe3..7bd10ffa 100644 --- a/content/blog/extend-microcks-with-custom-libs.md +++ b/content/blog/extend-microcks-with-custom-libs.md @@ -46,6 +46,8 @@ We have set up a specific GitHub repository to illustrate those extension endpoi ```sh $ tree +``` +```sh === OUTPUT === . |____Dockerfile.acme @@ -236,6 +238,8 @@ In this configuration, we will have four containers running - with additional `m ```sh $ docker ps +``` +```sh === OUTPUT === CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 5d314d3bf8b0 quay.io/microcks/microcks-async-minion:nightly "/deployments/run-ja…" 5 seconds ago Up 1 second 8080/tcp, 0.0.0.0:8081->8081/tcp microcks-async-minion diff --git a/content/blog/integrating-in-apicurio-keycloak.md b/content/blog/integrating-in-apicurio-keycloak.md index 49010705..f0c69c99 100644 --- a/content/blog/integrating-in-apicurio-keycloak.md +++ b/content/blog/integrating-in-apicurio-keycloak.md @@ -27,9 +27,9 @@ Also for users who just want to take the installation for a spin on localhost, m The steps to setup Apicurio are similar to the steps mentioned in their GitHub docker-compose readme page. As of writing this article, Apicurio is at version `BETA 2.46` - Clone the Apicurio repository in a convenient location - ```sh +```sh git clone https://github.com/Apicurio/apicurio-studio.git - ``` +``` - Cd to the directory to enter the Apicurio docker-compose installation workspace. Its now time to make a few edits ```sh diff --git a/content/blog/microcks-1.1.0-release.md b/content/blog/microcks-1.1.0-release.md index 50607f6f..9e55f262 100644 --- a/content/blog/microcks-1.1.0-release.md +++ b/content/blog/microcks-1.1.0-release.md @@ -42,6 +42,9 @@ Run it in less than 100 ms and use a single command line: thanks to [Quarkus](ht ```sh $ docker run -i --rm -p 8282:8282 quay.io/microcks/quarkus-api-pastry:latest +``` +output: +```sh __ ____ __ _____ ___ __ ____ ______ --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \ diff --git a/content/blog/microcks-1.11.0-release.md b/content/blog/microcks-1.11.0-release.md index e79bc116..2d5f47cd 100644 --- a/content/blog/microcks-1.11.0-release.md +++ b/content/blog/microcks-1.11.0-release.md @@ -46,6 +46,8 @@ Just issue an invalid call to this endpoint - changing the price to a string for $ curl -X PATCH 'http://localhost:8080/rest-valid/API+Pastries/0.0.1/pastries/Eclair+Cafe' \ -H 'Accept: application/json' -H 'Content-Type: application/json' \ -d '{ "price": "2.6" }' -v +``` +```sh === OUTPUT === [...] < HTTP/1.1 400 diff --git a/content/blog/microcks-1.5.0-release.md b/content/blog/microcks-1.5.0-release.md index f7c1297f..5764f612 100644 --- a/content/blog/microcks-1.5.0-release.md +++ b/content/blog/microcks-1.5.0-release.md @@ -42,9 +42,13 @@ For this reason, we decided to enhance things up and make the deployment of Micr ```sh $ docker-compose -f docker-compose.yml -f docker-compose-async-addon.yml up -d -[...] +``` +```sh $ docker stats --format "table {{.Container}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}" +``` +output: +```sh CONTAINER NAME CPU % MEM USAGE / LIMIT 3687d032ecad microcks-async-minion 1.82% 266.2MiB / 6.789GiB 5ab9aaf5bed2 microcks 0.67% 325.1MiB / 6.789GiB @@ -63,9 +67,13 @@ Let now see the results using the new 1.5.0 `docker-compose-devmode.yml` file: ```sh $ docker-compose -f docker-compose-devmode.yml up -d -[...] +``` +```sh $ docker stats --format "table {{.Container}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}" +``` +output: +```sh CONTAINER NAME CPU % MEM USAGE / LIMIT 832548c518d3 microcks-async-minion 2.06% 243.2MiB / 6.789GiB 6641782436b5 microcks 0.52% 311.8MiB / 6.789GiB diff --git a/content/blog/microcks-on-kind.md b/content/blog/microcks-on-kind.md index 36c24160..22bd639c 100644 --- a/content/blog/microcks-on-kind.md +++ b/content/blog/microcks-on-kind.md @@ -20,8 +20,12 @@ As a Mac user, I used [brew](https://brew.sh) to install `kind`. However, it is ```sh $ brew install kind - +``` +```sh $ kind --version +``` +output: +```sh kind version 0.20.0 ``` @@ -57,6 +61,8 @@ We're now going to start a Kube cluster. Start your `kind` cluster using the `cl ```sh $ kind create cluster --config=cluster-kind.yaml +``` +```sh --- OUTPUT --- Creating cluster "kind" ... ✓ Ensuring node image (kindest/node:v1.27.3) 🖼 @@ -71,7 +77,7 @@ You can now use your cluster with: kubectl cluster-info --context kind-kind Have a question, bug, or feature request? Let us know! https://kind.sigs.k8s.io/#community 🙂 -``` + Install an Ingress Controller in this cluster, we selected `nginx` but other options are available (see https://kind.sigs.k8s.io/docs/user/ingress). @@ -98,6 +104,8 @@ $ kubectl create namespace microcks $ helm repo add microcks https://microcks.io/helm $ helm install microcks microcks/microcks --namespace microcks --set microcks.url=microcks.127.0.0.1.nip.io --set keycloak.url=keycloak.127.0.0.1.nip.io --set keycloak.privateUrl=http://microcks-keycloak.microcks.svc.cluster.local:8080 +``` +```sh --- OUTPUT --- NAME: microcks LAST DEPLOYED: Sun Dec 3 19:27:27 2023 @@ -130,6 +138,8 @@ Wait for images to be pulled, pods to be started and ingresses to be there: ```sh $ kubectl get pods -n microcks +``` +```sh --- OUTPUT --- NAME READY STATUS RESTARTS AGE microcks-577874c5b6-z97zm 1/1 Running 0 73s @@ -137,8 +147,11 @@ microcks-keycloak-7477cd4fbb-tbmg7 1/1 Running 0 21s microcks-keycloak-postgresql-868b7dbdd4-8zrbv 1/1 Running 0 10m microcks-mongodb-78888fb67f-47fwh 1/1 Running 0 10m microcks-postman-runtime-5d8fc9695-kp45w 1/1 Running 0 10m - +``` +```sh $ kubectl get ingresses -n microcks +``` +```sh --- OUTPUT --- NAME CLASS HOSTS ADDRESS PORTS AGE microcks microcks.127.0.0.1.nip.io localhost 80, 443 10m @@ -170,6 +183,8 @@ Now, you can install Microcks using the Helm chart and enable the asynchronous f ```sh $ helm install microcks microcks/microcks --namespace microcks --set microcks.url=microcks.127.0.0.1.nip.io --set keycloak.url=keycloak.127.0.0.1.nip.io --set keycloak.privateUrl=http://microcks-keycloak.microcks.svc.cluster.local:8080 --set features.async.enabled=true --set features.async.kafka.url=kafka.127.0.0.1.nip.io +``` +```sh --- OUTPUT --- NAME: microcks LAST DEPLOYED: Sun Dec 3 20:14:38 2023 @@ -208,6 +223,8 @@ Watch and check the pods you should get in the namespace: ```sh $ kubectl get pods -n microcks +``` +```sh --- OUTPUT --- NAME READY STATUS RESTARTS AGE microcks-6ffcc7dc54-c9h4w 1/1 Running 0 68s @@ -231,6 +248,8 @@ Now connect to the Kafka broker pod to check a topic has been correctly created ```sh $ kubectl -n microcks exec microcks-kafka-kafka-0 -it -- /bin/sh +``` +```sh --- INPUT --- sh-4.4$ cd bin sh-4.4$ ./kafka-topics.sh --bootstrap-server localhost:9092 --list @@ -253,6 +272,8 @@ And finally, from your Mac host, you can install the [`kcat`](https://github.com ```sh $ kcat -b microcks-kafka.kafka.127.0.0.1.nip.io:443 -X security.protocol=SSL -X ssl.ca.location=ca.crt -t UsersignedupAPI-0.1.1-user-signedup +``` +```sh --- OUTPUT --- % Auto-selecting Consumer mode (use -P or -C to override) {"id": "zYcAzFlRoTGvu9Mu4ajg30lr1fBa4Kah", "sendAt": "1703699827456", "fullName": "Laurent Broudoux", "email": "laurent@microcks.io", "age": 41} @@ -270,10 +291,15 @@ Deleting the microcks Helm release from your cluster is straightforward. Then yo ```sh $ helm delete microcks -n microcks +``` +```sh --- OUTPUT --- release "microcks" uninstalled - +``` +```sh $ kind delete cluster +``` +```sh --- OUTPUT --- Deleting cluster "kind" ... Deleted nodes: ["kind-control-plane"] diff --git a/content/blog/microcks-on-minikube.md b/content/blog/microcks-on-minikube.md index 61b7d151..3bfc086c 100644 --- a/content/blog/microcks-on-minikube.md +++ b/content/blog/microcks-on-minikube.md @@ -22,6 +22,9 @@ As a Mac user, I used [brew](https://brew.sh) to install `minikube`. However, it $ brew install minikube $ minikube version +``` +output: +```sh minikube version: v1.29.0 commit: ddac20b4b34a9c8c857fc602203b6ba2679794d3 ``` @@ -41,6 +44,8 @@ We're now going to start a Kube cluster. Start your `minikube` cluster with the ```sh $ minikube start +``` +```sh --- OUTPUT --- 😄 minikube v1.29.0 sur Darwin 14.1.2 (arm64) ✨ Utilisation du pilote docker basé sur le profil existant @@ -72,6 +77,8 @@ You need to enable the `ingress` add-on if not already set by default: ```sh $ minikube addons enable ingress +``` +```sh --- OUTPUT --- 💡 ingress est un addon maintenu par Kubernetes. Pour toute question, contactez minikube sur GitHub. Vous pouvez consulter la liste des mainteneurs de minikube sur : https://github.com/kubernetes/minikube/blob/master/OWNERS @@ -87,6 +94,8 @@ You can check connection to the cluster and that Ingresses are OK running the fo ```sh $ kubectl get pods -n ingress-nginx +``` +```sh --- OUTPUT --- NAME READY STATUS RESTARTS AGE ingress-nginx-admission-create-dz95x 0/1 Completed 0 26m @@ -102,6 +111,8 @@ Then, we'll need to prepare the `/etc/hosts` file to access Microcks using an In ```sh $ cat /etc/hosts +``` +```sh --- OUTPUT --- ## # Host Database @@ -122,6 +133,8 @@ $ kubectl create namespace microcks $ helm repo add microcks https://microcks.io/helm $ helm install microcks microcks/microcks --namespace microcks --set microcks.url=microcks.m.minikube.local --set keycloak.url=keycloak.m.minikube.local --set keycloak.privateUrl=http://microcks-keycloak.microcks.svc.cluster.local:8080 +``` +```sh --- OUTPUT --- NAME: microcks LAST DEPLOYED: Tue Dec 19 15:23:23 2023 @@ -154,6 +167,8 @@ Wait for the images to be pulled, pods to be started and ingresses to be there: ```sh $ kubectl get pods -n microcks +``` +```sh --- OUTPUT --- NAME READY STATUS RESTARTS AGE microcks-865b66d867-httf7 1/1 Running 0 56s @@ -174,6 +189,8 @@ To access the ingress from your browser, you'll need to start the networking tun ```sh $ minikube tunnel +``` +```sh --- OUTPUT --- ✅ Tunnel démarré avec succès @@ -210,6 +227,8 @@ Then, you'll also have to update your `/etc/hosts` file so that we’ll can acc ```sh $ cat /etc/hosts +``` +```sh --- OUTPUT --- ## # Host Database @@ -232,6 +251,9 @@ Now, you can install Microcks using the Helm chart and enable the asynchronous f ```sh $ helm install microcks microcks/microcks --namespace microcks --set microcks.url=microcks.m.minikube.local --set keycloak.url=keycloak.m.minikube.local --set keycloak.privateUrl=http://microcks-keycloak.microcks.svc.cluster.local:8080 --set features.async.enabled=true --set features.async.kafka.url=kafka.m.minikube.local + +``` +```sh --- OUTPUT --- NAME: microcks LAST DEPLOYED: Tue Dec 26 15:07:35 2023 @@ -269,6 +291,8 @@ Watch and check the pods you should get in the namespace (this can take a bit lo ```sh $ kc get pods -n microcks +``` +```sh --- OUTPUT --- NAME READY STATUS RESTARTS AGE microcks-5fbf679987-kzctj 1/1 Running 1 (116s ago) 4m32s @@ -291,6 +315,8 @@ Now connect to the Kafka broker pod to check a topic has been correctly created ```sh $ kubectl -n microcks exec microcks-kafka-kafka-0 -it -- /bin/sh +``` +```sh --- INPUT --- sh-4.4$ cd bin sh-4.4$ ./kafka-topics.sh --bootstrap-server localhost:9092 --list @@ -315,6 +341,8 @@ And finally, from your Mac host, you can install the [`kcat`](https://github.com ```sh $ kcat -b microcks-kafka.kafka.m.minikube.local:443 -X security.protocol=SSL -X ssl.ca.location=ca.crt -t UsersignedupAPI-0.1.1-user-signedup +``` +```sh --- OUTPUT --- % Auto-selecting Consumer mode (use -P or -C to override) {"id": "FrncZaUsQFWPlcKSm4onTrw3o0sXhMkJ", "sendAt": "1703600745149", "fullName": "Laurent Broudoux", "email": "laurent@microcks.io", "age": 41} @@ -332,6 +360,8 @@ Deleting the microcks Helm release from your cluster is straightforward. Then yo ```sh $ helm delete microcks -n microcks +``` +```sh --- OUTPUT --- release "microcks" uninstalled diff --git a/content/blog/mocking-oidc-redirect.md b/content/blog/mocking-oidc-redirect.md index c789213e..261697e1 100644 --- a/content/blog/mocking-oidc-redirect.md +++ b/content/blog/mocking-oidc-redirect.md @@ -114,6 +114,8 @@ Loading this OpenAPI specification file into Microcks will give you a local endp ```shell $ curl -X GET 'http://localhost:8080/rest/GitHub+OIDC/1.1.4/login/oauth/authorize?response_type=code&client_id=GHCLIENT&scope=openid+user:email&redirect_uri=http://localhost:8080/Login/githubLoginSuccess&state=e956e017-5e13-4c9d-b83b-6dd6337a6a86' -v +``` +```sh ==== OUTPUT ==== [...] > diff --git a/content/blog/observability-for-microcks-at-scale.md b/content/blog/observability-for-microcks-at-scale.md index f5621faa..fdf4ad01 100644 --- a/content/blog/observability-for-microcks-at-scale.md +++ b/content/blog/observability-for-microcks-at-scale.md @@ -84,6 +84,8 @@ To get the above data and visualizations, we ran the benchmarking suite powered ```shell $ docker run --rm -i -e BASE_URL=${MICROCKS_BASE_URL} -e WAIT_TIME=0.1 grafana/k6:${K6_VERSION} run - < bench-microcks.js +``` +```sh /\ |‾‾| /‾‾/ /‾‾/ /\ / \ | |/ / / / diff --git a/content/blog/podman-compose-support.md b/content/blog/podman-compose-support.md index eb38e986..e365263c 100644 --- a/content/blog/podman-compose-support.md +++ b/content/blog/podman-compose-support.md @@ -26,6 +26,9 @@ Then it's just a matter of cloning the repository, navigating to correct folder $ git clone https://github.com/microcks/microcks.git $ cd microcks/install/podman-compose $ ./run-microcks.sh +``` +output: +```sh Running rootless containers... Discovered host IP address: 192.168.3.102 @@ -50,6 +53,9 @@ Want to see what's running? Check the running containers with: ```sh $ podman ps +``` +output: +```sh CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 68faf7825db1 quay.io/microcks/microcks:latest 8 seconds ago Up 7 seconds ago 0.0.0.0:8080->8080/tcp microcks 71af3326ba9d docker.io/jboss/keycloak:10.0.1 -b 0.0.0.0 -Dkeyc... 9 seconds ago Up 9 seconds ago 0.0.0.0:8180->8080/tcp microcks-keycloak diff --git a/content/blog/simulating-cloudevents-with-asyncapi.md b/content/blog/simulating-cloudevents-with-asyncapi.md index d087a2b4..46438333 100644 --- a/content/blog/simulating-cloudevents-with-asyncapi.md +++ b/content/blog/simulating-cloudevents-with-asyncapi.md @@ -126,6 +126,8 @@ Since release [1.2.0](https://microcks.io/blog/microcks-1.2.0-release/), Microc ```shell $ kafkacat -b my-cluster-kafka-bootstrap.apps.try.microcks.io:9092 -t UsersignedupCloudEventsAPI_0.1.3_user-signedup -s value=avro -r http://apicurio-registry.apps.try.microcks.io/api/ccompat -o end -f 'Headers: %h - Value: %s\n' +``` +```sh --- OUTPUT % Auto-selecting Consumer mode (use -P or -C to override) % Reached end of topic UsersignedupCloudEventsAPI_0.1.3_user-signedup [0] at offset 276 diff --git a/content/documentation/explanations/dispatching.md b/content/documentation/explanations/dispatching.md index 5c875084..c821d0ff 100644 --- a/content/documentation/explanations/dispatching.md +++ b/content/documentation/explanations/dispatching.md @@ -93,7 +93,9 @@ Let start by creating a new beer coming from Belgium: $ curl -X POST http://microcks.example.com/rest/Beer+Catalog+API/1.0/beer \ -H 'Content-type: application/json' \ -d '{"name": "Abbey Brune", "country": "Belgium", "type": "Brown ale", "rating": 4.2, "references": [ { "referenceId": 1234 }, { "referenceId": 5678 } ]}' - +``` +output: +```sh { "name": "Abbey Brune", "country": "Belgium", @@ -114,7 +116,9 @@ Now let's try with a German beer... You'll see that the `Not accepted` response $ curl -X POST http://microcks.example.com/rest/Beer+Catalog+API/1.0/beer \ -H 'Content-type: application/json' \ -d '{"name": "Spaten Oktoberfiest", "country": "Germany", "type": "Amber", "rating": 2.8, "references": []}' - +``` +output: +```sh < HTTP/1.1 406 { "error": "Not accepted", @@ -142,7 +146,9 @@ Just issue a Http request with an unmanaged region like below: ```sh $ curl 'https://microcks.apps.example.com/rest/WeatherForecast+API/1.0.0/forecast?region=center&apiKey=qwertyuiop' -k - +``` +output: +```sh Region is unknown. Choose in north, west, east or south.% ``` diff --git a/content/documentation/explanations/dynamic-content.md b/content/documentation/explanations/dynamic-content.md index 95b4648f..13fa41f1 100644 --- a/content/documentation/explanations/dynamic-content.md +++ b/content/documentation/explanations/dynamic-content.md @@ -32,15 +32,23 @@ When invoked twice with different params at different dates, here are the result ```sh $ curl -XGET http://microcks.example.com/rest/Hello+Dynamic+API/1.0.0/hello -H 'Content-type: application/json' \ -d '{"name": "World"}' -s | jq . + +``` +output: +```json { "id": "pQnDIytzeYJFLxaQg56yObw0WTpYNBMjPYu7FLBoNSGF6ZJsTcHov5ZmaiWG8Gt8", "date": "10/02/2020", "message": "Hello World!" } - +``` # Wait for a day... +```sh $ curl -XGET http://microcks.example.com/rest/Hello+Dynamic+API/1.0.0/hello -H 'Content-type: application/json' \ -d '{"name": "Laurent"}' -s | jq . +``` +output: +```json { "id": "Hn9lUKkzYsvQq98wDEHa7Ln3H4eVfnfpJLLPPe4ns9vBgaTRvblOOBHIVq3BluEC", "date": "11/02/2020", diff --git a/content/documentation/explanations/service-account.md b/content/documentation/explanations/service-account.md index b80c645c..5fb8f958 100644 --- a/content/documentation/explanations/service-account.md +++ b/content/documentation/explanations/service-account.md @@ -21,6 +21,9 @@ Just issue the following unauthenticated API call to Microcks to get the Keycloa ```sh $ curl https://microcks.example.com/api/keycloak/config -s -k | jq . +``` +output: +```json { "realm": "microcks", "resource": "microcks-app-js", @@ -62,10 +65,15 @@ As a sum-up, here's some basic commands showing you how to use this service acco # account:credentials should be first encoded as base 64 $ echo "microcks-serviceaccount:ab54d329-e435-41ae-a900-ec6b3fe15c54" | base64 bWljcm9ja3Mtc2VydmljZWFjY291bnQ6YWI1NGQzMjktZTQzNS00MWFlLWE5MDAtZWM2YjNmZTE1YzU0Cg= - +``` +output: +```sh # then you issue a POST command to authenticate and retrieve an access_token from Keycloak # the grant_type used is client_credentials $ curl -X POST https://keycloak.microcks.example.com/realms/microcks/protocol/openid-connect/token -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: application/json' -H 'Authorization: Basic bWljcm9ja3Mtc2VydmljZWFjY291bnQ6YWI1NGQzMjktZTQzNS00MWFlLWE5MDAtZWM2YjNmZTE1YzU0Cg=' -d 'grant_type=client_credentials' -k -s | jq . +``` +output: +```json { "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJnTVY5OUNfdHRCcDNnSy0tUklaYkY5TDJUWkdpTWZUSWQwaXNrXzh4TElZIn0.eyJleHAiOjE3MTcwNzA0MTQsImlhdCI6MTcxNzA3MDExNCwianRpIjoiM2YyYWZkMjgtMzQ3Ny00NjJiLWIzYmEtNDljZTE3NGQwMTViIiwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo4MTgwL3JlYWxtcy9taWNyb2NrcyIsImF1ZCI6WyJtaWNyb2Nrcy1hcHAiLCJhY2NvdW50Il0sInN1YiI6IjY5OGZhMzM5LTk5NjEtNDA0ZC1iMjUwLTRhMzQ5MzY2ZDQ2ZCIsInR5cCI6IkJlYXJlciIsImF6cCI6Im1pY3JvY2tzLXNlcnZpY2VhY2NvdW50IiwiYWNyIjoiMSIsInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJvZmZsaW5lX2FjY2VzcyIsInVtYV9hdXRob3JpemF0aW9uIiwiZGVmYXVsdC1yb2xlcy1taWNyb2NrcyJdfSwicmVzb3VyY2VfYWNjZXNzIjp7Im1pY3JvY2tzLWFwcCI6eyJyb2xlcyI6WyJ1c2VyIl19LCJhY2NvdW50Ijp7InJvbGVzIjpbIm1hbmFnZS1hY2NvdW50IiwibWFuYWdlLWFjY291bnQtbGlua3MiLCJ2aWV3LXByb2ZpbGUiXX19LCJzY29wZSI6ImVtYWlsIHByb2ZpbGUiLCJjbGllbnRIb3N0IjoiMTcyLjE3LjAuMSIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwicHJlZmVycmVkX3VzZXJuYW1lIjoic2VydmljZS1hY2NvdW50LW1pY3JvY2tzLXNlcnZpY2VhY2NvdW50IiwiY2xpZW50QWRkcmVzcyI6IjE3Mi4xNy4wLjEiLCJjbGllbnRfaWQiOiJtaWNyb2Nrcy1zZXJ2aWNlYWNjb3VudCJ9.FgWaKrZthEEK4pAyd9n8mMxCfErCzXN8l8QUaAI9-VYfwfy1qXAqpqtL8rTtOf4MiAV0P7ntz1firmv6GfaInHD9FMbysXOtp6RVB3Jj0ITNqsR-Guw6lYZIKg5ECtqLw3x5cISaq00VGTIOpZDGVn8GRM-a6XQHvfRJzPqgZXELWIhxCzmBor2Sv8m35E_jNQT-cMNrd7XPdRfFYcYqxQgOmez1N9uHg0kajWJEHKFu1TFaa1HT2vaFB6QgNnJusiEIVEltK7FG42SC1QXH9LmUJC9FK7jRTqJx43VMLOCT4xnwsimVq6vlYr_TCsrCB7HqSZUQqeer9cddRnsfag", "expires_in": 300, @@ -74,6 +82,9 @@ $ curl -X POST https://keycloak.microcks.example.com/realms/microcks/protocol/op "not-before-policy": 0, "scope": "email profile" } +``` +output: +```sh # finally, you can reuse this access_token as the bearer to call Microcks APIs $ curl https://microcks.example.com/api/services -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJnTVY5OUNfdHRCcDNnSy0tUklaYkY5TDJUWkdpTWZUSWQwaXNrXzh4TElZIn0.eyJleHAiOjE3MTcwNzA0MTQsImlhdCI6MTcxNzA3MDExNCwianRpIjoiM2YyYWZkMjgtMzQ3Ny00NjJiLWIzYmEtNDljZTE3NGQwMTViIiwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo4MTgwL3JlYWxtcy9taWNyb2NrcyIsImF1ZCI6WyJtaWNyb2Nrcy1hcHAiLCJhY2NvdW50Il0sInN1YiI6IjY5OGZhMzM5LTk5NjEtNDA0ZC1iMjUwLTRhMzQ5MzY2ZDQ2ZCIsInR5cCI6IkJlYXJlciIsImF6cCI6Im1pY3JvY2tzLXNlcnZpY2VhY2NvdW50IiwiYWNyIjoiMSIsInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJvZmZsaW5lX2FjY2VzcyIsInVtYV9hdXRob3JpemF0aW9uIiwiZGVmYXVsdC1yb2xlcy1taWNyb2NrcyJdfSwicmVzb3VyY2VfYWNjZXNzIjp7Im1pY3JvY2tzLWFwcCI6eyJyb2xlcyI6WyJ1c2VyIl19LCJhY2NvdW50Ijp7InJvbGVzIjpbIm1hbmFnZS1hY2NvdW50IiwibWFuYWdlLWFjY291bnQtbGlua3MiLCJ2aWV3LXByb2ZpbGUiXX19LCJzY29wZSI6ImVtYWlsIHByb2ZpbGUiLCJjbGllbnRIb3N0IjoiMTcyLjE3LjAuMSIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwicHJlZmVycmVkX3VzZXJuYW1lIjoic2VydmljZS1hY2NvdW50LW1pY3JvY2tzLXNlcnZpY2VhY2NvdW50IiwiY2xpZW50QWRkcmVzcyI6IjE3Mi4xNy4wLjEiLCJjbGllbnRfaWQiOiJtaWNyb2Nrcy1zZXJ2aWNlYWNjb3VudCJ9.FgWaKrZthEEK4pAyd9n8mMxCfErCzXN8l8QUaAI9-VYfwfy1qXAqpqtL8rTtOf4MiAV0P7ntz1firmv6GfaInHD9FMbysXOtp6RVB3Jj0ITNqsR-Guw6lYZIKg5ECtqLw3x5cISaq00VGTIOpZDGVn8GRM-a6XQHvfRJzPqgZXELWIhxCzmBor2Sv8m35E_jNQT-cMNrd7XPdRfFYcYqxQgOmez1N9uHg0kajWJEHKFu1TFaa1HT2vaFB6QgNnJusiEIVEltK7FG42SC1QXH9LmUJC9FK7jRTqJx43VMLOCT4xnwsimVq6vlYr_TCsrCB7HqSZUQqeer9cddRnsfag' -k -s | jq . diff --git a/content/documentation/guides/automation/tekton.md b/content/documentation/guides/automation/tekton.md index bb2fa8b6..d0298bce 100644 --- a/content/documentation/guides/automation/tekton.md +++ b/content/documentation/guides/automation/tekton.md @@ -92,6 +92,9 @@ The parameters that can be set here are: ```sh $ tkn pipelinerun start user-registration-tekton-pipeline +``` +output: +```sh PipelineRun started: user-registration-tekton-pipeline-run-64xf7 Showing logs... [...] @@ -101,6 +104,9 @@ Showing logs... ```sh $ tkn pipeline logs user-registration-tekton-pipeline-run-64xf7 -f -n user-registration +``` +output: +```sh [...] [test-openapi-v1 : microcks-test] MicrocksClient got status for test "5f76e969dcba620f6d21008d" - success: false, inProgress: true diff --git a/content/documentation/guides/installation/kind-helm.md b/content/documentation/guides/installation/kind-helm.md index da6dd0ba..f6c99e7a 100644 --- a/content/documentation/guides/installation/kind-helm.md +++ b/content/documentation/guides/installation/kind-helm.md @@ -21,8 +21,10 @@ As being on a Mac, people usually use [brew](https://brew.sh) to install `kind`. ```sh $ brew install kind - $ kind --version +``` +output: +```sh kind version 0.20.0 ``` @@ -58,6 +60,8 @@ We're now going to start a Kube cluster. Start your `kind` cluster using the `cl ```sh $ kind create cluster --config=cluster-kind.yaml +``` +```sh --- OUTPUT --- Creating cluster "kind" ... ✓ Ensuring node image (kindest/node:v1.27.3) 🖼 @@ -99,6 +103,9 @@ $ kubectl create namespace microcks $ helm repo add microcks https://microcks.io/helm $ helm install microcks microcks/microcks --namespace microcks --set microcks.url=microcks.127.0.0.1.nip.io --set keycloak.url=keycloak.127.0.0.1.nip.io --set keycloak.privateUrl=http://microcks-keycloak.microcks.svc.cluster.local:8080 +``` +output: +```sh --- OUTPUT --- NAME: microcks LAST DEPLOYED: Sun Dec 3 19:27:27 2023 @@ -131,6 +138,8 @@ Wait for images to be pulled, pods to be started and ingresses to be there: ```sh $ kubectl get pods -n microcks +``` +```sh --- OUTPUT --- NAME READY STATUS RESTARTS AGE microcks-577874c5b6-z97zm 1/1 Running 0 73s @@ -138,8 +147,11 @@ microcks-keycloak-7477cd4fbb-tbmg7 1/1 Running 0 21s microcks-keycloak-postgresql-868b7dbdd4-8zrbv 1/1 Running 0 10m microcks-mongodb-78888fb67f-47fwh 1/1 Running 0 10m microcks-postman-runtime-5d8fc9695-kp45w 1/1 Running 0 10m - +``` +```sh $ kubectl get ingresses -n microcks +``` +```sh --- OUTPUT --- NAME CLASS HOSTS ADDRESS PORTS AGE microcks microcks.127.0.0.1.nip.io localhost 80, 443 10m @@ -171,6 +183,8 @@ Now, you can install Microcks using the Helm chart and enable the asynchronous f ```sh $ helm install microcks microcks/microcks --namespace microcks --set microcks.url=microcks.127.0.0.1.nip.io --set keycloak.url=keycloak.127.0.0.1.nip.io --set keycloak.privateUrl=http://microcks-keycloak.microcks.svc.cluster.local:8080 --set features.async.enabled=true --set features.async.kafka.url=kafka.127.0.0.1.nip.io +``` +```sh --- OUTPUT --- NAME: microcks LAST DEPLOYED: Sun Dec 3 20:14:38 2023 @@ -209,6 +223,8 @@ Watch and check the pods you should get in the namespace: ```sh $ kubectl get pods -n microcks +``` +```sh --- OUTPUT --- NAME READY STATUS RESTARTS AGE microcks-6ffcc7dc54-c9h4w 1/1 Running 0 68s @@ -232,6 +248,8 @@ Now connect to the Kafka broker pod to check a topic has been correctly created ```sh $ kubectl -n microcks exec microcks-kafka-kafka-0 -it -- /bin/sh +``` +```sh --- INPUT --- sh-4.4$ cd bin sh-4.4$ ./kafka-topics.sh --bootstrap-server localhost:9092 --list @@ -254,6 +272,8 @@ And finally, from your Mac host, you can install the [`kcat`](https://github.com ```sh $ kcat -b microcks-kafka.kafka.127.0.0.1.nip.io:443 -X security.protocol=SSL -X ssl.ca.location=ca.crt -t UsersignedupAPI-0.1.1-user-signedup +``` +```sh --- OUTPUT --- % Auto-selecting Consumer mode (use -P or -C to override) {"id": "zYcAzFlRoTGvu9Mu4ajg30lr1fBa4Kah", "sendAt": "1703699827456", "fullName": "Laurent Broudoux", "email": "laurent@microcks.io", "age": 41} @@ -271,10 +291,17 @@ Deleting the microcks Helm release from your cluster is straightforward. Then yo ```sh $ helm delete microcks -n microcks +``` +output: +```sh --- OUTPUT --- release "microcks" uninstalled - +``` +```sh $ kind delete cluster +``` +output: +```sh --- OUTPUT --- Deleting cluster "kind" ... Deleted nodes: ["kind-control-plane"] diff --git a/content/documentation/guides/installation/kubernetes-operator.md b/content/documentation/guides/installation/kubernetes-operator.md index 2803ff83..5fedc2b5 100644 --- a/content/documentation/guides/installation/kubernetes-operator.md +++ b/content/documentation/guides/installation/kubernetes-operator.md @@ -63,6 +63,8 @@ Wait a bit for the operator to be triggered, the images to be pulled, pods to be ```shell $ kubectl get pods -n microcks +``` +```sh --- OUTPUT --- NAME READY STATUS RESTARTS AGE microcks-6779c95d59-v2p7j 1/1 Running 0 55s @@ -71,8 +73,11 @@ microcks-keycloak-postgresql-85b69859d9-nwqqs 1/1 Running 0 56s microcks-mongodb-5f7764bbd8-fgqhb 1/1 Running 0 56s microcks-operator-6ff95d44f9-5kgvq 1/1 Running 0 73s microcks-postman-runtime-6fdd4659f5-vm76j 1/1 Running 0 55s - +``` +```sh $ kubectl get ingresses -n microcks +``` +```sh --- OUTPUT --- NAME CLASS HOSTS ADDRESS PORTS AGE microcks microcks.m.minikube.local 192.168.49.2 80, 443 3m20s @@ -222,6 +227,9 @@ Watch and check the pods you should get in the namespace: ```sh $ kubectl get pods -n microcks +``` +output: +```sh NAME READY STATUS RESTARTS AGE microcks-585d4554bf-bplwc 1/1 Running 0 7m21s microcks-async-minion-545d5bf4fc-l5xrq 1/1 Running 3 (3m43s ago) 7m21s @@ -244,6 +252,8 @@ Now connect to the Kafka broker pod to check a topic has been correctly created ```sh $ kubectl -n microcks exec microcks-kafka-kafka-0 -it -- /bin/sh +``` +```sh --- INPUT --- sh-4.4$ cd bin sh-4.4$ ./kafka-topics.sh --bootstrap-server localhost:9092 --list diff --git a/content/documentation/guides/installation/minikube-helm.md b/content/documentation/guides/installation/minikube-helm.md index 03f8baab..557672d8 100644 --- a/content/documentation/guides/installation/minikube-helm.md +++ b/content/documentation/guides/installation/minikube-helm.md @@ -23,6 +23,9 @@ As being on a Mac, people usually use [brew](https://brew.sh) to install `miniku $ brew install minikube $ minikube version +``` +output: +```sh minikube version: v1.32.0 commit: 8220a6eb95f0a4d75f7f2d7b14cef975f050512d ``` @@ -42,6 +45,9 @@ We're now going to start a Kube cluster. Start your `minikube` cluster with the ```sh $ minikube start +``` +output: +```sh --- OUTPUT --- 😄 minikube v1.32.0 sur Darwin 14.1.2 (arm64) 🎉 minikube 1.33.1 est disponible ! Téléchargez-le ici : https://github.com/kubernetes/minikube/releases/tag/v1.33.1 @@ -90,6 +96,8 @@ You can check connection to the cluster and that Ingresses are OK running the fo ```sh $ kubectl get pods -n ingress-nginx +``` +```sh --- OUTPUT --- NAME READY STATUS RESTARTS AGE ingress-nginx-admission-create-dz95x 0/1 Completed 0 26m @@ -105,6 +113,8 @@ Then, we'll need to prepare the `/etc/hosts` file to access Microcks using an In ```sh $ cat /etc/hosts +``` +```sh --- OUTPUT --- ## # Host Database @@ -125,6 +135,8 @@ $ kubectl create namespace microcks $ helm repo add microcks https://microcks.io/helm $ helm install microcks microcks/microcks --namespace microcks --set microcks.url=microcks.m.minikube.local --set keycloak.url=keycloak.m.minikube.local --set keycloak.privateUrl=http://microcks-keycloak.microcks.svc.cluster.local:8080 +``` +```sh --- OUTPUT --- NAME: microcks LAST DEPLOYED: Tue Dec 19 15:23:23 2023 @@ -157,6 +169,8 @@ Wait for the images to be pulled, pods to be started and ingresses to be there: ```sh $ kubectl get pods -n microcks +``` +```sh --- OUTPUT --- NAME READY STATUS RESTARTS AGE microcks-865b66d867-httf7 1/1 Running 0 56s @@ -165,7 +179,10 @@ microcks-keycloak-postgresql-6cfc7bf6c4-qb9rv 1/1 Running 0 56s microcks-mongodb-d584889cf-wnzzb 1/1 Running 0 56s microcks-postman-runtime-5cbc478db7-rzprn 1/1 Running 0 56s +``` $ kubectl get ingresses -n microcks +``` +```sh --- OUTPUT --- NAME CLASS HOSTS ADDRESS PORTS AGE microcks nginx microcks.m.minikube.local 192.168.49.2 80, 443 2m4s @@ -177,6 +194,8 @@ To access the ingress from your browser, you'll need to start the networking tun ```sh $ minikube tunnel +``` +```sh --- OUTPUT --- ✅ Tunnel démarré avec succès @@ -235,6 +254,8 @@ Now, you can install Microcks using the Helm chart and enable the asynchronous f ```sh $ helm install microcks microcks/microcks --namespace microcks --set microcks.url=microcks.m.minikube.local --set keycloak.url=keycloak.m.minikube.local --set keycloak.privateUrl=http://microcks-keycloak.microcks.svc.cluster.local:8080 --set features.async.enabled=true --set features.async.kafka.url=kafka.m.minikube.local +``` +```sh --- OUTPUT --- NAME: microcks LAST DEPLOYED: Tue Dec 26 15:07:35 2023 @@ -272,6 +293,8 @@ Watch and check the pods you should get in the namespace (this can take a bit lo ```sh $ kc get pods -n microcks +``` +```sh --- OUTPUT --- NAME READY STATUS RESTARTS AGE microcks-5fbf679987-kzctj 1/1 Running 1 (116s ago) 4m32s @@ -293,7 +316,9 @@ Start with loading the [User signed-up API](https://microcks.io/blog/async-featu Now connect to the Kafka broker pod to check a topic has been correctly created and that you can consume messages from there: ```sh -$ kubectl -n microcks exec microcks-kafka-kafka-0 -it -- /bin/sh +$ kubectl -n microcks exec microcks-kafka-kafka-0 -it -- /bin/sh\ +``` +```sh --- INPUT --- sh-4.4$ cd bin sh-4.4$ ./kafka-topics.sh --bootstrap-server localhost:9092 --list @@ -318,6 +343,8 @@ And finally, from your Mac host, you can install the [`kcat`](https://github.com ```sh $ kcat -b microcks-kafka.kafka.m.minikube.local:443 -X security.protocol=SSL -X ssl.ca.location=ca.crt -t UsersignedupAPI-0.1.1-user-signedup +``` +```sh --- OUTPUT --- % Auto-selecting Consumer mode (use -P or -C to override) {"id": "FrncZaUsQFWPlcKSm4onTrw3o0sXhMkJ", "sendAt": "1703600745149", "fullName": "Laurent Broudoux", "email": "laurent@microcks.io", "age": 41} @@ -335,10 +362,15 @@ Deleting the microcks Helm release from your cluster is straightforward. Then yo ```sh $ helm delete microcks -n microcks +``` +```sh --- OUTPUT --- release "microcks" uninstalled - +``` +```sh $ minikube stop +``` +```sh --- OUTPUT --- ✋ Nœud d'arrêt "minikube" ... 🛑 Mise hors tension du profil "minikube" via SSH… diff --git a/content/documentation/guides/installation/podman-compose.md b/content/documentation/guides/installation/podman-compose.md index 10a3a191..e970233c 100644 --- a/content/documentation/guides/installation/podman-compose.md +++ b/content/documentation/guides/installation/podman-compose.md @@ -31,19 +31,26 @@ cd microcks/install/podman-compose ```sh $ ./run-microcks.sh +``` +```sh On macos, need to get the userid and groupid from postman machine. Assuming this machine is named 'podman-machine-default'. Change name in script otherwise. Starting Microcks using podman-compose ... ------------------------------------------ +``` +```sh Stop it with: podman-compose -f microcks.yml --podman-run-args='--userns=keep-id:uid=501,gid=1000' stop Re-launch it with: podman-compose -f microcks.yml --podman-run-args='--userns=keep-id:uid=501,gid=1000' start Clean everything with: podman-compose -f microcks.yml --podman-run-args='--userns=keep-id:uid=501,gid=1000' down +``` +```sh ------------------------------------------ Go to https://localhost:8080 - first login with admin/microcks123 Having issues? Check you have changed microcks.yml to your platform - +``` +```sh podman-compose -f microcks.yml --podman-run-args='--userns=keep-id:uid=501,gid=1000' up -d ``` @@ -64,19 +71,25 @@ In your terminal use the following command instead: ```sh $ ./run-microcks.sh async - +``` +```sh On macos, need to get the userid and groupid from postman machine. Assuming this machine is named 'podman-machine-default'. Change name in script otherwise. Starting Microcks using podman-compose ... ------------------------------------------ +``` +```sh Stop it with: podman-compose -f microcks.yml -f microcks-template-async-addon.yml --podman-run-args='--userns=keep-id:uid=501,gid=1000' stop Re-launch it with: podman-compose -f microcks.yml -f microcks-template-async-addon.yml --podman-run-args='--userns=keep-id:uid=501,gid=1000' start Clean everything with: podman-compose -f microcks.yml -f microcks-template-async-addon.yml --podman-run-args='--userns=keep-id:uid=501,gid=1000' down +``` +```sh ------------------------------------------ Go to https://localhost:8080 - first login with admin/microcks123 Having issues? Check you have changed microcks.yml to your platform - +``` +```sh podman-compose -f microcks.yml -f microcks-template-async-addon.yml --podman-run-args='--userns=keep-id:uid=501,gid=1000' up -d ``` diff --git a/content/documentation/guides/usage/async-protocols/avro-messaging.md b/content/documentation/guides/usage/async-protocols/avro-messaging.md index 0a1f6d1d..048d8409 100644 --- a/content/documentation/guides/usage/async-protocols/avro-messaging.md +++ b/content/documentation/guides/usage/async-protocols/avro-messaging.md @@ -149,15 +149,25 @@ Now it's time to validate that mock publication of Avro messages is correct. When using the `REGISTRY` encoding options with a deployed Schema Registry, things are pretty simple as you can interact with registry either from GUI or CLI. Let's check that Microcks has correctly published the schema for our sample topic. See below the results we have with our sample: ```sh -$ curl https://schema-registry.apps.example.com -s -k | jq . +$ curl https://schema-registry.apps.example.com -s -k | jq . +``` +```sh [ "UsersignedupAvroAPI_0.1.2_user-signedup-microcks.avro.User" ] +``` +```sh $ curl https://schema-registry.apps.example.com/subjects/UsersignedupAvroAPI_0.1.2_user-signedup-microcks.avro.User/versions -s -k | jq . +``` +```sh [ 1 ] +``` +```sh $ curl https://schema-registry.apps.example.com/subjects/UsersignedupAvroAPI_0.1.2_user-signedup-microcks.avro.User/versions/1 -s -k | jq . +``` +```json { "subject": "UsersignedupAvroAPI_0.1.2_user-signedup-microcks.avro.User", "version": 1, @@ -170,6 +180,8 @@ Very nice! We can also use the [`kafkacat` CLI tool](https://github.com/edenhill ```sh $ kafkacat -b microcks-kafka-bootstrap-microcks.apps.example.com:9092 -t UsersignedupAvroAPI_0.1.2_user-signedup -s value=avro -r https://schema-registry.apps.example.com -o end +``` +```sh % Auto-selecting Consumer mode (use -P or -C to override) % Reached end of topic UsersignedupAvroAPI_0.1.2_user-signedup [0] at offset 114 {"fullName": "Laurent Broudoux", "email": "laurent@microcks.io", "age": 41} @@ -192,7 +204,9 @@ $ git clone https://github.com/microcks/api-tooling.git $ cd api-tooling/async-clients/kafkajs-client $ npm install -$ node avro-consumer.js microcks-kafka-bootstrap-microcks.apps.example.com:9092 UsersignedupAvroAPI_0.1.2_user-signedup +$ node avro-consumer.js microcks-kafka-bootstrap-microcks.apps.example.com:9092 UsersignedupAvroAPI_0.1.2_user-signedup +``` +```sh Connecting to microcks-kafka-bootstrap-microcks.apps.example.com:9092 on topic UsersignedupAvroAPI_0.1.2_user-signedup {"level":"INFO","timestamp":"2021-02-11T20:30:48.672Z","logger":"kafkajs","message":"[Consumer] Starting","groupId":"kafkajs-client"} {"level":"INFO","timestamp":"2021-02-11T20:30:48.708Z","logger":"kafkajs","message":"[Runner] Consumer has joined the group","groupId":"kafkajs-client","memberId":"my-app-7feb2099-1701-4a8a-9eff-50aeed60d65d","leaderId":"my-app-7feb2099-1701-4a8a-9eff-50aeed60d65d","isLeader":true,"memberAssignment":{"UsersignedupAvroAPI_0.1.2_user-signedup":[0]},"groupProtocol":"RoundRobinAssigner","duration":36} @@ -232,6 +246,8 @@ That said, imagine that you want to validate messages from a **QA** environment ```sh $ node avro-with-registry-producer.js kafka-broker-qa.apps.example.com:9092 user-registration https://schema-registry-qa.apps.example.com +``` +```sh Connecting to kafka-broker-qa.apps.example.com:9092 on topic user-registration, using registry https://schema-registry-qa.apps.example.com {"level":"ERROR","timestamp":"2021-02-11T21:07:09.962Z","logger":"kafkajs","message":"[Connection] Response Metadata(key: 3, version: 5)","broker":"kafka-broker-qa.apps.example.com:9092","clientId":"my-app","error":"There is no leader for this topic-partition as we are in the middle of a leadership election","correlationId":1,"size":108} [ @@ -275,6 +291,8 @@ Now looking at the `RAW` encoding option and what we can deduce from tests. To s ```sh $ node avro-producer.js kafka-broker-qa.apps.example.com:9092 user-registration +``` +```sh Connecting to kafka-broker-qa.apps.example.com:9092 on topic user-registration {"level":"ERROR","timestamp":"2021-02-11T21:37:28.266Z","logger":"kafkajs","message":"[Connection] Response Metadata(key: 3, version: 5)","broker":"kafka-broker-qa.apps.example.com:9092","clientId":"my-app","error":"There is no leader for this topic-partition as we are in the middle of a leadership election","correlationId":1,"size":96} [ diff --git a/content/documentation/guides/usage/async-protocols/googlepubsub-support.md b/content/documentation/guides/usage/async-protocols/googlepubsub-support.md index 77aba4e5..df94d258 100644 --- a/content/documentation/guides/usage/async-protocols/googlepubsub-support.md +++ b/content/documentation/guides/usage/async-protocols/googlepubsub-support.md @@ -161,6 +161,8 @@ $ cd api-tooling/async-clients/googlepubsub-client $ npm install $ node consumer.js my-gcp-project-347219 UsersignedupAPI-0.1.20-user-signedup /Users/me/google-cloud-creds/my-gcp-project-347219/pubsub-service-account.json +``` +```sh Connecting to my-gcp-project-347219 on topic UsersignedupAPI-0.1.20-user-signedup with sub gpubsub-client-echo { "id": "rZxAKnfxbe7yCXAJLENTHtnBI64H2KRN", @@ -191,6 +193,8 @@ Still being in the `googlepubsub-client` folder, now use the `producer.js` utili ```sh $ node producer.js my-qa-gcp-project-347223 user-signups /Users/me/google-cloud-creds/my-qa-gcp-project-347223/pubsub-service-account.json +``` +```sh Connecting to my-qa-gcp-project-347223 on user-signups Sending {"id":"jhlch3gv1dexkodt71zet","sendAt":"1675848599703","fullName":"Laurent Broudoux","email":"laurent@microcks.io","age":43} Sending {"id":"gm6c39oa69nw7dukbpper","sendAt":"1675848602703","fullName":"Laurent Broudoux","email":"laurent@microcks.io","age":43} @@ -230,6 +234,8 @@ So now let see what happened if we tweak that a bit... Open the `producer.js` sc ```sh $ node producer.js my-qa-gcp-project-347223 user-signups /Users/me/google-cloud-creds/my-qa-gcp-project-347223/pubsub-service-account.json +``` +```sh Connecting to my-qa-gcp-project-347223 on user-signups Sending {"id":"2zzo4kf16mxu5e6k8hyecl","sendAt":1675946954300,"displayName":"Laurent Broudoux","email":"laurent@microcks.io","age":43} Sending {"id":"9ny4r1qu1p5xv37wxufshm","sendAt":1675946957300,"displayName":"Laurent Broudoux","email":"laurent@microcks.io","age":43} diff --git a/content/documentation/guides/usage/async-protocols/mqtt-support.md b/content/documentation/guides/usage/async-protocols/mqtt-support.md index d060f703..f23506dc 100644 --- a/content/documentation/guides/usage/async-protocols/mqtt-support.md +++ b/content/documentation/guides/usage/async-protocols/mqtt-support.md @@ -154,6 +154,8 @@ $ cd api-tooling/async-clients/mqttjs-client $ npm install $ node consumer.js mqtt://mqtt-broker.app.example.com:1883 StreetlightsAPI_1.0.0_smartylighting-streetlights-event-lighting-measured microcks microcks +``` +```sh Connecting to mqtt://mqtt-broker.app.example.com:1883 on topic StreetlightsAPI_1.0.0_smartylighting-streetlights-event-lighting-measured { "streetlightId": "dev0", @@ -184,7 +186,9 @@ Now the final step is to perform some test of the validation features in Microck Imagine that you want to validate messages from a `QA` environment with dedicated MQTT broker. Still being in the `mqttjs-client` folder, now use the `producer.js` utility script to publish messages on a `streetlights-event-lighting-measured` topic: ```sh -$ node producer.js mqtts://mqtt-broker-qa.app.example.com:443 streetlights-event-lighting-measured qa-user qa-password broker-qa.crt +$ node producer.js mqtts://mqtt-broker-qa.app.example.com:443 streetlights-event-lighting-measured qa-user qa-password broker-qa.crt +``` +```sh Connecting to mqtts://mqtt-broker-qa.app.example.com:443 on topic streetlights-event-lighting-measured { streetlightId: 'devX', @@ -226,6 +230,8 @@ So now let see what happened if we tweak that a bit... Open the `producer.js` sc ```sh $ node producer.js mqtts://mqtt-broker-qa.app.example.com:443 streetlights-event-lighting-measured qa-user qa-password broker-qa.crt +``` +```sh Connecting to mqtts://mqtt-broker-qa.app.example.com:443 on topic streetlights-event-lighting-measured { streetlightId: 'devX', diff --git a/content/documentation/guides/usage/async-protocols/nats-support.md b/content/documentation/guides/usage/async-protocols/nats-support.md index bc1c0b1e..3925f4e6 100644 --- a/content/documentation/guides/usage/async-protocols/nats-support.md +++ b/content/documentation/guides/usage/async-protocols/nats-support.md @@ -134,6 +134,8 @@ $ cd api-tooling/async-clients/natsjs-client $ npm install $ node consumer.js nats-broker.app.example.com:4222 UsersignedupAPI-0.1.30-user/signedup microcks microcks +``` +```sh Connecting to nats-broker.app.example.com:4222 on topic UsersignedupAPI-0.1.30-user/signedup { "id": "eyN7TbotUwN6RTPD4mRwwStS8gBA7tI6", @@ -162,6 +164,8 @@ Imagine that you want to validate messages from a `QA` environment with dedicate ```sh $ node producer.js nats-broker-qa.app.example.com:4222 user-signedups qa-user qa-password +``` +```sh Connecting to nats-broker-qa.app.example.com:4222 on topic user-signedups Sending {"id":"itq382xi2usbz41nwel888","sendAt":"1675089667454","fullName":"Laurent Broudoux","email":"laurent@microcks.io","age":41} Sending {"id":"qfb0fn4yrff06ylrge5fh75","sendAt":"1675089670454","fullName":"Laurent Broudoux","email":"laurent@microcks.io","age":41} @@ -195,6 +199,8 @@ So now let see what happened if we tweak that a bit... Open the `producer.js` sc ```sh $ node producer.js nats-broker-qa.app.example.com:4222 user-signedups qa-user qa-password +``` +```sh Connecting to nats-broker-qa.app.example.com:4222 on topic user-signedups Sending {"id":"9x12cp2u40f01avend41ryw","sendAt":1675092166658,"displayName":"Laurent Broudoux","email":"laurent@microcks.io","age":41} Sending {"id":"han9zjhmqhkzkl76epz4xm","sendAt":1675092169659,"displayName":"Laurent Broudoux","email":"laurent@microcks.io","age":41} diff --git a/content/documentation/guides/usage/async-protocols/rabbitmq-support.md b/content/documentation/guides/usage/async-protocols/rabbitmq-support.md index 83520cd9..a4ca372a 100644 --- a/content/documentation/guides/usage/async-protocols/rabbitmq-support.md +++ b/content/documentation/guides/usage/async-protocols/rabbitmq-support.md @@ -145,6 +145,8 @@ $ cd api-tooling/async-clients/amqpjs-client $ npm install $ node consumer.js amqp://:@rabbitmq-broker.app.example.com:5672 AccountService-1.1.0-user/signedup +``` +```sh Connecting to amqp://:@rabbitmq-broker.app.example.com:5672 on topic AccountService-1.1.0-user/signedup { "displayName": "Laurent Broudoux", @@ -168,6 +170,8 @@ Imagine that you want to validate messages from a `QA` environment with dedicate ```sh $ node producer.js amqp://:@rabbitmq-qa-broker.app.example.com:5672 signedup-exchange topic +``` +```sh Connecting to amqp://:@rabbitmq-qa-broker.app.example.com:5672 on destination signedup-exchange Publishing {"displayName":"John Doe","email":"john@doe.com"} Publishing {"displayName":"John Doe","email":"john@doe.com"} @@ -205,6 +209,8 @@ So now let see what happened if we tweak that a bit... Open the `producer.js` sc ```sh $ node producer.js amqp://:@rabbitmq-qa-broker.app.example.com:5672 signedup-exchange topic +``` +```sh Connecting to amqp://:@rabbitmq-qa-broker.app.example.com:5672 on destination signedup-exchange Publishing {"name":"John Doe","email":"john@doe.com"} Publishing {"name":"John Doe","email":"john@doe.com"} diff --git a/content/documentation/guides/usage/direct-api.md b/content/documentation/guides/usage/direct-api.md index 1c217e63..fd172152 100644 --- a/content/documentation/guides/usage/direct-api.md +++ b/content/documentation/guides/usage/direct-api.md @@ -179,6 +179,9 @@ Looking at the operation details, you can retrieve the information of the endpoi ```sh $ kcat -b my-cluster-kafka-bootstrap.apps.try.microcks.io:443 -t MyQuoteAPI-1.0-quotes -o end +``` +output: +```sh % Auto-selecting Consumer mode (use -P or -C to override) % Reached end of topic MyQuoteAPI-1.0-quotes [0] at offset 87 { diff --git a/content/documentation/guides/usage/mocks-constraints.md b/content/documentation/guides/usage/mocks-constraints.md index c1826ae8..90d143fc 100644 --- a/content/documentation/guides/usage/mocks-constraints.md +++ b/content/documentation/guides/usage/mocks-constraints.md @@ -31,6 +31,8 @@ Now let's do some tests to check Microcks behavior: ```sh $ http http://localhost:8080/rest/API+Pastry/1.0.0/pastry +``` +```sh --- OUTPUT --- HTTP/1.1 400 Connection: close @@ -46,6 +48,8 @@ Hum... Adding the `Authorization` header... ```sh $ http http://localhost:8080/rest/API+Pastry/1.0.0/pastry Authorization:'Bearer 123' +``` +```sh --- OUTPUT --- HTTP/1.1 400 Connection: close @@ -61,6 +65,8 @@ Hum... Fixing the `Bearer` format and adding the `x-request-id` header: ```sh $ http http://localhost:8080/rest/API+Pastry/1.0.0/pastry Authorization:'Bearer abcdefabcdefabcdefabcdefab1234567890' x-request-id:123 +``` +```sh --- OUTPUT --- HTTP/1.1 200 Content-Length: 559 diff --git a/content/documentation/guides/usage/stateful-mocks.md b/content/documentation/guides/usage/stateful-mocks.md index 1fb2d289..d2e0a2a3 100644 --- a/content/documentation/guides/usage/stateful-mocks.md +++ b/content/documentation/guides/usage/stateful-mocks.md @@ -96,7 +96,8 @@ As a first test, you may check the initial state of our cart by issuing the foll ```sh # Check johndoes's cart $ curl -X GET 'http://localhost:8585/rest/Cart+API/1.0.0/cart' -H 'Accept: application/json' -H 'customerId: johndoe' - +``` +```json { "customerId": "johndoe", "items": [], @@ -158,16 +159,20 @@ We may now fully test that we're able to save a state by adding items and then r ```sh # Add a millefeuille to the cart for user johndoe $ curl -X PUT 'http://localhost:8585/rest/Cart+API/1.0.0/cart/items' -d '{"productId":"Millefeuille","quantity":2,"price":4.0}' -H 'Content-Type: application/json' -H 'customerId: johndoe' - +``` +```json { "productId": "Millefeuille", "quantity": 2, "price": 4.0 } +``` +```sh # Check johndoes's cart $ curl -X GET 'http://localhost:8585/rest/Cart+API/1.0.0/cart' -H 'Accept: application/json' -H 'customerId: johndoe' - +``` +```json { "customerId": "johndoe", "items": [ @@ -221,10 +226,13 @@ As a final test, we may now check that we are able to add items to a cart, retri ```sh # Add a Baba au Rhum curl -X PUT 'http://localhost:8585/rest/Cart+API/1.0.0/cart/items' -d '{"productId":"Baba Rhum","quantity":1,"price":4.1}' -H 'Content-Type: application/json' -H 'customerId: johndoe' +``` +```sh # Check johndoes's cart $ curl -X GET 'http://localhost:8585/rest/Cart+API/1.0.0/cart' -H 'Accept: application/json' -H 'customerId: johndoe' - +``` +```json { "customerId": "johndoe", "items": [ @@ -244,16 +252,19 @@ $ curl -X GET 'http://localhost:8585/rest/Cart+API/1.0.0/cart' -H 'Accept: appli # Empty johndoe's cart $ curl -X POST 'http://localhost:8585/rest/Cart+API/1.0.0/cart/empty' -H 'Accept: application/json' -H 'customerId: johndoe' - +``` +```json { "customerId": "johndoe", "items": [], "totalPrice": 0 } - +``` +```sh # Check johndoes's cart $ curl -X GET 'http://localhost:8585/rest/Cart+API/1.0.0/cart' -H 'Accept: application/json' -H 'customerId: johndoe' - +``` +```json { "customerId": "johndoe", "items": [], diff --git a/content/documentation/tutorials/first-asyncapi-mock.md b/content/documentation/tutorials/first-asyncapi-mock.md index cb7ee3dc..640cbb0f 100644 --- a/content/documentation/tutorials/first-asyncapi-mock.md +++ b/content/documentation/tutorials/first-asyncapi-mock.md @@ -60,6 +60,9 @@ You can check everything is running correctly with the `docker ps` command that ```shell $ docker ps +``` +output +```sh CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b2c1ce881983 quay.io/microcks/microcks-async-minion:1.11.0 "/deployments/run-ja…" 3 minutes ago Up 3 minutes 8080/tcp, 0.0.0.0:8081->8081/tcp microcks-async-minion 274c44597199 quay.io/microcks/microcks:1.11.0 "/deployments/run-ja…" 3 minutes ago Up 3 minutes 0.0.0.0:8080->8080/tcp, 0.0.0.0:9090->9090/tcp microcks @@ -149,6 +152,8 @@ Microcks has found `Zaza` and `Tigress` as valid samples to build a simulation u ```sh $ kcat -b localhost:9092 -t PetstoreAsynchronousAPI-1.0.0-receiveNewPetCreateEvent +``` +```json {"id":1,"name":"Zaza"} {"id":2,"name":"Tigress"} {"id":1,"name":"Zaza"} @@ -261,6 +266,8 @@ Let's try this on the different topics corresponding to the differnet colors: ```sh $ kcat -b localhost:9092 -t PetstoreAsynchronousAPI-1.0.0-pet-blue +``` +```sh % Auto-selecting Consumer mode (use -P or -C to override) {"id":1,"name":"Zaza","color":"blue"} {"id":1,"name":"Zaza","color":"blue"} @@ -272,6 +279,8 @@ Looks good! Only Zaza is a blue cat. Let's check the others: ```sh $ kcat -b localhost:9092 -t PetstoreAsynchronousAPI-1.0.0-pet-stripped +``` +```sh % Auto-selecting Consumer mode (use -P or -C to override) {"id":2,"name":"Tigress","color":"stripped"} {"id":4,"name":"Toufik","color":"stripped"} @@ -291,6 +300,8 @@ Correct! Tigress and Toufik are the stripped ones. Just confirm with the calico ```sh $ kcat -b localhost:9092 -t PetstoreAsynchronousAPI-1.0.0-pet-calico +``` +```sh % Auto-selecting Consumer mode (use -P or -C to override) {"id":3,"name":"Maki","color":"calico"} {"id":3,"name":"Maki","color":"calico"} @@ -339,6 +350,8 @@ Let's now finally test the first Kafka topic again and see what's going on: ```sh $ kcat -b localhost:9092 -t PetstoreAsynchronousAPI-1.0.0-receiveNewPetCreateEvent +``` +```sh [...] {"id":1,"name":"Zaza"} {"id":2,"name":"Tigresse"} diff --git a/content/documentation/tutorials/first-graphql-mock.md b/content/documentation/tutorials/first-graphql-mock.md index 08ec9b69..bb7eff14 100644 --- a/content/documentation/tutorials/first-graphql-mock.md +++ b/content/documentation/tutorials/first-graphql-mock.md @@ -123,7 +123,8 @@ $ echo '{ "query": -H "Content-Type: application/json" \ -s -d @- \ http://localhost:8585/graphql/Petstore+Graph+API/1.0 - +``` +```json { "data":{ "allPets":[ @@ -167,7 +168,8 @@ $ echo '{ "query": -H "Content-Type: application/json" \ -s -d @- \ http://localhost:8585/graphql/Petstore+Graph+API/1.0 - +``` +```json { "data":{ "allPets":[ @@ -255,7 +257,8 @@ $ echo '{ "query": -H "Content-Type: application/json" \ -s -d @- \ http://localhost:8585/graphql/Petstore+Graph+API/1.0 - +``` +```json { "data":{ "searchPets":[ @@ -299,7 +302,8 @@ $ echo '{ "query": -H "Content-Type: application/json" \ -s -v -d @- \ http://localhost:8585/graphql/Petstore+Graph+API/1.0 - +``` +```json { "data":{ "k_pets":[ @@ -406,7 +410,8 @@ $ echo '{ "query": -H "Content-Type: application/json" \ -s -d @- \ http://localhost:8585/graphql/Petstore+Graph+API/1.0 - +``` +```json { "data":{ "createPet":{ diff --git a/content/documentation/tutorials/first-grpc-mock.md b/content/documentation/tutorials/first-grpc-mock.md index ee5834bb..5b2f300d 100644 --- a/content/documentation/tutorials/first-grpc-mock.md +++ b/content/documentation/tutorials/first-grpc-mock.md @@ -124,6 +124,8 @@ Microcks has found `All Pets` as a valid sample to build a simulation upon. A mo ```shell $ grpcurl -plaintext -d '{}' localhost:8686 org.acme.petstore.v1.PetstoreService/getPets +``` +```json { "pets": [ { @@ -198,6 +200,8 @@ Let's try the new gRPC method mock with this command: ```shell $ grpcurl -plaintext -d '{"name": "k"}' localhost:8686 org.acme.petstore.v1.PetstoreService/searchPets +``` +```json { "pets": [ { @@ -272,6 +276,8 @@ Let's now finally test this new method using some content and see what's going o ```shell $ grpcurl -plaintext -d '{"name": "Rusty"}' localhost:8686 org.acme.petstore.v1.PetstoreService/createPet +``` +```json { "id": 6, "name": "Rusty" diff --git a/content/documentation/tutorials/first-rest-mock.md b/content/documentation/tutorials/first-rest-mock.md index 44684bea..f73e01fa 100644 --- a/content/documentation/tutorials/first-rest-mock.md +++ b/content/documentation/tutorials/first-rest-mock.md @@ -105,6 +105,8 @@ Microcks has found `my_pets` as a valid sample to build a simulation upon. A moc ```sh $ curl http://localhost:8585/rest/Petstore+API/1.0.0/my/pets -s | jq +``` +```sh [ { "id": 1, @@ -171,6 +173,8 @@ What about dispatching properties we mentioned earlier? You can see that they no ```shell $ curl http://localhost:8585/rest/Petstore+API/1.0.0/pets\?filter\=k -s | jq +``` +```sh [ { "id": 3, @@ -233,6 +237,8 @@ The `Dispatcher` inferred by Microcks has been adapted to `URI_PARTS` which mean ```shell $ curl http://localhost:8585/rest/Petstore+API/1.0.0/pets/1 -s | jq +``` +```json { "id": 1, "name": "Zaza" @@ -297,6 +303,8 @@ You can see in the picture above that the `Dispatcher` has no value as we have n ```shell $ curl http://localhost:8585/rest/Petstore+API/1.0.0/pets -H 'Content-Type: application/json' -d '{"name":"Rusty"}' -s | jq +``` +```json { "id": 8, "name": "Rusty" diff --git a/content/documentation/tutorials/getting-started-tests.md b/content/documentation/tutorials/getting-started-tests.md index 2e83b26f..b015f55b 100644 --- a/content/documentation/tutorials/getting-started-tests.md +++ b/content/documentation/tutorials/getting-started-tests.md @@ -34,7 +34,8 @@ Open a new terminal window and run this command to locally launch the implementa ```sh $ docker run -i --rm -p 8282:8282 quay.io/microcks/quarkus-api-pastry:latest - +``` +```sh WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested __ ____ __ _____ ___ __ ____ ______ --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ @@ -82,7 +83,8 @@ $ docker run -it quay.io/microcks/microcks-cli:latest microcks-cli test \ --microcksURL=http://host.docker.internal:8585/api/ \ --keycloakClientId=foo --keycloakClientSecret=bar \ --insecure --waitFor=6sec - +``` +```sh MicrocksClient got status for test "6644db75269ded17868d654c" - success: true, inProgress: true MicrocksTester waiting for 2 seconds before checking again or exiting. Full TestResult details are available here: http://host.docker.internal:8585/#/tests/6644db75269ded17868d654c diff --git a/content/documentation/tutorials/getting-started.md b/content/documentation/tutorials/getting-started.md index aae0042f..26cb10b7 100644 --- a/content/documentation/tutorials/getting-started.md +++ b/content/documentation/tutorials/getting-started.md @@ -85,7 +85,8 @@ At the end of the **Mock URL** line, you'll notice two icons and buttons. The fi ```sh $ curl -X GET 'http://localhost:8585/rest/API+Pastry+-+2.0/2.0.0/pastry/Millefeuille' -H 'Accept: application/json' - +``` +```json {"name":"Millefeuille","description":"Delicieux Millefeuille pas calorique du tout","size":"L","price":4.4,"status":"available"} ```