Skip to content

Commit

Permalink
devex improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
vordimous committed Oct 25, 2023
1 parent 49d097e commit 895905d
Show file tree
Hide file tree
Showing 12 changed files with 1,381 additions and 1,478 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Site versioned build & deploy

on:
push:
branches: [develop, feature/vuepress-rewrite]
branches: [develop]
workflow_dispatch:

permissions:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/gitflow-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ jobs:
echo "version=$(npm version --json=true | jq -r '."zilla-docs"')" >> $GITHUB_OUTPUT;
echo "tag=$tag" >> $GITHUB_OUTPUT;
- name: merge and tag ${{ steps.new-version.outputs.tag }} with HDBandit/gitflow-release-action
uses: vordimous/gitflow-release-action@main
- name: merge and tag ${{ steps.new-version.outputs.tag }}
uses: HDBandit/gitflow-release-action@v2.0.10
with:
command: start
tag: ${{ steps.new-version.outputs.tag }}
Expand Down Expand Up @@ -101,8 +101,8 @@ jobs:
git add .;
git commit -m "CI: update version to ${{ steps.new-version.outputs.version }}";
- name: merge and tag ${{ steps.new-version.outputs.tag }} with HDBandit/gitflow-release-action
uses: vordimous/gitflow-release-action@main
- name: merge and tag ${{ steps.new-version.outputs.tag }}
uses: HDBandit/gitflow-release-action@v2.0.10
with:
command: finish
tag: ${{ steps.new-version.outputs.tag }}
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
"link-checker": "pnpm build && link-checker src/.vuepress/dist"
},
"devDependencies": {
"@vuepress/client": "2.0.0-beta.66",
"@vuepress/plugin-docsearch": "2.0.0-beta.66",
"@vuepress/plugin-google-analytics": "2.0.0-beta.66",
"@vuepress/client": "2.0.0-beta.67",
"@vuepress/plugin-docsearch": "2.0.0-beta.67",
"@vuepress/plugin-google-analytics": "2.0.0-beta.67",
"link-checker": "^1.4.2",
"markdownlint-cli2": "^0.8.1",
"vue": "^3.3.4",
"vuepress": "2.0.0-beta.66",
"vuepress-theme-hope": "2.0.0-beta.235"
"vuepress": "2.0.0-beta.67",
"vuepress-theme-hope": "2.0.0-beta.238"
}
}
2,594 changes: 1,302 additions & 1,292 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/tutorials/grpc/grpc-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ bindings:
version: '3'
services:
kafka:
image: docker.io/bitnami/kafka:latest
image: bitnami/kafka:3.2
container_name: kafka
ports:
- "9092:9092"
environment:
ALLOW_PLAINTEXT_LISTENER: "yes"

kafka-init:
image: docker.io/bitnami/kafka:latest
image: bitnami/kafka:3.2
command:
- "/bin/bash"
- "-c"
Expand Down
27 changes: 14 additions & 13 deletions src/tutorials/mqtt/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
version: '3'
services:

zilla:
image: ghcr.io/aklivity/zilla
container_name: zilla
depends_on:
- kafka
ports:
- 7183:7183
volumes:
- ./zilla.yaml:/etc/zilla/zilla.yaml
command: start -v -e

kafka:
image: docker.io/bitnami/kafka:latest
image: docker.io/bitnami/kafka
container_name: kafka
ports:
- 9092:9092
Expand All @@ -21,7 +33,7 @@ services:
KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "true"

kafka-init:
image: docker.io/bitnami/kafka:3.2
image: docker.io/bitnami/kafka
command:
- "/bin/bash"
- "-c"
Expand All @@ -33,17 +45,6 @@ services:
- kafka
init: true

zilla:
image: ghcr.io/aklivity/zilla:latest
depends_on:
- kafka
ports:
- 1883:1883
volumes:
- ./zilla.yaml:/etc/zilla/zilla.yaml
command: start -v -e

networks:
default:
name: zilla-network
driver: bridge
143 changes: 22 additions & 121 deletions src/tutorials/mqtt/mqtt-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,121 +18,15 @@ Create these files, `zilla.yaml` and `docker-compose.yaml`, in the same director

@tab zilla.yaml


```yaml {11,26-28,41-42}
name: MQTT-intro
bindings:

# Gateway ingress config
tcp_server:
type: tcp
kind: server
options:
host: 0.0.0.0
port:
- 1883
exit: mqtt_server

# MQTT Broker With an exit to Kafka
mqtt_server:
type: mqtt
kind: server
exit: mqtt_kafka_proxy

# Proxy MQTT messages to Kafka
mqtt_kafka_proxy:
type: mqtt-kafka
kind: proxy
options:
topics:
sessions: mqtt-sessions
messages: mqtt-messages
retained: mqtt-retained
exit: kafka_cache_client

# Kafka caching layer
kafka_cache_client:
type: kafka
kind: cache_client
exit: kafka_cache_server
kafka_cache_server:
type: kafka
kind: cache_server
options:
bootstrap:
- mqtt-sessions
- mqtt-retained
exit: kafka_client

# Connect to local Kafka
kafka_client:
type: kafka
kind: client
exit: kafka_tcp_client
kafka_tcp_client:
type: tcp
kind: client
options:
host: kafka
port: 29092
routes:
- when:
- cidr: 0.0.0.0/0
<!-- @include: ./zilla.yaml -->
```
@tab docker-compose.yaml
```yaml {9,40-42}
version: '3'
services:

zilla:
image: ghcr.io/aklivity/zilla:latest
depends_on:
- kafka
ports:
- 1883:1883
volumes:
- ./zilla.yaml:/etc/zilla/zilla.yaml
command: start -v -e

kafka:
image: docker.io/bitnami/kafka:latest
container_name: kafka
ports:
- 9092:9092
- 29092:9092
environment:
ALLOW_PLAINTEXT_LISTENER: "yes"
KAFKA_CFG_NODE_ID: "1"
KAFKA_CFG_BROKER_ID: "1"
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: "[email protected]:9093"
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: "CLIENT:PLAINTEXT,INTERNAL:PLAINTEXT,CONTROLLER:PLAINTEXT"
KAFKA_CFG_CONTROLLER_LISTENER_NAMES: "CONTROLLER"
KAFKA_CFG_LOG_DIRS: "/tmp/logs"
KAFKA_CFG_PROCESS_ROLES: "broker,controller"
KAFKA_CFG_LISTENERS: "CLIENT://:9092,INTERNAL://:29092,CONTROLLER://:9093"
KAFKA_CFG_INTER_BROKER_LISTENER_NAME: "INTERNAL"
KAFKA_CFG_ADVERTISED_LISTENERS: "CLIENT://localhost:9092,INTERNAL://kafka:29092"
KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "true"

kafka-init:
image: docker.io/bitnami/kafka:3.2
command:
- "/bin/bash"
- "-c"
- |
/opt/bitnami/kafka/bin/kafka-topics.sh --bootstrap-server kafka:29092 --create --if-not-exists --topic mqtt-messages
/opt/bitnami/kafka/bin/kafka-topics.sh --bootstrap-server kafka:29092 --create --if-not-exists --topic mqtt-sessions --config cleanup.policy=compact
/opt/bitnami/kafka/bin/kafka-topics.sh --bootstrap-server kafka:29092 --create --if-not-exists --topic mqtt-retained --config cleanup.policy=compact
depends_on:
- kafka
init: true


networks:
default:
name: zilla-network
driver: bridge
```yaml {10,41-43}
<!-- @include: ./docker-compose.yaml -->
```
:::
Expand All @@ -143,25 +37,33 @@ networks:
docker-compose up -d
```

### Use [mosquitto_pub](https://mosquitto.org/download/) to send a greeting
### Send a greeting

Subscribe to the `zilla` topic
Using [eclipse-mosquitto](https://hub.docker.com/_/eclipse-mosquitto) subscribe to the `zilla` topic.

```bash:no-line-numbers
mosquitto_sub -V 'mqttv5' --topic 'zilla' --debug
docker run -it --rm eclipse-mosquitto \
mosquitto_sub -V 'mqttv5' --topic 'zilla' \
--host 'host.docker.internal' --port 7183 --debug
```

In a separate session publish a message on the `zilla` topic
In a separate session, publish a message on the `zilla` topic.

```bash:no-line-numbers
mosquitto_pub -V 'mqttv5' --topic 'zilla' --message 'Hello, world' --debug --insecure
docker run -it --rm eclipse-mosquitto \
mosquitto_pub -V 'mqttv5' --topic 'zilla' --message 'Hello, world' \
--host 'host.docker.internal' --port 7183 --debug --insecure
```

Your subscribed session should receive the message
Send messages with the retained flag.

::: note Wait for the services to start
if you are stuck on `Client null sending CONNECT`, the likely cause is Zilla and Kafka are still starting up.
:::
```bash:no-line-numbers
docker run -it --rm eclipse-mosquitto \
mosquitto_pub -V 'mqttv5' --topic 'zilla' --message 'Hello, retained' --retain \
--host 'host.docker.internal' --port 7183 --debug --insecure
```

Then restart the `mosquitto_sub` above. The latest retained message is delivered, and the other messages are not.

### Remove the running containers

Expand All @@ -170,12 +72,11 @@ docker-compose down
```

::: tip See more of what Zilla can do
Go deeper into this concept with the [mqtt.kafka.broker](https://github.com/aklivity/zilla-examples/tree/main/mqtt.kafka.broker) example.
Go deeper into this concept with the [Running an MQTT Kafka broker](../../how-tos/mqtt/mqtt.kafka.broker.md) example.
:::

## Going Deeper

Try out more MQTT examples:

- [mqtt.kafka.broker](https://github.com/aklivity/zilla-examples/tree/main/mqtt.kafka.broker)
- [mqtt.kafka.broker.jwt](https://github.com/aklivity/zilla-examples/tree/main/mqtt.kafka.broker.jwt)
2 changes: 1 addition & 1 deletion src/tutorials/mqtt/zilla.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ bindings:
options:
host: 0.0.0.0
port:
- 1883
- 7183
exit: mqtt_server

# MQTT Broker With an exit to Kafka
Expand Down
Loading

0 comments on commit 895905d

Please sign in to comment.