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

Improved CONTRIBUTING.md file #117

Merged
merged 1 commit into from
May 10, 2023

Conversation

jirihnidek
Copy link
Contributor

  • Fixed one issue with example
  • Added instruction how to start mosquitto server
  • Replaced test.mosquito.org with localhost, because it is really easy to run mosquitto server
  • Wrapped too long lines
  • Added some notes

@jirihnidek jirihnidek force-pushed the jhnidek/fix_contributing.md branch from 23a5ad3 to 2cfaf0d Compare May 5, 2023 15:03
Copy link
Collaborator

@subpop subpop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the suggestions. I have a few ideas on how to keep the document organized as well.

CONTRIBUTING.md Outdated
```

You should see the message logged to the output of `sub` in [Terminal
3](#terminal-3) and receipt of the message logged in the output of `yggd` in
[Terminal 1](#terminal-1).
[Terminal 1](#terminal-1). The `echo` worker does not receive any message in this
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it makes sense to declare what won't happen. If that were necessary, we would have to document what won't happen a lot, in many places. My guess is that you thought the ping would send a message to the echo worker; so perhaps we should reorder these sections to send the ping command before starting the echo worker. This shows that MQTT is working, without confusing things by starting the echo worker first.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried the reordering of terminals and it would require switching of terminals. I will add more subsections to section Terminal 4 to emphasize that we send only Ping command and we test sending MQTT command to yggd.

CONTRIBUTING.md Outdated
Comment on lines 6 to 13
`mosquitto` is extremely easy to set up. When you do not do any configuration,
and you start the service like this:

```bash
systemctl start mosquitto
```

The broker will listen on port 1883 for unencrypted connections.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this to the # Quickstart section, perhaps as a "before starting your terminals" section.

Suggested change
`mosquitto` is extremely easy to set up. When you do not do any configuration,
and you start the service like this:
```bash
systemctl start mosquitto
```
The broker will listen on port 1883 for unencrypted connections.
`mosquitto` is extremely easy to set up. The broker will listen on port 1883 for unencrypted
connections without any configration changes.

And add a reference to starting the service before starting up the terminals.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

CONTRIBUTING.md Outdated

Now publish a data message to the echo worker.
Now publish a data message "hello" to the `echo` worker.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Now publish a data message "hello" to the `echo` worker.
Now publish a data message containing the string "hello" to the `echo` worker.

CONTRIBUTING.md Outdated
Comment on lines 83 to 86
> Note: if you implemented your own worker (e.g. called cool_worker),
> you will need to replace the `echo` directive with the name of your
> worker (--directive cool_worker).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These doesn't need to be part of the quickstart. This knowledge will come later when the reader begins to explore what a worker is and how to communicate with them. Not all readers will be worker developers. There is also a Worker Developer Guide on the wiki.

CONTRIBUTING.md Outdated
Comment on lines 92 to 98
There is another option how to test the echo worker. You can use the `yggctl`
like this:

```bash
echo -n "hello" | go run ./cmd/yggctl dispatch -w "echo" -
```

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to keep the quickstart as short and simple as possible. If we don't have a section below on yggctl's capabilities, then let's add one. Otherwise, can we move this to that section?

Copy link
Contributor Author

@jirihnidek jirihnidek May 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I will move it to section related to yggctl.

CONTRIBUTING.md Outdated
Comment on lines 227 to 228
sub -broker tcp://localhost:1883 -topic yggdrasil/$CLIENT_ID/data/in \
-topic yggdrasil/$CLIENT_ID/data/out -topic yggdrasil/$CLIENT_ID/control/out
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're using $(hostname) for client ID in the quickstart, let's change the references here too.

Suggested change
sub -broker tcp://localhost:1883 -topic yggdrasil/$CLIENT_ID/data/in \
-topic yggdrasil/$CLIENT_ID/data/out -topic yggdrasil/$CLIENT_ID/control/out
sub -broker tcp://localhost:1883 -topic yggdrasil/$(hostname)/data/in \
-topic yggdrasil/$(hostname)/data/out -topic yggdrasil/$(hostname)/control/out

CONTRIBUTING.md Outdated
@@ -211,7 +234,8 @@ A client can be sent a `PING` command by generated a control message and
publishing it to the client's "control/in" topic:

```
yggctl generate control-message --type command '{"command":"ping"}' | pub -broker tcp://test.mosquitto.org:8883 -topic yggdrasil/$CLIENT_ID/control/in
yggctl generate control-message --type command '{"command":"ping"}' | \
pub -broker tcp://localhost:1883 -topic yggdrasil/$CLIENT_ID/control/in
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub -broker tcp://localhost:1883 -topic yggdrasil/$CLIENT_ID/control/in
pub -broker tcp://localhost:1883 -topic yggdrasil/$(hostname)/control/in

CONTRIBUTING.md Outdated
@@ -222,7 +246,8 @@ Similarly, a data message can be published to a client using `yggctl generate`
and `pub`.

```
yggctl generate data-message --directive echo hello | pub -broker tcp://test.mosquitto.org:8883 -topic yggdrasil/$CLIENT_ID/data/in
yggctl generate data-message --directive echo hello | \
pub -broker tcp://localhost:1883 -topic yggdrasil/$CLIENT_ID/data/in
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub -broker tcp://localhost:1883 -topic yggdrasil/$CLIENT_ID/data/in
pub -broker tcp://localhost:1883 -topic yggdrasil/$(hostname)/data/in

@jirihnidek jirihnidek force-pushed the jhnidek/fix_contributing.md branch from 2cfaf0d to 7d52ad0 Compare May 9, 2023 09:41
Copy link
Collaborator

@subpop subpop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the approach in the "Terminal 4" section. It more explicitly indicates "Terminal 4" is the interactive terminal; the place where you type stuff to make stuff happen in the other terminals.

CONTRIBUTING.md Outdated
Comment on lines 28 to 32
### Mosquitto

When you do not make any changes of configuration, and you start the service like this:

```bash
systemctl start mosquitto
```

The broker will listen on port 1883 for unencrypted connections (`tcp://localhost:1883`).
We will use this fact in following examples.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Mosquitto
When you do not make any changes of configuration, and you start the service like this:
```bash
systemctl start mosquitto
```
The broker will listen on port 1883 for unencrypted connections (`tcp://localhost:1883`).
We will use this fact in following examples.
This quickstart assumes an unencrypted MQTT broker is listening on `localhost:1883`.
Typically, all that is required to start the `mosquitto` broker is: `systemctl start mosquitto`.

I prefer as much brevity as possible in a quickstart guide.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

CONTRIBUTING.md Outdated
#### Testing MQTT

Publish a "PING" command to the `yggd` "control/in" topic to test sending
MQTT command to `yggd`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MQTT command to `yggd`.
an MQTT message to `yggd`.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@@ -202,7 +221,8 @@ message to the broker, destined for one of the topics `yggd` is subscribed to.
To watch a topic for messages, subscribe to it with `sub`:

```
sub -broker tcp://test.mosquitto.org:8883 -topic yggdrasil/$CLIENT_ID/data/in -topic yggdrasil/$CLIENT_ID/data/out -topic yggdrasil/$CLIENT_ID/control/out
sub -broker tcp://localhost:1883 -topic yggdrasil/$(hostname)/data/in \
-topic yggdrasil/$(hostname)/data/out -topic yggdrasil/$(hostname)/control/out
```

## Publish a message
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Publish a message
## Publish a message
### Over MQTT

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

CONTRIBUTING.md Outdated
Comment on lines 250 to 254
There is another option how to test the `echo` worker. You can use the `yggctl`
like this and send message containing "hello" to the `echo` worker over D-Bus:

```bash
echo -n "hello" | go run ./cmd/yggctl dispatch -w "echo" -
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
There is another option how to test the `echo` worker. You can use the `yggctl`
like this and send message containing "hello" to the `echo` worker over D-Bus:
```bash
echo -n "hello" | go run ./cmd/yggctl dispatch -w "echo" -
### Directly
It is also possible to send data directly to a worker. This method does not publish
a message to the MQTT broker. Instead, it calls a D-Bus method:
```bash
echo -n "hello" | yggctl dispatch -w "echo" -

None of the other examples in this section use go run ./cmd/yggctl. We should be consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

* Fixed one issue with example
* Added instruction how to start mosquitto server
* Replaced test.mosquito.org with localhost, because it is
  really easy to run mosquitto server
* Replaced remaining $CONTROL_id with $(hostname)
* Wrapped too long lines
* Extended and changed some texts little bit
@jirihnidek jirihnidek force-pushed the jhnidek/fix_contributing.md branch from 7d52ad0 to 07be00f Compare May 10, 2023 08:56
@subpop subpop merged commit 7797bf3 into RedHatInsights:main May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants