Huawei Cloud Yaoyun Server L instance evaluation | Use Portainer to quickly deploy the IoT low-code platform Node-RED

Application scenarios

Node-RED is an open source IoT platform that is a process-based programming tool primarily used to create processes for Internet of Things (IoT) devices. It uses a visual programming approach that allows developers to connect predefined blocks of code (called "Nodes") to perform tasks. Connected nodes are usually a combination of input nodes, processing nodes, and output nodes. When they are connected together, they form a "flow" (Flows). This article will introduce how to quickly deploy Node based on Portainer of Huawei Cloud Yaoyun Service L instance. -RED platform.

Resource and cost planning

This practice uses the Portainer image.
This practice uses the following resource planning as an example. You can adjust it according to actual needs.

resource Configuration illustrate
Yunyao cloud server L instance - CPU: 2 cores - Memory: 2GB - System disk: 40GiB The minimum configuration for running the Portainer application image is 2 cores of 2GB and a system disk of 40GiB. It is recommended to choose the Yunyao Cloud Server L instance based on your needs.
mirror Portainer Select the Portainer application image.
security group Inbound rules: - Protocol: TCP - Ports: 80, 443, 1880 - Source address: 0.0.0.0/0 - 80: Allow access to the website using the HTTP protocol. - 443: Allow access to the website using HTTPS protocol. - 1880: Allow access to nodered service
domain name domaintest.com - If you are only using it for personal development or testing, you do not need to add a domain name. - If your application is open to the outside world, please add and resolve the domain name for the cloud server.

Operating procedures

Purchase and configure Yunyao Cloud Server L instance

  1. Log in to the Yunyao Cloud Server L instance console .
  2. Click "Purchase Resources" and select "Purchase Yunyao Cloud Server L Instance" or "Purchase Yunyao Service Portfolio" in the drop-down list.image.png
  3. Configure resources for the cloud server. This example takes the selection of "Purchase Yunyao Cloud Server L Instance" as an example.image.png
parameter illustrate
area The intranets of Yunyao Cloud Server L instances in different regions are not connected to each other. Please choose an area close to your business to reduce network latency and improve access speed.
scene mirroring Select the Portainer application image.
Package specifications Select package specifications. The minimum configuration is 2 cores 2GB and system disk 40GiB.
Instance name Please customize the instance name to facilitate your identification, such as Portainer-Example.
Additional services (optional) This is only supported when "Purchase Yunyao Cloud Server L Instance" is selected. Choose additional services such as data disk, host security, and cloud backup as needed.
Purchase duration The minimum time limit for a single purchase is 1 month and the maximum time limit is 3 years.
Purchase quantity Set the number of Yunyao Cloud Server L instances you purchased.
  1. Click "Buy Now" to enter the order details page. According to the interface prompts, please confirm the configuration information, read and check the agreement.
  2. Click "Go to Pay" and complete the payment according to the prompts on the page.
  3. Click "Return to Huawei Cloud Yunyao Cloud Service Solution Console" to view the created Yunyao Cloud Server L instance.image.png
Set the password for Yunyao Cloud Server L instance
  1. Click the Yunyao Cloud Server L instance card.
  2. In "Image Information" on the "Overview" page, click "Manage" to log in to the management interface and check whether the application image starts normally.
  3. Insert image description here

**Note:** During the startup of the application image, resetting the password, restarting or powering off the Yunyao Cloud Server L instance will result in abnormal login of the application image management interface. image.pngIf the management interface displays a normal boot or login interface, it means that the application image has been started normally. Otherwise, please wait patiently for 1~2 minutes and try again later.
4. Please refer to Set/Reset Password to set the password for the administrator root of Yunyao Cloud Server L instance.

Log in to Yunyao Cloud Server L instance

Please refer to Remote Login to Linux Cloud Server (VNC Method) to log in to Yunyao Cloud Server L instance.
Because the security level of Nginx is too high, some mirroring functions may be unavailable. You can log in to the cloud server and execute the following command to solve the problem:
wget -N https://websoft9.github.io/stackhub/scripts/nginx_huaweicloud.sh && bash nginx_huaweicloud.sh

Configure security group

Configure the inbound access rules of the security group to ensure normal access to the application image.

  1. Click the Yunyao Cloud Server L instance card to enter the resource page.
  2. Click "Yunyao Cloud Server L Instance" in the list on the left, click the cloud server name, and enter the cloud server details page.
  3. Select the "Security Group" tab, click "Add Rule", and add the following rules. This example only adds basic rules, you can add more rules as needed.
priority Strategy type protocol port source address describe
100 allow IPv4 TCP:1880 0.0.0.0/0 Allow access to the node-red service.
100 allow IPv4 TCP:443 0.0.0.0/0 Allows access to the application management interface using the HTTPS protocol.
100 allow IPv4 TCP:80 0.0.0.0/0 Allows access to the HTTP protocol to access the application management interface.
  1. **Figure 1 **Configuration results For convenience, I have opened all ports here. Please do not configure this in a production environment. Not very safe.
    image.png
Add and resolve domain names (optional)

This article describes how to add and resolve a domain name to the server so that users can use the domain name to access the website. If you are only using it for personal development or testing, you do not need to add a domain name.

  1. Click "Yunyao Cloud Server L Instance" in the list on the left, click the cloud server name, and enter the cloud server details page.
  2. Select the "Domain Name" tab and click "Add Domain Name". Enter the domain name, for example domaintest.com. Please make sure that the domain name here has been registered. If you do not have a domain name yet, please click "Buy Now" to register (pay). Please refer to the process guide for specific operations .image.png
  3. Click OK.
  4. Click "Resolve domain name" in the domain test.com domain name operation list. The prefix and domain name form a subdomain name. Supports resolving domain names or subdomain names to the current public IP. If the domain name prefix is ​​empty, it means that the domain name domaintest.com will be resolved to the current server public IP.
  5. Check the resolved domain name on the "Domain name" tab.
  6. Register domain name. To successfully access the server through a domain name, the domain name must be registered. Please register this domain name (free) at the Huawei Cloud Registration Center . For specific operations, see Quickly Complete Website Registration .

Initialize Portainer

  1. In "Image Information" on the server's "Overview" page, click "Manage" to log in to the management interface. image.pngInitializing Portainer has a certain timeliness. If the user cannot be created quickly, the following prompt will appear. Please log in to the cloud server and execute the command sudo docker restart portainer to restart Portainer, and then quickly create a user.image.png
  2. Set the Portainer administrator username and password and click "Create user". If you have backed up data, in the "Restore Portainer from backup" configuration item, you can upload the backup data locally to quickly set up a Portainer environment.image.png
  3. Select the "Home" menu and click the Local project to start using Portainer for Docker visual management.image.png

At this point, you have obtained a complete Portainer application cloud server L instance. You can start using Portainer, let's continue to deploy the Node-RED platform on this platform

Deploy Node-RED containers using Portainer

Below we take the deployment of Node-RED containers as an example to introduce how to use Portainer for Docker visual management. For more detailed operation instructions, please refer to the official website for guidance .

Create Node-RED container
  1. Select the "Contaners" menu and click "Add container" to add a Node-RED container.image.png

  2. Configure the Node-RED container parameters as shown.

    • ①Name: Customized container name
    • ②Image: Container image name, for example, if nodered/node-red is set, the system will automatically pull the latest image of node-red in DockerHub.
    • ③Click "publish a new network port" and add port 1880 to ensure that the Node-RED service can be accessed normally.
    • ④Restart policy: It is recommended to select "Always" so that the container will always restart automatically no matter what circumstances it stops.
  3. image.png

  4. Click "Deploy the container" to create the Node-RED container.

Access the node-red service

After the container is deployed successfully, you can access the node-red service by accessing http://{ip}:1880image.png

installed node

Install the most commonly used dashboard node in node-red

image.png

Search dashboard and click install

image.png
test demo

The following is the content of the json stream to be imported

[
  {
    
    
    "id": "24c1f56bc8eb1d36",
    "type": "tab",
    "label": "双silder 图表",
    "disabled": false,
    "info": "",
    "env": []
  },
  {
    
    
    "id": "64c475338976983e",
    "type": "ui_slider",
    "z": "24c1f56bc8eb1d36",
    "name": "",
    "label": "水量",
    "tooltip": "水量",
    "group": "776a423d272e1463",
    "order": 0,
    "width": "6",
    "height": "2",
    "passthru": true,
    "outs": "all",
    "topic": "topic",
    "topicType": "msg",
    "min": 0,
    "max": "100",
    "step": 1,
    "className": "",
    "x": 170,
    "y": 260,
    "wires": [
      [
        "c27918d2809fc841"
      ]
    ]
  },
  {
    
    
    "id": "1353dafc1a7b4a59",
    "type": "ui_slider",
    "z": "24c1f56bc8eb1d36",
    "name": "",
    "label": "电量",
    "tooltip": "电量",
    "group": "776a423d272e1463",
    "order": 1,
    "width": "6",
    "height": "2",
    "passthru": true,
    "outs": "all",
    "topic": "topic",
    "topicType": "msg",
    "min": 0,
    "max": "100",
    "step": 1,
    "className": "",
    "x": 170,
    "y": 340,
    "wires": [
      [
        "5b51d2ea7045bff6"
      ]
    ]
  },
  {
    
    
    "id": "4327197853397112",
    "type": "ui_chart",
    "z": "24c1f56bc8eb1d36",
    "name": "",
    "group": "776a423d272e1463",
    "order": 2,
    "width": "12",
    "height": "4",
    "label": "chart",
    "chartType": "line",
    "legend": "true",
    "xformat": "HH:mm:ss",
    "interpolate": "linear",
    "nodata": "",
    "dot": false,
    "ymin": "0",
    "ymax": "100",
    "removeOlder": 1,
    "removeOlderPoints": "",
    "removeOlderUnit": "3600",
    "cutout": 0,
    "useOneColor": false,
    "useUTC": false,
    "colors": [
      "#1f77b4",
      "#f95a15",
      "#ff7f0e",
      "#2ca02c",
      "#98df8a",
      "#d62728",
      "#ff9896",
      "#9467bd",
      "#c5b0d5"
    ],
    "outputs": 1,
    "useDifferentColor": false,
    "className": "",
    "x": 630,
    "y": 300,
    "wires": [
      []
    ]
  },
  {
    
    
    "id": "c27918d2809fc841",
    "type": "function",
    "z": "24c1f56bc8eb1d36",
    "name": "topic水量",
    "func": "msg.topic = '水量'\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 380,
    "y": 260,
    "wires": [
      [
        "4327197853397112"
      ]
    ]
  },
  {
    
    
    "id": "5b51d2ea7045bff6",
    "type": "function",
    "z": "24c1f56bc8eb1d36",
    "name": "topic电量",
    "func": "msg.topic = '电量'\nreturn msg;",
    "outputs": 1,
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 380,
    "y": 340,
    "wires": [
    [
    "4327197853397112"
    ]
    ]
  },
    {
    
    
    "id": "30621a3a429251a3",
    "type": "inject",
    "z": "24c1f56bc8eb1d36",
    "name": "清空图表",
    "props": [
    {
    
    
    "p": "payload"
  },
    {
    
    
    "p": "topic",
    "vt": "str"
  }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": 0.1,
    "topic": "",
    "payload": "[]",
    "payloadType": "json",
    "x": 340,
    "y": 460,
    "wires": [
    [
    "4327197853397112"
    ]
    ]
  },
    {
    
    
    "id": "776a423d272e1463",
    "type": "ui_group",
    "name": "Default",
    "tab": "f00e468d8d4c1d19",
    "order": 1,
    "disp": true,
    "width": "12",
    "collapse": false,
    "className": ""
  },
    {
    
    
    "id": "f00e468d8d4c1d19",
    "type": "ui_tab",
    "name": "Home",
    "icon": "dashboard",
    "disabled": false,
    "hidden": false
  }
    ]

image.png
Copy the json content to be imported to the editing area, click Import, and then click Deploy.
image.png
After clicking the red deployment in the upper right corner, access ip+1880/ui to access the panel.
image.png

Guess you like

Origin blog.csdn.net/github_35631540/article/details/132671297