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

update deploy IoT Edge device doc #383

Merged
merged 7 commits into from
Aug 16, 2024
Merged
Changes from 5 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
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ You need to prepare a Linux virtual machine or physical device for IoT Edge. In

# SSH into the machine
ssh hbai@<public IP of your VM>
linyguo marked this conversation as resolved.
Show resolved Hide resolved

# if the VM requires a private key:
ssh -i ~/.ssh/id_rsa.pem <YOUR_USER_NAME>@<public IP of your VM>

# update repo and signing key
wget https://packages.microsoft.com/config/ubuntu/18.04/multiarch/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
Expand All @@ -73,20 +76,84 @@ You need to prepare a Linux virtual machine or physical device for IoT Edge. In
sudo iotedge config mp --connection-string '<REPLACE_WITH_DEVICE_CONNECTION_STRING>'
```

**Note**
If you encounter below package dependency error during installing `aziot-edge`:
```
The following packages have unmet dependencies:
aziot-identity-service : Depends: libssl1.1 (>= 1.1.1) but it is not installable
```

This is because Ubuntu 22.04 uses `libssl3` and `libssl1.1` is deprecated on it. To address the issue, check the latest versions for Edge and IoT Identity Service and install them from the release page.

```shell
# check the latest aziot-edge version
wget -qO- https://raw.githubusercontent.com/Azure/azure-iotedge/main/product-versions.json | jq -r '
.channels[]
| select(.name == "stable").products[]
| select(.id == "aziot-edge").components[]
| select(.name == "aziot-edge").version
'
# check the latest aziot-identity-service version
wget -qO- https://raw.githubusercontent.com/Azure/azure-iotedge/main/product-versions.json | jq -r '
.channels[]
| select(.name == "stable").products[]
| select(.id == "aziot-edge").components[]
| select(.name == "aziot-identity-service").version
'

# download and install
wget https://github.com/Azure/azure-iotedge/releases/download/<AZIOT_EDGE_VERSION>/aziot-identity-service_<AZIOT_IDENTITY_SERVICE_VERSION>-1_ubuntu22.04_amd64.deb -O aziot-identity-service.deb
linyguo marked this conversation as resolved.
Show resolved Hide resolved
sudo dpkg -i aziot-identity-service.deb

wget https://github.com/Azure/azure-iotedge/releases/download/<AZIOT_EDGE_VERSION>/aziot-edge_<AZIOT_EDGE_VERSION>-1_ubuntu22.04_amd64.deb -O aziot-edge.deb
sudo dpkg -i aziot-edge.deb
```

### 3. Deploy modules on your IoT Edge device

To deploy your IoT Edge modules, go to your IoT hub in the Azure portal, then:

1. Select Devices from the IoT Hub menu.

2. Select your device to open its page.

3. Select the Set Modules tab.

4. Select Review + create at the bottom.

5. Select Create to deploy the modules.

When the module setup completes, you should see two modules in the list: `$edgeAgent` and `$edgeHub`.
For more information, please refer to [Create and provision an IoT Edge device on Linux using symmetric keys](https://learn.microsoft.com/en-us/azure/iot-edge/how-to-provision-single-device-linux-symmetric?view=iotedge-1.5&tabs=azure-cli%2Cubuntu).

## OPTION 1: Use Maestro

To use this option, first install Maestro and the Symphony API. For more information, see [Use Symphony with the Maestro CLI tool](./quick_start_maestro.md).

Once you have maestro installed, you can launch this sample with the following command:

```bash
maestro samples run hello-iot-edge --set iot-hub-key=<REPLACE_WITH_HUB_KEY> --set iot-hub-name=<REPLACE_WITH_HUB_NAME> --set device-name=s8c-vm
maestro samples run hello-iot-edge --set iot-hub-key=<REPLACE_WITH_HUB_KEY> --set iot-hub-name=<REPLACE_WITH_HOST_NAME> --set device-name=s8c-vm
Haishi2016 marked this conversation as resolved.
Show resolved Hide resolved
```

You can get your IoT hub key from the connection string:
You can get your IoT host name, hub key and key name from the connection string:

```bash
az iot hub connection-string show --hub-name <REPLACE_WITH_HUB_NAME>
# sample output:
# {
# "connectionString": "HostName=<HOST_NAME>;SharedAccessKeyName=<HUB_KEY_NAME>;SharedAccessKey=<HUB_KEY>"
# }
```

Make sure to set the `iot-hub-name` to the complete host name. Otherwise, the iot-edge API may not acuqire the module information correctly.

If the sample runs successfully, you should see two instances running:
```bash
$ kubectl get instances
NAME STATUS TARGETS DEPLOYED
sample-iot-edge-instance-1 Succeeded 1 1
sample-iot-edge-instance-2 Succeeded 1 1
```

To clean up, use:
Expand Down Expand Up @@ -128,7 +195,7 @@ spec:
deviceName: "s8c-vm"
```

You can get your IoT hub's key and key name from the connection string:
You can get your IoT hub's host name, hub key and key name from the connection string:

```bash
az iot hub connection-string show --hub-name <REPLACE_WITH_HUB_NAME>
Expand Down
Loading