Skip to content

Commit

Permalink
Add Instructions to Run Azure IoT Edge Daemon Locally (#6104)
Browse files Browse the repository at this point in the history
The PR adds Instructions on how to run edge daemon locally. The goal is to provide these instructions as part of compatibility check tool in case the target OS is missing systemd support

I tested this on an ubuntu 20.04 VM without systemd support


## Azure IoT Edge PR checklist:
  • Loading branch information
nimanch authored Feb 9, 2022
1 parent c8f4079 commit bd43e5d
Showing 1 changed file with 49 additions and 21 deletions.
70 changes: 49 additions & 21 deletions edgelet/doc/devguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,33 +161,61 @@ This will create `aziot-edged` and `iotedge` binaries under `edgelet/target/debu

### Run

To run `aziot-edged` locally:

1. Create a directory that it will use as its home directory, such as `~/iotedge`

- Linux / macOS

```sh
export AZIOT_EDGED_CONFIG_DIR=~/iotedge
mkdir -p "$AZIOT_EDGED_CONFIG_DIR"
```

- Windows
In order to locally run aziot-edged, there is a dependency on running Azure IoT Identity Service.The following instruction can be used to run aziot-edged locally:
1. Clone the [identity service repo](https://github.com/Azure/iot-identity-service)
2. Build Binaries using [these build steps](https://github.com/Azure/iot-identity-service/blob/main/docs-dev/building.md)
3. Make directories and chown them to your user
```sh
mkdir -p /run/aziot /var/lib/aziot/{keyd,certd,identityd,edged} /var/lib/iotedge /etc/aziot/{keyd,certd,identityd,tpmd,edged}/config.d
chown -hR $USER /run/aziot /var/lib/aziot/ /var/lib/iotedge /etc/aziot/
```
4. Copy Provisioning File and Fill out the provisioning parameters. Example : For Provisioning via Symmetric Keys Use [these instructions](https://docs.microsoft.com/en-us/azure/iot-edge/how-to-provision-single-device-linux-symmetric?view=iotedge-2020-11&tabs=azure-portal%2Cubuntu)

```powershell
$env:AZIOT_EDGED_CONFIG_DIR = Resolve-Path ~/iotedge
New-Item -Type Directory -Force $env:AZIOT_EDGED_CONFIG_DIR
```
```sh
cd <iot-edge-path>/edgelet
cp contrib/config/linux/template.toml /etc/aziot/config.toml
```
5. Modify the Daemon configuration section in /etc/aziot/config.toml to match this
```toml
[connect]
workload_uri = "unix:///var/run/iotedge/workload.sock"
management_uri = "unix:///var/run/iotedge/management.sock"
1. Create a `config.toml`. It's okay to create this under the `AZIOT_EDGED_CONFIG_DIR` directory.
1. Run the daemon with the `AZIOT_EDGED_CONFIG_DIR` environment variable set and with the path to the `config.toml`
[listen]
workload_uri = "unix:///var/run/iotedge/workload.sock"
management_uri = "unix:///var/run/iotedge/management.sock"
min_tls_version = "tls1.0"
```
This is because when running locally or without systemd, LISTEN_FDNAMES environment variable is not passed to aziot-edged and hence we explicitly need to specify the listen sockets.

6. Apply Config.
```sh
cargo run -p aziot-edged -- -c /absolute/path/to/config.toml
cd <iot-edge-path>/edgelet
cargo run -p iotedge -- config apply
```
7. Run keyd service in a separate shell
```sh
cd <iot-identity-service-path>
cargo run --target x86_64-unknown-linux-gnu -p aziotd -- aziot-keyd
```
8. Run Identityd service in a separate shell
```sh
cd <iot-identity-service-path>
cargo run --target x86_64-unknown-linux-gnu -p aziotd -- aziot-identityd
```
9. Run Certd Service in a separate shell
```sh
cd <iot-identity-service-path>
cargo run --target x86_64-unknown-linux-gnu -p aziotd -- aziot-certd
```
10. Finally, Run aziot-edged in a separate shell
```sh
cd <iot-edge-path>/edgelet
cargo run -p aziot-edged
```
11. When stopping the service, stop aziot-edged, identityd, keyd and certd, in that order.
### Run tests

```sh
Expand Down

0 comments on commit bd43e5d

Please sign in to comment.