Create a process application
IoT Edge lets you develop function code locally and host it in the cloud using the process application feature. This topic describes how to create a process application.
Prerequisites
You have purchased, installed, and activated an all-in-one edge device. For more information, see Install and activate an all-in-one edge device.
You have developed the function code locally. For more information about code development, see the Function Compute documentation.
Procedure
Log on to the IoT Edge console.
From the drop-down list in the navigation pane on the left, select your instance.
In the navigation pane on the left, choose Node Management > Application Management.
On the Application Management page, click the Process Application tab, and then click Add Application.
Set the application parameters as described in the following tables and then click Confirm.
Application information
Parameter
Description
Application Name
Set the name for your process application. It can contain uppercase letters, lowercase letters, digits, and underscores (_). The name can be up to 128 characters long.
Application Type
The type of process application to create. Currently, only locally developed applications with code packages uploaded to the IoT Edge console are supported.
Development Language
The development language of your local application. Currently, Node.js, Python, and C are supported.
Application Version
Set the version for the application. The version number must be unique for this application. An application cannot have two identical version numbers.
Code Package
Click Upload File to upload the code package of your locally developed application.
ImportantOnly code packages in
.zipformat can be uploaded.Version Description
Describe the application version, such as its features. This can be left empty.
Environment Variable
Custom environment variables that can be read directly by the function code at runtime. Click Add Environment Variable and set the variable name and value to add an environment variable. You can configure up to 10 environment variables.
This feature separates code from configuration to improve code portability. For example, a function might need to request services from other hosts on the network. The server IP address and port often differ across environments. By passing the IP and port information as configuration parameters through environment variables, gateways in different environments can use the same function code.
Container configuration
Parameter
Description
Use host mode
Select whether to use the host network directly:
Yes: Uses the host network environment directly without isolating the container's network.
No: Isolates the container's network. You must configure port mapping.
Port Mapping
This parameter appears when Use host mode is set to No. The function's network environment is completely isolated from the host's environment. Port mapping maps the listening port of the function inside the container to a port on the host. This allows client programs on other hosts to access the service provided by the function.
You can map up to 10 network ports.
For example, an
fc-http-serverfunction running in a container on the host provides services through port 80. Client programs on other hosts cannot access thefc-http-serverfunction by accessing port 80 on the host. You must map the container port of thefc-http-serverfunction to a port on the host. For example, map port 80 in the container to port 8080 on the host. This allows client programs on other hosts to access thefc-http-serverfunction inside the container by accessing${your_host_ip_address}:8080.Enable privileged mode
The root user inside a container is actually just a regular user on the host. To perform operations that require root permissions inside the container, such as changing the system time or using the mount command, you must grant the container privileged access by enabling privileged mode.
NoteIn privileged mode, the container has root permissions on the host, and all host devices are mapped to the container by default. You do not need to configure device mapping.
Device Mapping
This parameter appears when Enable privileged mode is set to No. The device management system is completely isolated from the host's environment. When a function needs to access a host device, such as a serial port, you must map the device to the container where the function runs. You can add up to 10 device mappings.
Volume Mapping
The file system is completely isolated from the host's environment. When a function needs to access a file on the host, you must map the file to the container where the function runs. You can add up to 10 volume mappings.
Memory Limit
Set the upper memory limit for the container.
If the container's memory usage exceeds this limit, the container restarts.
If the memory limit is too low, the application in the container might fail to run.
The default memory is 1024 MB. Increase the memory limit based on the size of the application in the container.
(Optional) After you create the process application, you can view it in the list on the Process Application tab of the Node Management > Application Management page.
You can also use the buttons in the Operations column to perform additional management tasks.
Version Management
Click Version Management to add, edit, or delete versions of the application.
NoteFor a description of the parameters for adding a new version or editing the current version, see step 4 in this topic.
Delete
Click Delete to delete the application.
NoteBefore you can delete an application, you must delete all of its versions.
What to do next
Assign the process application to the all-in-one edge device