Skip to content
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

NOISSUE - Update edge documentation #152

Merged
merged 3 commits into from
Aug 1, 2023
Merged
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
18 changes: 12 additions & 6 deletions docs/dev-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,22 +226,28 @@ which will do this copying of the binaries.
Mainflux depends on several infrastructural services, notably the default message broker, [NATS](https://www.nats.io/) and [PostgreSQL](https://www.postgresql.org/) database.

#### Message Broker

Mainflux uses NATS as it's default central message bus. For development purposes (when not run via Docker), it expects that NATS is installed on the local system.

To do this execute:

```
go get github.com/nats-io/gnatsd
```bash
go install github.com/nats-io/nats-server/v2@latest
```

This will install `gnatsd` binary that can be simply run by executing:
This will install `nats-server` binary that can be simply run by executing:

```
gnatsd
```bash
nats-server
```

If you want to change the default message broker to [RabbitMQ](https://www.rabbitmq.com/download.html), [VerneMQ](https://vernemq.com/downloads/) or [Kafka](https://kafka.apache.org/quickstart) you need to install it on the local system.
If you want to change the default message broker to [RabbitMQ](https://www.rabbitmq.com/download.html) or [VerneMQ](https://vernemq.com/downloads/) you need to install it on the local system.
To run using a different broker you need to set the `MF_BROKER_TYPE` env variable to `nats`, `rabbitmq` or `vernemq` during make and run process.

```bash
MF_BROKER_TYPE=<broker-type> make
MF_BROKER_TYPE=<broker-type> make run
```

#### PostgreSQL
Mainflux uses PostgreSQL to store metadata (`users`, `things` and `channels` entities alongside with authorization tokens).
Expand Down
10 changes: 6 additions & 4 deletions docs/edge.md
Original file line number Diff line number Diff line change
Expand Up @@ -530,19 +530,20 @@ cd build

#### Testing Export
```bash
git clone https://github.com/nats-io/nats.go
cd github.com/nats-io/nats.go/examples/nats-pub
go run main.go -s http://localhost:4222 export.test "[{\"bn\":\"test\"}]";
git clone https://github.com/mainflux/agent
go run ./examples/publish/main.go -s http://localhost:4222 export.test "[{\"bn\":\"test\"}]";
```

We have configured route for export, `nats_topic = ">"` means that it will listen to `NATS` subject `export.>` and `mqtt_topic` is configured so that data will be sent to MQTT broker on topic `channels/e2adcfa6-96b2-425d-8cd4-ff8cb9c056ce/messages` with appended `NATS` subject.
We have configured route for export, `nats_topic = ">"` means that it will listen to `NATS` subject `export.>` and `mqtt_topic` is configured so that data will be sent to MQTT broker on topic `channels/e2adcfa6-96b2-425d-8cd4-ff8cb9c056ce/messages` with appended `NATS` subject. Other brokers can such as `rabbitmq` can be used, for more detail refer to [dev-guide][dev-guide].

In terminal where export is started you should see following message:

```log
{"level":"debug","message":"Published to: export.test, payload: [{\"bn\":\"test\"}]","ts":"2020-05-08T15:14:15.757298992Z"}
```

In Mainflux `mqtt` service:

```log
mainflux-mqtt | {"level":"info","message":"Publish - client ID export-88529fb2-6c1e-4b60-b9ab-73b5d89f7404 to the topic: channels/e2adcfa6-96b2-425d-8cd4-ff8cb9c056ce/messages/export/test","ts":"2020-05-08T15:16:02.999684791Z"}
```
Expand All @@ -552,3 +553,4 @@ mainflux-mqtt | {"level":"info","message":"Publish - client ID export-88529fb2
[env]:(https://github.com/mainflux/export#environmet-variables)
[agent]:(https://github.com/mainflux/agent)
[protomsg]:https://github.com/mainflux/mainflux/blob/master/pkg/messaging/message.proto
[dev-guide]: /docs/dev-guide.md/#message-broker