Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions content/blog/advanced-dispatching-constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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.%
```

Expand Down
42 changes: 38 additions & 4 deletions content/blog/async-features-with-docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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}
Expand All @@ -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
```

Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions content/blog/extend-microcks-with-custom-libs.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ We have set up a specific GitHub repository to illustrate those extension endpoi

```sh
$ tree
```
```sh
=== OUTPUT ===
.
|____Dockerfile.acme
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions content/blog/integrating-in-apicurio-keycloak.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions content/blog/microcks-1.1.0-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
__ ____ __ _____ ___ __ ____ ______
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
Expand Down
2 changes: 2 additions & 0 deletions content/blog/microcks-1.11.0-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions content/blog/microcks-1.5.0-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
34 changes: 30 additions & 4 deletions content/blog/microcks-on-kind.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down Expand Up @@ -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) 🖼
Expand All @@ -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).

Expand All @@ -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
Expand Down Expand Up @@ -130,15 +138,20 @@ 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
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 <none> microcks.127.0.0.1.nip.io localhost 80, 443 10m
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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}
Expand All @@ -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"]
Expand Down
Loading