This topic describes how to set up the Docker runtime environment for Link IoT Edge Pro Edition in Ubuntu 16.04. After the runtime environment is set up, you can connect gateways to the cloud.
For more information about Link IoT Edge Pro Edition, see Specifications.
Prerequisites
The Docker runtime environment is installed. For information about how to install the Docker client that uses Ubuntu 16.04, see the Docker documentation. The Docker version must be later than V17.03.
Create an edge instance and a gateway
- Log on to the Link IoT Edge console.
- In the left-side navigation pane, click Edge Instances.
- Create an edge instance.
- Click Create Instance. In the Create Instance dialog box, enter an instance name.Note The instance name must be 1 to 20 characters in length, and can contain letters, digits, underscores (_), and hyphens (-).
- In the Gateway Products section, click Create Gateway Product to create a gateway for the instance.Gateways in Link IoT Edge provide edge computing capabilities. Each instance must be associated with a gateway device. A gateway device can be associated with only one edge instance at a time.
- In the Create Product dialog box, set the required parameters and click OK.Create Gateway Product in Link IoT Edge inherits the features ofin the IoT Platform console. The procedure to create a product is simplified. You can create gateway products that are applicable to Link IoT Edge in a quick manner.
Table 1. Parameters Parameter Description Product Name The name of the gateway product. You can search or identify gateway products by name. The name must be 4 to 30 characters in length, and can contain letters, digits, and underscores (_). Product Description Enter a description for the product. The description must be 1 to 100 characters in length. This parameter is optional. After the product is created, you are redirected to the Create Instance dialog box. The created gateway product appears in the drop-down list of the Gateway Products section.
- In the Create Instance dialog box, click Add Gateway Device in the Gateway Devices section.Create Gateway Device in Link IoT Edge inherits the features ofin the IoT Platform console.
- Set the required parameters as prompted and click OK.
Table 2. Parameters Parameter Description Product The gateway product to which the device that you want to create belongs. The system automatically specifies the new gateway for this parameter. Device Name The name of the gateway device. Each device name must be unique in the product. If you do not specify this parameter, the system generates a random device name. Note The device name must be 4 to 32 characters in length, and can contain letters, digits, hyphens (-), underscores (_), at signs (@), periods (.), and colons (:). - Select the required specifications for the Link IoT Edge product based on the environment that you build. For more information, see Specifications.
- Optional. In the Tag Information section, click Add Tag to add tags to the instance. Tags provide an efficient method to identify and group instances. This parameter is optional.To set an instance tag, you must enter a tag key and tag value.
Table 3. Parameters Parameter Description Tag Key You must specify a tag key for each tag. The tag key must be 1 to 20 characters in length, and can contain letters. The key of each tag is unique for an instance. Tag Value You must specify a tag value for each tag. The tag value must be 1 to 20 characters in length, and can contain letters, digits, underscores (_), and hyphens (-).
- Click Create Instance. In the Create Instance dialog box, enter an instance name.
- After you configure the required parameters, click OK.
Install and start Link IoT Edge
After you create an edge instance and a gateway, you must install and start Link IoT Edge on the gateway.
- On the Edge Instances page, click Install Software in the Actions column of the required edge instance.
Set the parameters for the installation command based on the environment, and click Installation Command.
Table 1. Parameters Parameter
Description
Edge Gateway CPU Architecture
The CPU architecture of your device. In this example, select x86-64.
Instance Type
The Link IoT Edge edition that is specified when you create the edge instance. The parameter value cannot be changed.
Edge Version
The version of Link IoT Edge.
Operating System
The operating system of your device. In this example, select Linux.
Copy the installation command for subsequent use.
Log on to your Ubuntu 16.04 machine.
In a directory of the runtime environment, run the command that you copied in Step 3.
You can run the command to download, configure, and start Link IoT Edge. After the command is executed, the link-iot-edge.sh script is downloaded and saved in the current directory.
If you start Link IoT Edge for the first time, you must check the following items. After you complete the check, click Enter to use the default configurations.
Check the version of Link IoT Edge.
Confirm the runtime of Function Compute. By default, functions run in independent processes.
Check whether the stream processing feature has been enabled. By default, the stream processing feature is enabled.
Check whether the previous version has been uninstalled. By default, the previous version is uninstalled.
You may need to wait for 5 to 10 minutes to pull and start the Docker image. You can run the docker ps command to check whether the Docker container has been started. If the following information is displayed in the command output, the Docker container is started.
If you start Link IoT Edge not for the first time, you can run the link-iot-edge.sh script that has been downloaded to manage Link IoT Edge. For example, you can restart or stop Link IoT Edge. You can also retrieve the status of Link IoT Edge, or change the configuration parameters of Link IoT Edge. The following figure shows the command details.
Log on to the Link IoT Edge console. In the left-side navigation pane, click Edge Instances. On the page that appears, find the edge instance that you created and click View in the Actions column. On the Gateways tab of the Instance Details page, check the gateway status.
You can perform remote gateway management by turning on Remote Access. For more information about the procedure, see Remote service access.
- Optional. On the Instance Details page, check the CPU utilization, memory usage, and storage usage, and authorize instance processes to access CloudMonitor.
- Add a role or attach an existing role. Make sure that the role has the required permissions to manage CloudMonitor. For more information, see Access resources of other Alibaba Cloud services.
- Click the Monitoring tab and turn on the CloudMonitor Status switch, as shown in the following figure.
After the CloudMonitor Status switch is turned on, you can view the monitoring information of the gateway on the Monitoring page.
- Optional. Authorize other Alibaba Cloud users to perform the required operations on the instance.On the Edge Instances page, click Authorize in the upper-left corner of the page. In the dialog box that appears, click Add Authorization. In the dialog box that appears, set the required parameters as prompted.
Table 6. Parameters Parameter Description Authorized User UID The Alibaba Cloud account ID of the user that you want to authorize. Authorized Instance The edge instance on which you want to authorize the Alibaba Cloud account to perform remote O&M.
Additional operations on Link IoT Edge
- Reconfigure Link IoT Edge.
Run the following command to modify the configurations of Link IoT Edge of a specific version:
./link-iot-edge.sh --reconfig {Version}
Replace {Version} with the version of Link IoT Edge that you want to modify the configurations. For example, if the version is V1.8.2, run the
./link-iot-edge.sh --reconfig V1.8.2
command. - Stop Link IoT Edge.
Run the following command to stop all containers running Link IoT Edge. However, the containers are not deleted.
./link-iot-edge.sh --stop
- Restart Link IoT Edge.
If a container is available but is not running, run the following command to restart Link IoT Edge:
./link-iot-edge.sh --restart {Version}
Replace {Version} with the version of Link IoT Edge that you want to restart. For example, if the version is V1.8.2, run the
./link-iot-edge.sh --restart V1.8.2
command. - Clean Link IoT Edge.
Run the following command to clean containers running Link IoT Edge and delete all installed images, volumes, and startup configuration files.
./link-iot-edge.sh --clean
- Extract Link IoT Edge logs.
Run the following command to package all Link IoT Edge logs and copy the package to the current directory:
./link-iot-edge.sh --packagelog
What to do next
After the environment is built, you can connect your devices to Link IoT Edge. For more information, see Device access. You can also allocate additional resources to edge instances to manage your devices. These resources include Function Compute resources and message routes.
After you connect a device to Link IoT Edge or allocate additional resources to an edge instance, perform the following steps to deploy the edge instance:
- In the upper-right corner of the Instance Details page, click Deploy. In the message that appears, click OK to deploy the edge instance.
- If the status of the edge instance is Deployed, it indicates that the edge instance has been deployed. You can click View Logs to view deployment details. You can also click View Deployment Logs in the upper-right corner of the Instance Details page to view the deployment history.