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

MF-1125 - add provision service docs #33

Merged
merged 14 commits into from
May 7, 2020
Merged

Conversation

mteodor
Copy link
Contributor

@mteodor mteodor commented May 5, 2020

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
@mteodor mteodor added the WIP label May 5, 2020
@mteodor mteodor requested a review from a team as a code owner May 5, 2020 11:18
@drasko
Copy link
Contributor

drasko commented May 5, 2020

Please remove WIP label

@@ -0,0 +1,162 @@
# Provision service

Provision service provides an HTTP API to interact with [Mainflux][mainflux].
Copy link
Contributor

Choose a reason for hiding this comment

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

Tell us first what this service is, then what it provides.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe als explain why we neded this service, the complexity of manual provisioning, what are the manual steps that can be automated, etc...

Provision service provides an HTTP API to interact with [Mainflux][mainflux].
Provision service is used to setup initial applications configuration i.e. things, channels, connections and certificates that will be required for the specific use case especially useful for gateway provision.

For gateways to communicate with [Mainflux][mainflux] configuration is required (mqtt host, thing, channels, certificates...). To get the configuration gateway will send a request to [Bootstrap][bootstrap] service providing `<external_id>` and `<external_key>` in request. To make a request to [Bootstrap][bootstrap] service you can use [Agent][agent] service on a gateway.
Copy link
Contributor

Choose a reason for hiding this comment

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

It is unclear what is configuration gateway. Yuo mean unconfigured gateway maybe?


For gateways to communicate with [Mainflux][mainflux] configuration is required (mqtt host, thing, channels, certificates...). To get the configuration gateway will send a request to [Bootstrap][bootstrap] service providing `<external_id>` and `<external_key>` in request. To make a request to [Bootstrap][bootstrap] service you can use [Agent][agent] service on a gateway.

To create bootstrap configuration you can use [Bootstrap][bootstrap] or `Provision` service. [Mainflux UI][mfxui] uses [Bootstrap][bootstrap] service for creating gateway configurations. `Provision` service should provide an easy way of provisioning your gateways i.e creating bootstrap configuration and as many things and channels that your setup requires.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bit confusing. Why UI uses Bootstrap when there is Provisioning? Maybe this is temporary slution, and UI will move to Provision?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that is something that we need to consider

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, once you reach the conclusion, please write it here as a note.

| MF_PROVISION_BS_AUTO_WHITEIST | Should thing be auto whitelisted | true |
| MF_PROVISION_BS_CONTENT | Bootstrap service content | {} |

By default, call to `/mapping` endpoint will create one thing and two channels (`control` and `data`) and connect it. If there is a requirement for different provision layout we can use [config](docker/configs/config.toml) file in addition to environment variables.
Copy link
Contributor

Choose a reason for hiding this comment

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

Take care with these links, they will not work in docs repo, as they are relative

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
@mteodor mteodor removed the WIP label May 6, 2020
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

For gateways to communicate with [Mainflux][mainflux] configuration is required (mqtt host, thing, channels, certificates...). To get the configuration gateway will send a request to [Bootstrap][bootstrap] service providing `<external_id>` and `<external_key>` in request. To make a request to [Bootstrap][bootstrap] service you can use [Agent][agent] service on a gateway.
For provisioning we can use [Mainflux CLI](./cli.md) creating users and for each node in the edge (eg. gateway) required number of things, channels, connecting them and creating certificates if needed.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would use https://github.com/mainflux/mainflux/tree/master/cli here


For gateways to communicate with [Mainflux][mainflux] configuration is required (mqtt host, thing, channels, certificates...). Gateway will send a request to [Bootstrap][bootstrap] service providing `<external_id>` and `<external_key>` in http request to get the configuration. To make a request to [Bootstrap][bootstrap] service you can use [Agent][agent] service on a gateway.

To create bootstrap configuration you can use [Bootstrap][bootstrap] or `Provision` service. [Mainflux UI][mfxui] uses [Bootstrap][bootstrap] service for creating gateway configurations. `Provision` service should provide an easy way of provisioning your gateways i.e creating bootstrap configuration and as many things and channels that your setup requires.
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove 1 white space before Provision service should provide


To create bootstrap configuration you can use [Bootstrap][bootstrap] or `Provision` service. [Mainflux UI][mfxui] uses [Bootstrap][bootstrap] service for creating gateway configurations. `Provision` service should provide an easy way of provisioning your gateways i.e creating bootstrap configuration and as many things and channels that your setup requires.

Also you may use provision service to create certificates for each thing. Each service running on gateway may require more than one thing and channel for communication. Let's say that you are using services [Agent][agent] and [Export][exp] on a gateway you will need two channels for `Agent` (`data` and `control`) and one for `Export` and one thing. Additionally if you enabled mtls each service will need its own thing and certificate for access to [Mainflux][mainflux]. Your setup could require any number of things and channels this kind of setup we can call `provision layout`.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not convinced about Let's say that in docs.
Also, is this correct? you will need two channels for Agent (data and control) and one for Export and one thing.


In `config.toml` we can enlist array of things and channels that we want to create and make connections between them which we call provision layout.

Metadata can be whatever suits your needs except that at least one thing needs to have `external_id` (which is populated with value from [request](#example)). Thing that has `external_id` will be used for creating bootstrap configuration which can be fetched with [Agent][agent].
Copy link
Contributor

Choose a reason for hiding this comment

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

Things Metadata must have an "external_id" field which is populated with...

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
@mteodor mteodor added the documentation Improvements or additions to documentation label May 7, 2020
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
It is part of process of setting up IoT application where
we connect devices on edge with platform in cloud.

For provisioning we can use [Mainflux CLI][cli] for creating users
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this return new line after ...creating users ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this new line will not be rendered, if that is what you mean

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

Things Metadata can be whatever suits your needs.
Thing that has metadata with `external_id` will have bootstrap configuration created, `external_id` value will be populated with value from [request](#example)).
Bootstrap configuration which can be fetched with [Agent][agent].
Copy link
Contributor

Choose a reason for hiding this comment

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

Bootstrap configuration which can be fetched with [Agent][agent].

# Provision service

Provisioning is a process of configuration of an IoT platform in which system operator creates
and sets-up different entities used in the platform - users, channels and things.
Copy link
Contributor

@dborovcanin dborovcanin May 7, 2020

Choose a reason for hiding this comment

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

..., and things.


Provisioning is a process of configuration of an IoT platform in which system operator creates
and sets-up different entities used in the platform - users, channels and things.
It is part of process of setting up IoT application where
Copy link
Contributor

Choose a reason for hiding this comment

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

applications (plural)

we connect devices on edge with platform in cloud.

For provisioning we can use [Mainflux CLI][cli] for creating users
and for each node in the edge (eg. gateway) required number of things, channels, connecting them and creating certificates if needed.
Copy link
Contributor

@dborovcanin dborovcanin May 7, 2020

Choose a reason for hiding this comment

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

..., and creating certificates...

For provisioning we can use [Mainflux CLI][cli] for creating users
and for each node in the edge (eg. gateway) required number of things, channels, connecting them and creating certificates if needed.

Provision service is used to setup initial applications configuration once user is created.
Copy link
Contributor

Choose a reason for hiding this comment

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

... is used to set up initial application...

Provision service is used to setup initial applications configuration once user is created.
Provision service creates things, channels, connections and certificates.
Once user is created we can use provision to create setup for edge node
in one http request instead of issuing several cli commands.
Copy link
Contributor

@dborovcanin dborovcanin May 7, 2020

Choose a reason for hiding this comment

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

Please use capital letters in acronyms: HTTP request, MQTT protocol, CLI (commands), TLS, API... Check for these in the rest of the document, as well.

Things Metadata can be whatever suits your needs.
Thing that has metadata with `external_id` will have bootstrap configuration created, `external_id` value will be populated with value from [request](#example)).
Bootstrap configuration which can be fetched with [Agent][agent].
For channels metadata `type` is reserved for `control` and `data` which we use with [Agent][agent].
Copy link
Contributor

Choose a reason for hiding this comment

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

For channels, metadata...

Also you may use provision service to create certificates for each thing.
Each service running on gateway may require more than one thing and channel for communication.
If, for example, you are using services [Agent][agent] and [Export][exp] on a gateway you will need two channels for `Agent` (`data` and `control`) and one thing for `Export`.
Additionally if you enabled mtls each service will need its own thing and certificate for access to [Mainflux][mainflux].
Copy link
Contributor

Choose a reason for hiding this comment

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

Additionally, if you enable mTLS...

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
@@ -0,0 +1,324 @@
Provisioning is a process of configuration of an IoT platform in which system operator creates and sets-up different entities
used in the platform - users, channels and things.
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to break line here

> This endpoint will be depreciated in 0.11.0. It will be replaced with the bulk endpoint currently found at /things/bulk.

Things are created by executing request `POST /things` with a JSON payload.
Note that you will also need `user_auth_token` in order to create things
Copy link
Contributor

Choose a reason for hiding this comment

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

You can move this to the upper line

## System provisioning

Before proceeding, make sure that you have created a new account, and obtained
an authorization key.
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for line break here


### Bulk provisioning channels

Multiple channels can be created by executing a `POST /things/bulk` request with a JSON payload. The payload should contain a JSON array of the channels to be created. If there is an error any of the channels, none of the channels will be created.
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is actually good. Renders nicely, easy to read. Maybe align all to this style.

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
drasko
drasko previously approved these changes May 7, 2020
Copy link
Contributor

@drasko drasko left a comment

Choose a reason for hiding this comment

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

LGTM

blokovi
blokovi previously approved these changes May 7, 2020
@@ -1,5 +1,4 @@
Provisioning is a process of configuration of an IoT platform in which system operator creates and sets-up different entities
used in the platform - users, channels and things.
Provisioning is a process of configuration of an IoT platform in which system operator creates and sets-up different entities used in the platform - users, channels and things.
Copy link
Contributor

Choose a reason for hiding this comment

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

, and things.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

note that this , is optional

Copy link
Contributor

Choose a reason for hiding this comment

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

What's this comment about? Putting , before and is gramatically incorrect.

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 think it is not

@@ -116,29 +107,25 @@ Content-Length: 1105
}
```

You can specify `offset` and `limit` parameters in order to fetch specific
group of things. In that case, your request should look like:
You can specify `offset` and `limit` parameters in order to fetch specific group of things. In that case, your request should look like:
Copy link
Contributor

Choose a reason for hiding this comment

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

...to fetch a specific group...

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 think that this is ok

curl -s -S -i --cacert docker/ssl/certs/ca.crt -H "Authorization: <user_auth_token>" https://localhost/things?offset=0&limit=5
```

You can specify `name` and/or `metadata` parameters in order to fetch specific
group of things. When specifiying metadata you can specify just a part of the metadata json you want to match
You can specify `name` and/or `metadata` parameters in order to fetch specific group of things. When specifiying metadata you can specify just a part of the metadata json you want to match
Copy link
Contributor

Choose a reason for hiding this comment

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

specifying, JSON

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, after match .


For provisioning we can use [Mainflux CLI][cli] for creating users and for each node in the edge (eg. gateway) required number of things, channels, connecting them, and creating certificates if needed.

Provision service is used to setup initial application configuration once user is created. Provision service creates things, channels, connections, and certificates. Once user is created we can use provision to create setup for edge node in one HTTP request instead of issuing several CLI commands.
Copy link
Contributor

Choose a reason for hiding this comment

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

Provision service is used to set up...
...to create a setup...


To create bootstrap configuration you can use [Bootstrap][bootstrap] or `Provision` service. [Mainflux UI][mfxui] uses [Bootstrap][bootstrap] service for creating gateway configurations. `Provision` service should provide an easy way of provisioning your gateways i.e creating bootstrap configuration and as many things and channels that your setup requires.

Also you may use provision service to create certificates for each thing. Each service running on gateway may require more than one thing and channel for communication.
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, you...


Configuration can be specified in [config.toml][conftoml]. Config file can specify all the settings that environment variables can configure and in addition `/mapping` endpoint provision layout can be configured.

In `config.toml` we can enlist array of things and channels that we want to create and make connections between them which we call provision layout.
Copy link
Contributor

Choose a reason for hiding this comment

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

... enlist an array...

In order to create necessary entities provision service needs to authenticate against Mainflux.
To provide authentication credentials to the provision service you can pass it in as an environment variable or in a config file as Mainflux user and password or as API token (that can be issued on `/users` or `/keys` endpoint of [authn][authn].

Additionally users or API token can be passed in Authorization header, this authentication takes precedence over others.
Copy link
Contributor

Choose a reason for hiding this comment

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

Additionally, ...

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
@mteodor mteodor dismissed stale reviews from blokovi and drasko via 5836448 May 7, 2020 21:01
Copy link
Contributor

@manuio manuio left a comment

Choose a reason for hiding this comment

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

LGTM

@dborovcanin dborovcanin merged commit 47fd64e into absmach:master May 7, 2020
mteodor added a commit to mteodor/docs that referenced this pull request May 28, 2021
* add provision service docs

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* update docs

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* add some desc on prov

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix layout, and minor text change

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix links

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* add section, text change

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* lector fix

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix link

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* renam file

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* reformat and fix typos

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix name

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* renam file

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* update style

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* small changes

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
blokovi pushed a commit to blokovi/docs that referenced this pull request Jun 10, 2021
* add provision service docs

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* update docs

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* add some desc on prov

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix layout, and minor text change

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix links

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* add section, text change

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* lector fix

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix link

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* renam file

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* reformat and fix typos

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix name

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* renam file

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* update style

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* small changes

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
blokovi pushed a commit to blokovi/docs that referenced this pull request Jun 10, 2021
* add provision service docs

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* update docs

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* add some desc on prov

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix layout, and minor text change

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix links

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* add section, text change

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* lector fix

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix link

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* renam file

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* reformat and fix typos

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix name

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* renam file

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* update style

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* small changes

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants