Updated on 2025-08-26 GMT+08:00

Using Node.js to Run Node.js Programs

Scenarios

Node.js is an open-source project management software. It provides functions such as project management, Wiki, and news, and integrates tools such as GIT, SVN, and CVS. The Node.js application image uses Ubuntu 22.04 and is deployed using Docker. The Node.js application and the required operating environment have been preconfigured in the Node.js application image. This section describes how to use a Node.js application image to run a Node.js application.

Resource Planning and Costs

Resource

Configuration

Description

Cloud server

  • vCPUs: 2
  • Memory: 2 GiB

Select appropriate instance specifications based on your service requirements.

Image

Node.js

Select the Node.js application image.

Security group

Inbound rule:

  • Protocol/Application: TCP
  • Port: 80, 443, 9000, or 9001
  • Source: 0.0.0.0/0
  • 80: Allows traffic forwarding within an application.
  • 443: Allows HTTPS traffic to FlexusL instances.
  • 9001: Allows external access to the application dashboard.
  • 9000: Allows external access to the application O&M page.

Procedure

Step

Description

Step 1: Purchase FlexusL Instances

Purchase a FlexusL instance and select the Node.js application image.

Step 2: Configure Security Groups

Add inbound security group rules to allow traffic from ports 80, 443, 9000, and 9001 to access the application.

Step 3: Run the Node.js Program

Use the Node.js application image to run a Node.js application.

Step 1: Purchase FlexusL Instances

  1. Log in to the FlexusL console and click Buy FlexusL.
  2. Specify required parameters for the FlexusL instance.

    Parameter

    Example Value

    Description

    Region

    CN-Hong Kong

    For low network latency and quick resource access, select the region nearest to your target users. After a FlexusL instance is created, the region cannot be changed. Exercise caution when selecting a region.

    Application Image

    Node.js

    Select the Node.js application image.

    Instance Specifications

    2 vCPUs | 2 GiB of memory and 60 GiB system disk

    Select instance specifications as needed.

    Instance Name

    Node-Example

    Customize an instance name that is easy to identify, for example, Node-Example.

    (Optional) Associated Services

    • Data Disk: 10 GiB
    • Host Security
    • Cloud Backup Vault: 70 GB

    You can bundle any of EVS, HSS (basic edition), and CBR to your FlexusL instances as needed and set specifications as needed.

    Required Duration

    1 month

    The minimum duration of a purchase is one month and the maximum duration is three years.

    Auto-renew is enabled by default, which means the purchased FlexusL instances will be automatically renewed before they expire. If you do not enable auto-renew during the purchase process, you can still enable it later after the instances are created. For more information about auto-renewal rules, see Auto-Renewal Rules.

    Quantity

    1

    Set the number of FlexusL instances to be purchased.

  3. Click Buy Now and complete the payment as prompted.
  4. Go back to the FlexusL console and view the purchased FlexusL instance.

Step 2: Configure Security Groups

Add inbound security group rules to allow traffic from ports 80, 443, 9000, and 9001 to access the application.

  1. Log in to the FlexusL console and click a resource card to go to the instance details page.
  2. In the navigation pane on the left, choose Cloud Servers and click the target server name to view its details.

  3. On the Security Groups tab, click Add Rule. In the displayed dialog box, add rules displayed in the following figure and click OK.

    The following figure only displays common rules. You can add more rules as needed.

    Table 1 Security group rules

    Priority

    Action

    Type

    Protocol & Port

    Source

    Description

    1

    Allow

    IPv4

    TCP: 80

    0.0.0.0/0

    Specifies the internal forwarding port of an application.

    1

    Allow

    IPv4

    TCP: 443

    0.0.0.0/0

    Allows HTTPS traffic to FlexusL instances.

    1

    Allow

    IPv4

    TCP: 9000

    0.0.0.0/0

    Allows external access to the application O&M page.

    1

    Allow

    IPv4

    TCP: 9001

    0.0.0.0/0

    Allows external access to the application dashboard.

Step 3: Run the Node.js Program

  1. In the address bar of a local browser, enter http://EIP:9000 and enter the username and password to log in to the application O&M page.
    • The username of the O&M page is root.
    • The password of the O&M page is the same as that of the FlexusL instance. The FlexusL instance does not have an initial password. Reset the password of the FlexusL instance. For details about how to reset the password, see Resetting the Password for a FlexusL Instance.
  2. Choose My Apps and click the App icon.
  3. Select Compose and click Prompt Adjustment.

  4. On the dashboard, open the cmd.sh file in the src folder.

  5. After releasing the code in the file, click Commit Changes to submit the code.

  6. On the Compose page, click Redeploy App.

  7. On the displayed page, retain the default settings and click Redeploy.

  8. In the address bar of a local browser, enter http://EIP:9001 to check the program execution results.