Skip to content

Commit

Permalink
NOISSUE - Rename MF_ to MG_ (#180)
Browse files Browse the repository at this point in the history
* Updated cli usage command

Signed-off-by: JeffMboya <[email protected]>

* Updated cli usage

Signed-off-by: JeffMboya <[email protected]>

* Renamed mainflux to magistrala

Signed-off-by: JeffMboya <[email protected]>

* Start ignoring config.toml

* Removed config.toml file

Signed-off-by: JeffMboya <[email protected]>

* Start ignoring config.toml

* Renamed mainflux to magistrala

Signed-off-by: JeffMboya <[email protected]>

* Fixed URLs

Signed-off-by: JeffMboya <[email protected]>

* Fixed URLs

Signed-off-by: JeffMboya <[email protected]>

* Fixed Typos

Signed-off-by: JeffMboya <[email protected]>

* Reverted changes to events.md

Signed-off-by: JeffMboya <[email protected]>

* Fix trailing comma in JSON data for curl command

Signed-off-by: JeffMboya <[email protected]>

* Update API documentation links

* Rename MF_ to MG_

Signed-off-by: JeffMboya <[email protected]>

* Rename MF_ to MG_

Signed-off-by: JeffMboya <[email protected]>

* Rename MF_ to MG_

Signed-off-by: JeffMboya <[email protected]>

* Rename MF_ to MG_

Signed-off-by: JeffMboya <[email protected]>

---------

Signed-off-by: JeffMboya <[email protected]>
  • Loading branch information
JeffMboya authored May 17, 2024
1 parent c8a7b8c commit 18edfac
Show file tree
Hide file tree
Showing 19 changed files with 1,514 additions and 1,218 deletions.
3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Pull request title should be `MF-XXX - description` or `NOISSUE - description` where XXX is ID of issue that this PR relate to.
Pull request title should be `MG-XXX - description` or `NOISSUE - description` where XXX is ID of issue that this PR relate to.
Please review the [CONTRIBUTING.md](./CONTRIBUTING.md) file for detailed contributing guidelines.

### What does this do?

### Which issue(s) does this PR fix/relate to?

Put here `Resolves #XXX` to auto-close the issue that your PR fixes (if such)

### List any changes that modify/break current functionality
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ git checkout master
git pull --rebase upstream master
```

Create a new topic branch from `master` using the naming convention `MF-[issue-number]`
Create a new topic branch from `master` using the naming convention `MG-[issue-number]`
to help us keep track of your contribution scope:

```
git checkout -b MF-[issue-number]
git checkout -b MG-[issue-number]
```

Commit your changes in logical chunks. When you are ready to commit, make sure
Expand All @@ -80,7 +80,7 @@ git pull --rebase upstream master
Push your topic branch up to your fork:

```
git push origin MF-[issue-number]
git push origin MG-[issue-number]
```

[Open a Pull Request](https://help.github.com/articles/using-pull-requests/) with a clear title
Expand Down
7 changes: 4 additions & 3 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ curl -sSiX PATCH http://localhost/users/<user_id> -H "Content-Type: application/
{
"name": "[new_name]",
"metadata": {
"[key]": "[value]",
"[key1]": "[value1]",
"[key2]": "[value2]"
}
}
EOF
Expand All @@ -321,7 +322,7 @@ curl -sSiX PATCH http://localhost/users/1890c034-7ef9-4cde-83df-d78ea1d4d281 -H
{
"name": "Jane Doe",
"metadata": {
"location": "london",
"location": "london"
}
}
EOF
Expand Down Expand Up @@ -2704,5 +2705,5 @@ Connection: keep-alive
Access-Control-Expose-Headers: Location
```
[api]: https://api.mainflux.io
[api]: https://absmach.github.io/magistrala
[predefined-policies]: /authorization/#summary-of-defined-policies
24 changes: 12 additions & 12 deletions docs/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ The following actions are supported:
Federated authentication is a process of authenticating users using external identity providers. Magistrala supports federated authentication using [OpenID Connect][oidc] protocol. Magistrala is a resource provider and it uses [Google Identity Platform][google-identity-platform] as an identity provider. To use federated authentication, you need to create a project in Google Cloud Platform and enable Google Identity Platform API. After that, you need to create OAuth 2.0 credentials and configure the consent screen. This can be done by following Google's [documentation][google-identity-platform-docs]. Once you have created OAuth 2.0 credentials, you need to set the following environment variables:

```bash
MF_USERS_GOOGLE_CLIENT_ID=985229335584-m2mft8lqbgfn5gfw9ftrm3r2sgu4tsrw.apps.googleusercontent.com
MF_USERS_GOOGLE_CLIENT_SECRET=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YUIpw
MF_UI_GOOGLE_REDIRECT_URL=http://localhost/google-callback
MF_USERS_GOOGLE_STATE=pGXVNhEeKfycuBzk5InlSfMlEU9UrhlkTUOSqhsgDzXP2Y4RsN
MF_USERS_UI_REDIRECT_URL=http://localhost:9090
MG_USERS_GOOGLE_CLIENT_ID=985229335584-m2mft8lqbgfn5gfw9ftrm3r2sgu4tsrw.apps.googleusercontent.com
MG_USERS_GOOGLE_CLIENT_SECRET=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YUIpw
MG_UI_GOOGLE_REDIRECT_URL=http://localhost/google-callback
MG_USERS_GOOGLE_STATE=pGXVNhEeKfycuBzk5InlSfMlEU9UrhlkTUOSqhsgDzXP2Y4RsN
MG_USERS_UI_REDIRECT_URL=http://localhost:9090
```

1. `MF_USERS_GOOGLE_CLIENT_ID` - Google OAuth 2.0 client ID
2. `MF_USERS_GOOGLE_CLIENT_SECRET` - Google OAuth 2.0 client secret
3. `MF_UI_GOOGLE_REDIRECT_URL` - Google OAuth 2.0 redirect URL to handle callback after successful authentication. This URL must be registered in the Google Cloud Platform.
4. `MF_USERS_GOOGLE_STATE` - Random string used to protect against cross-site request forgery attacks.
5. `MF_USERS_UI_REDIRECT_URL` - URL to redirect user after successful authentication. This can be your Magistrala UI URL.
1. `MG_USERS_GOOGLE_CLIENT_ID` - Google OAuth 2.0 client ID
2. `MG_USERS_GOOGLE_CLIENT_SECRET` - Google OAuth 2.0 client secret
3. `MG_UI_GOOGLE_REDIRECT_URL` - Google OAuth 2.0 redirect URL to handle callback after successful authentication. This URL must be registered in the Google Cloud Platform.
4. `MG_USERS_GOOGLE_STATE` - Random string used to protect against cross-site request forgery attacks.
5. `MG_USERS_UI_REDIRECT_URL` - URL to redirect user after successful authentication. This can be your Magistrala UI URL.

Magistrala handles the authentication callback at `<MF_BASE_URL>/google-callback` endpoint, where `<MF_BASE_URL>` is the base URL of your Magistrala instance. This endpoint needs to be registered in the Google Cloud Platform and it must match the value of `MF_UI_GOOGLE_REDIRECT_URL` environment variable. From the UI, `google state` is prefixed with the `signin` or `signup` operation to be able to distinguish between sign-in and sign-up operations. For example, if a user is not signed up, the UI will display an error message and a button to sign-up. The error message is sent from the backend using a cookie with the name `error`. The UI will read the error message from the cookie and display it to the user. This cookie expires in 1 second. When a user signs up, Magistrala creates a local copy of the user with an ID provided by Google, the name and email address provided by Google and the password is left empty as the user is authenticated using Google, i.e. external user. The user can be created only once, so if the user already exists, the error will be sent to the UI via the error cookie. Finally, the user is redirected to the URL provided in `MF_USERS_UI_REDIRECT_URL` environment variable upon successful authentication. This should be the base URL of your UI.
Magistrala handles the authentication callback at `<MG_BASE_URL>/google-callback` endpoint, where `<MG_BASE_URL>` is the base URL of your Magistrala instance. This endpoint needs to be registered in the Google Cloud Platform and it must match the value of `MG_UI_GOOGLE_REDIRECT_URL` environment variable. From the UI, `google state` is prefixed with the `signin` or `signup` operation to be able to distinguish between sign-in and sign-up operations. For example, if a user is not signed up, the UI will display an error message and a button to sign-up. The error message is sent from the backend using a cookie with the name `error`. The UI will read the error message from the cookie and display it to the user. This cookie expires in 1 second. When a user signs up, Magistrala creates a local copy of the user with an ID provided by Google, the name and email address provided by Google and the password is left empty as the user is authenticated using Google, i.e. external user. The user can be created only once, so if the user already exists, the error will be sent to the UI via the error cookie. Finally, the user is redirected to the URL provided in `MG_USERS_UI_REDIRECT_URL` environment variable upon successful authentication. This should be the base URL of your UI.

The `MF_USERS_GOOGLE_CLIENT_ID`, `MF_USERS_GOOGLE_CLIENT_SECRET`, `MF_UI_GOOGLE_REDIRECT_URL` and `MF_USERS_GOOGLE_STATE` environment variables should be the same for the UI and users service. The `MF_USERS_UI_REDIRECT_URL` environment variable should be the URL of your UI which is used to redirect the user after successful authentication.
The `MG_USERS_GOOGLE_CLIENT_ID`, `MG_USERS_GOOGLE_CLIENT_SECRET`, `MG_UI_GOOGLE_REDIRECT_URL` and `MG_USERS_GOOGLE_STATE` environment variables should be the same for the UI and users service. The `MG_USERS_UI_REDIRECT_URL` environment variable should be the URL of your UI which is used to redirect the user after successful authentication.

Magistrala uses the `access_token` provided by Google only to fetch user information which includes user id, name, given name, family name, picture and locale. The `access_token` is not stored in the database and it's not used for any other purpose. The `id_token` is not used as it presents challenges on refreshing it, thus Magistrala issues its own `access_token` and `refresh_token` stored in the HTTP-only cookie and it's used to authenticate the user in the subsequent requests.

Expand Down
4 changes: 2 additions & 2 deletions docs/benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Note that if you are installing MZBench on external server (i.e. Digital Ocean d
- change default value for `network_interface` from `127.0.0.1` to `0.0.0.0` in configuration file. Default configuration file location is `~/.config/mzbench/server.config`, create it from sample configuration file `~/.config/mzbench/server.config.example`
- open port `4800` with `ufw allow 4800`

MZBench can run your test scenarios on many nodes, simultaneously. For now, you are able to run tests locally, so your nodes will be virtual nodes on machine where MZBench server is installed (your PC or DO droplet). You can try one of our [MQTT scenarios][mf-benchmark] that uses [vmq_mzbench][vmq_mzbench] worker. Copy-paste scenario in MZBench dashboard, click button _Environmental variables_ -> _Add from script_ and add appropriate values. Because it's running locally, you should try with smaller values, for example for fan-in scenario use 100 publishers on 2 nodes. Try this before moving forward in setting up Amazon EC2 plugin.
MZBench can run your test scenarios on many nodes, simultaneously. For now, you are able to run tests locally, so your nodes will be virtual nodes on machine where MZBench server is installed (your PC or DO droplet). You can try one of our [MQTT scenarios][mg-benchmark] that uses [vmq_mzbench][vmq_mzbench] worker. Copy-paste scenario in MZBench dashboard, click button _Environmental variables_ -> _Add from script_ and add appropriate values. Because it's running locally, you should try with smaller values, for example for fan-in scenario use 100 publishers on 2 nodes. Try this before moving forward in setting up Amazon EC2 plugin.

### Setting up Amazon EC2 plugin

Expand Down Expand Up @@ -135,6 +135,6 @@ TBD
[satori]: https://github.com/satori-com/mzbench
[mzbench-cli]: https://github.com/mzbench/mzbench/blob/master/doc/cli.md
[mzbench-dashboard]: https://github.com/mzbench/mzbench/blob/master/doc/dashboard.md
[mf-benchmark]: https://github.com/mainflux/benchmark/tree/master/mzbench
[mg-benchmark]: https://github.com/absmach/benchmark/tree/master/mzbench
[mzbench-architecture-running]: https://github.com/mzbench/mzbench/raw/master/doc/images/scheme_2.png
[mzbench-scenarios]: https://github.com/mzbench/mzbench/blob/master/scenarios/spec.md#pre_hook-and-post_hook
4 changes: 2 additions & 2 deletions docs/bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,12 @@ func main() {
To use Magistrala CLI for the secure bootstrap configuration, use the following command:

```bash
magistrala_cli bootstrap secure <external_id> <external_key> <crypto_key>
magistrala-cli bootstrap secure <external_id> <external_key> <crypto_key>
```
for example

```bash
cli bootstrap bootstrap secure '09:6:0:sb:sa' 'key' 'v7aT0HGxJxt2gULzr3RHwf4WIf6DusPp'
magistrala-cli bootstrap bootstrap secure '09:6:0:sb:sa' 'key' 'v7aT0HGxJxt2gULzr3RHwf4WIf6DusPp'
```


Expand Down
10 changes: 5 additions & 5 deletions docs/certs.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Certificate service can create certificates in PKI mode - where certificates iss

### PKI mode

When `MF_CERTS_VAULT_HOST` is set, it is presumed that `Vault` is installed and `certs` service will issue certificates using `Vault` API.
When `MG_CERTS_VAULT_HOST` is set, it is presumed that `Vault` is installed and `certs` service will issue certificates using `Vault` API.

First you'll need to set up `Vault`.

Expand All @@ -20,10 +20,10 @@ To setup `Vault` follow steps in [Build Your Own Certificate Authority (CA)][vau
To setup certs service with `Vault` following environment variables must be set:

```bash
MF_CERTS_VAULT_HOST=vault-domain.com
MF_CERTS_VAULT_PKI_PATH=<vault_pki_path>
MF_CERTS_VAULT_ROLE=<vault_role>
MF_CERTS_VAULT_TOKEN=<vault_acces_token>
MG_CERTS_VAULT_HOST=vault-domain.com
MG_CERTS_VAULT_PKI_PATH=<vault_pki_path>
MG_CERTS_VAULT_ROLE=<vault_role>
MG_CERTS_VAULT_TOKEN=<vault_acces_token>
```

For lab purposes you can use docker-compose and script for setting up PKI in [meodor-vault][meodor-vault].
Expand Down
10 changes: 5 additions & 5 deletions docs/dev-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Make sure that you have [Protocol Buffers][protocol-buffers] (version 21.12) com

A copy of [Go][go-install] (version 1.19.4) and docker template (version 3.7) will also need to be installed on your system.

If any of these versions seem outdated, the latest can always be found in our [CI script][mf-ci-scripts].
If any of these versions seem outdated, the latest can always be found in our [CI script][mg-ci-scripts].

### Build All Services

Expand Down Expand Up @@ -231,11 +231,11 @@ nats-server
```

If you want to change the default message broker to [RabbitMQ][rabbitmq], [VerneMQ][vernemq] or [Kafka][kafka] 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.
To run using a different broker you need to set the `MG_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
MG_BROKER_TYPE=<broker-type> make
MG_BROKER_TYPE=<broker-type> make run
```

#### PostgreSQL
Expand Down Expand Up @@ -279,7 +279,7 @@ Please assure that MQTT microservice has `node_modules` installed, as explained
[protobuf]: https://github.com/google/protobuf
[google-protobuf]: https://google.golang.org/protobuf/proto
[go-install]: https://golang.org/doc/install
[mf-ci-scripts]: https://github.com/absmach/magistrala/blob/master/scripts/ci.sh
[mg-ci-scripts]: https://github.com/absmach/magistrala/blob/master/scripts/ci.sh
[scratch-docker]: https://hub.docker.com/_/scratch/
[cleanup-docker]: #cleaning-up-your-dockerized-magistrala-setup
[docker-compose-ref]: https://docs.docker.com/compose/reference/overview/
Expand Down
48 changes: 24 additions & 24 deletions docs/edge.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ git clone https://github.com/absmach/agent.git
make
cd build

MF_AGENT_LOG_LEVEL=debug \
MF_AGENT_BOOTSTRAP_KEY=edged \
MF_AGENT_BOOTSTRAP_ID=34:e1:2d:e6:cf:03 ./magistrala-agent
MG_AGENT_LOG_LEVEL=debug \
MG_AGENT_BOOTSTRAP_KEY=edged \
MG_AGENT_BOOTSTRAP_ID=34:e1:2d:e6:cf:03 ./magistrala-agent

{"level":"info","message":"Requesting config for 34:e1:2d:e6:cf:03 from http://localhost:9013/things/bootstrap","ts":"2019-12-05T04:47:24.98411512Z"}
{"level":"info","message":"Getting config for 34:e1:2d:e6:cf:03 from http://localhost:9013/things/bootstrap succeeded","ts":"2019-12-05T04:47:24.995465239Z"}
Expand All @@ -93,8 +93,8 @@ MF_AGENT_BOOTSTRAP_ID=34:e1:2d:e6:cf:03 ./magistrala-agent
{"level":"info","message":"Subscribed to MQTT broker","ts":"2019-12-05T04:47:25.012930443Z"}
```

- `MF_AGENT_BOOTSTRAP_KEY` - is `external_key` in bootstrap configuration.
- `MF_AGENT_BOOSTRAP_ID` - is `external_id` in bootstrap configuration.
- `MG_AGENT_BOOTSTRAP_KEY` - is `external_key` in bootstrap configuration.
- `MG_AGENT_BOOSTRAP_ID` - is `external_id` in bootstrap configuration.

#### Remote execution of commands via Agent

Expand Down Expand Up @@ -143,7 +143,7 @@ Payload is up to the application and service itself.

### EdgeX

[Edgex][edgex-repo] control messages are sent and received over control channel. MF sends a control SenML of the following form:
[Edgex][edgex-repo] control messages are sent and received over control channel. MG sends a control SenML of the following form:

```bash
[{"bn":"<uuid>:", "n":"control", "vs":"<cmd>, <param>, edgexsvc1, edgexsvc2, …, edgexsvcN"}}]
Expand Down Expand Up @@ -270,25 +270,25 @@ By default `Export` service looks for config file at [`../configs/config.toml`][

### Environment variables

Service will first look for `MF_EXPORT_CONFIG_FILE` for configuration and if not found it will be configured with env variables and new config file specified with `MF_EXPORT_CONFIG_FILE` (default value will be used if none specified) will be saved with values populated from env vars. The service is configured using the [environment variables][env] as presented in the table. Note that any unset variables will be replaced with their default values.
Service will first look for `MG_EXPORT_CONFIG_FILE` for configuration and if not found it will be configured with env variables and new config file specified with `MG_EXPORT_CONFIG_FILE` (default value will be used if none specified) will be saved with values populated from env vars. The service is configured using the [environment variables][env] as presented in the table. Note that any unset variables will be replaced with their default values.

For values in environment variables to take effect make sure that there is no `MF_EXPORT_CONFIG_FILE` file.
For values in environment variables to take effect make sure that there is no `MG_EXPORT_CONFIG_FILE` file.

If you run with environment variables you can create config file:

```bash
MF_EXPORT_PORT=8178 \
MF_EXPORT_LOG_LEVEL=debug \
MF_EXPORT_MQTT_HOST=tcp://localhost:1883 \
MF_EXPORT_MQTT_USERNAME=<thing_id> \
MF_EXPORT_MQTT_PASSWORD=<thing_secret> \
MF_EXPORT_MQTT_CHANNEL=<channel_id> \
MF_EXPORT_MQTT_SKIP_TLS=true \
MF_EXPORT_MQTT_MTLS=false \
MF_EXPORT_MQTT_CA=ca.crt \
MF_EXPORT_MQTT_CLIENT_CERT=thing.crt \
MF_EXPORT_MQTT_CLIENT_PK=thing.key \
MF_EXPORT_CONFIG_FILE=export.toml \
MG_EXPORT_PORT=8178 \
MG_EXPORT_LOG_LEVEL=debug \
MG_EXPORT_MQTT_HOST=tcp://localhost:1883 \
MG_EXPORT_MQTT_USERNAME=<thing_id> \
MG_EXPORT_MQTT_PASSWORD=<thing_secret> \
MG_EXPORT_MQTT_CHANNEL=<channel_id> \
MG_EXPORT_MQTT_SKIP_TLS=true \
MG_EXPORT_MQTT_MTLS=false \
MG_EXPORT_MQTT_CA=ca.crt \
MG_EXPORT_MQTT_CLIENT_CERT=thing.crt \
MG_EXPORT_MQTT_CLIENT_PK=thing.key \
MG_EXPORT_CONFIG_FILE=export.toml \
../build/magistrala-export&
```

Expand All @@ -315,7 +315,7 @@ Additionally, you will need MQTT client certificates if you enable mTLS. To obta

#### MTLS

To setup `MTLS` connection `Export` service requires client certificate and `mtls` in config or `MF_EXPORT_MQTT_MTLS` must be set to `true`. Client certificate can be provided in a file, `client_cert_path` and `client_cert_key_path` are used for specifying path to certificate files. If MTLS is used and no certificate file paths are specified then `Export` will look in `client_cert` and `client_cert_key` of config file expecting certificate content stored as string.
To setup `MTLS` connection `Export` service requires client certificate and `mtls` in config or `MG_EXPORT_MQTT_MTLS` must be set to `true`. Client certificate can be provided in a file, `client_cert_path` and `client_cert_key_path` are used for specifying path to certificate files. If MTLS is used and no certificate file paths are specified then `Export` will look in `client_cert` and `client_cert_key` of config file expecting certificate content stored as string.

#### Routes

Expand Down Expand Up @@ -476,9 +476,9 @@ Start the [NATS][nats] and [Agent][agent] service:

```bash
gnatsd
MF_AGENT_BOOTSTRAP_ID=54:FG:66:DC:43 \
MF_AGENT_BOOTSTRAP_KEY="223334fw2" \
MF_AGENT_BOOTSTRAP_URL=http://localhost:9013/things/bootstrap \
MG_AGENT_BOOTSTRAP_ID=54:FG:66:DC:43 \
MG_AGENT_BOOTSTRAP_KEY="223334fw2" \
MG_AGENT_BOOTSTRAP_URL=http://localhost:9013/things/bootstrap \
build/magistrala-agent
{"level":"info","message":"Requesting config for 54:FG:66:DC:43 from http://localhost:9013/things/bootstrap","ts":"2020-05-07T15:50:58.041145096Z"}
{"level":"info","message":"Getting config for 54:FG:66:DC:43 from http://localhost:9013/things/bootstrap succeeded","ts":"2020-05-07T15:50:58.120779415Z"}
Expand Down
Loading

0 comments on commit 18edfac

Please sign in to comment.