DBC Bare Metal Node

About 5 min

DBC Bare Metal Node

Introduction

  1. The bare metal node of DBC is only responsible for generating the node id for the bare metal server, and controlling the bare metal server to perform limited operations such as switching on and off.
  2. Bare metal nodes do not support functions related to virtual machines. Because the requirements for the hardware equipment of the machine where the node is deployed are very low, the resources such as memory and hard disk used are very small, as long as the IPMI tool can be used for the bare metal server and the network service is normal.

注意!

The bare metal node of DBC itself has a "node_id", which does not need to be uploaded to the chain, and is only used to generate a "node_id" for the bare metal server.

For example, send a request to add a bare metal server to a bare metal node. The parameter needs to tell the client node which bare metal node to send to, and fill in the information for IPMI control. The request will return a new "node_id", that is the "node_id" of the added bare metal server. This "node_id" needs to be on the chain, and then the user can rent it on the chain, and use it to send the request of switching on and off.

This article mentions two kinds of node_id, which are distinguished here:

  • "The node_id of the bare metal node" refers to the "node_id" field in the "dat/node.dat" file in the node installation directory.
  • "The node_id of the bare metal server" is the "node_id" field returned by sending the request to add the bare metal server.

install node

  1. Download the installation script:http://112.192.16.27:9000/dbc/install_update_script/mainnet/install_baremetal.shopen in new window
  2. run the install script:
sudo bash ./install_baremetal.sh <installation directory>

The installation script will automatically install the IPMI tool, and like the script for installing the DBC client node, you need to enter 2 port numbers.

upgrade node

  1. Download upgrade script:http://112.192.16.27:9000/dbc/install_update_script/mainnet/update_baremetal.shopen in new window
  2. Run the upgrade script:
sudo bash update_baremetal.sh <installation directory>

Add a bare metal server

  • request method:POST

  • request URL:

http://{{dbc_client_ip}}:{{dbc_client_port}}/api/v1/bare_metal/add
  • request Body:
{
  "peer_nodes_list": [
    // node_id of bare metal node
    "ccd9a2118ba3c95cd458302601f15281edc39d72dcf11a07527893d97ac1a573"
  ],
  "additional": {
    // Informations of bare metal server
    "bare_metal_nodes": [
      {
        // The unique ID of the machine supplier to identify the bare metal, required.
        "uuid": "3156995b-da18-4268-9734-f8d168e90a7d",
        // The connection method provided by the bare metal server to the user. Required. A fixed IP address is recommended.
        "ip": "175.221.204.110",
        // Operating system of the bare metal server, optional.
        "os": "Ubuntu 20.04.3 LTS (Focal Fossa) 5.4.0-121-generic GNU/Linux",
        // A description customized by the machine owner, not required.
        "desc": "在xxx平台租用的裸金属服务器,用于xxx业务,机房id是9f01ca9c-38bd-46a9-9637-dac92b352a63",
        // The host ID of ipmi, required. A fixed IP address is recommended.
        "ipmi_hostname": "192.168.0.110",
        // ipmi username, required.
        "ipmi_username": "admin",
        // ipmi user password, required.
        "ipmi_password": "dbtu2017",
        // ipmi port,optional. v0.4.0.9 version added.
        "ipmi_port": 623
      }
    ]
  },
  // Generated by the node_id and node_private_key of the bare metal node
  "wallet":"ccd9a2118ba3c95cd458302601f15281edc39d72dcf11a07527893d97ac1a573",
  "nonce":"5tYLiAF9vVP8bRqSfV9DfZnizsDNY7dNeEWrSUAY8f1LKiZqBu8zaVs",
  "sign":"3c680ba745af6695981fe2b30aedf6861749f570d9a6fe949930caf4613c225d4a674c33ec3d4af26c20caf871dd0f3a7cb4e0c045f12c211a345781054fc282"
}
  • return example:
{
  "errcode": 0,
  "message": {
    "bare_metal_nodes": [
      {
        "node_id": "fcf2cd8b99958606d260ca00c5ac00c88c242bcf8eb38e7cc3f29e9719a73f39",
        "uuid": "3156995b-da18-4268-9734-f8d168e90a7d"
      }
    ]
  }
}

Query the list of bare metal servers

  • request method:POST

  • request URL:

http://{{dbc_client_ip}}:{{dbc_client_port}}/api/v1/bare_metal
  • request Body:
{
  "peer_nodes_list": [
    // node_id of bare metal node. When this is empty, it means querying the list of all bare metal servers.
    "ccd9a2118ba3c95cd458302601f15281edc39d72dcf11a07527893d97ac1a573"
  ],
  "additional": {},
  // Generated by the node_id and node_private_key of the bare metal node
  "wallet":"ccd9a2118ba3c95cd458302601f15281edc39d72dcf11a07527893d97ac1a573",
  "nonce":"5tYLiAF9vVP8bRqSfV9DfZnizsDNY7dNeEWrSUAY8f1LKiZqBu8zaVs",
  "sign":"3c680ba745af6695981fe2b30aedf6861749f570d9a6fe949930caf4613c225d4a674c33ec3d4af26c20caf871dd0f3a7cb4e0c045f12c211a345781054fc282"
}
  • return example:
{
  "errcode": 0,
  "message": {
    "bare_metal_nodes": [
      {
        "node_id": "fcf2cd8b99958606d260ca00c5ac00c88c242bcf8eb38e7cc3f29e9719a73f39",
        "node_private_key": "4c2e7133834d6d7dd35088beda5556215f6f5b15d2cd3c3153f117aaeec2c28b",
        "uuid": "3156995b-da18-4268-9734-f8d168e90a7d",
        "ip": "175.221.204.110",
        "os": "Ubuntu 20.04.3 LTS (Focal Fossa) 5.4.0-121-generic GNU/Linux",
        "description": "在xxx平台租用的裸金属服务器,用于xxx业务,机房id是9f01ca9c-38bd-46a9-9637-dac92b352a63",
        "ipmi_hostname": "192.168.0.110",
        "ipmi_username": "admin",
        "ipmi_password": "dbtu2017",
        "deeplink_device_id": "123456789",
        "deeplink_device_password": "aAbBcC"
      }
    ]
  }
}

When the "peer_nodes_list" array in the request body contains the node_id of the bare metal node, you can also query the specified bare metal server based on the uuid entered when adding the bare metal server.

  • Use http://{{dbc_client_ip}}:{{dbc_client_port}}/api/v1/bare_metal/<node_id> to query related information about the bare metal server with the specified node_id.
  • Use http://{{dbc_client_ip}}:{{dbc_client_port}}/api/v1/bare_metal/<uuid> to query related information about the bare metal server with the specified uuid.

Bare metal server on-chain

Use the "node_id" and "node_private_key" queried above to upload the bare metal server to the chain. Refer to Machine Onchain stepsopen in new window

After being on-chain, you can rent a bare metal server on the chain just like renting an ordinary computing machine.

注意!

The "node_id" used by the bare metal server on the chain is the "node_id" returned by the request to add the bare metal server, and the "node_private_key" is obtained by querying the bare metal server above.

Use of Bare Metal Servers

By renting a bare metal server on the chain, you can query its machine information, and use the IP and port in the machine information to connect (ssh or Windows remote connection tool) to access.

If the bare metal server is not powered on, you can control its power to be powered on by sending a request.

  • request method:POST

  • request URL:

http://{{dbc_client_ip}}:{{dbc_client_port}}/api/v1/bare_metal/power
  • request Body:
{
  "peer_nodes_list": [
    // node_id of bare metal server
    "fcf2cd8b99958606d260ca00c5ac00c88c242bcf8eb38e7cc3f29e9719a73f39"
  ],
  "additional": {
    // power control command
    // "on"     - power on
    // "off"    - power off
    // "reset"  - power reset
    // "status" - get power status
    "command": "on"
  },
  "session_id": "The session_id distributed by the renter",
  "session_id_sign": "session_id_sign distributed by the renter"
}

For other API interfaces, please refer to Bare Metal Node Operationsopen in new window

Cloud internet cafe

In the cloud Internet cafe scene, after a GPU machine is connected to the chain in the form of a bare metal server, if you want to obtain an e-sports-level gaming experience, you also need to use a low-latency remote control software based on cloud games- DeepLinkopen in new window.

Correspondingly, to use DeepLink remote control, it is necessary to obtain the device code and device verification code of the DeepLink software running on the GPU machine (hereinafter collectively referred to as DeepLink device information). To this end, we add an interface to query DeepLink device information through the dbc node.

In order to ensure security, it is recommended that the GPU machines in the cloud Internet cafe scene have different device verification codes every time they are powered on, and use the interface for setting DeepLink device information to inform the bare metal node of the dbc of the device information as soon as it is powered on.

In addition, you need to modify http_ip=127.0.0.1 in the configuration file dbc_baremetal_node/conf/core.conf of the bare metal node to http_ip=0.0.0.0, so that the bare metal node can directly accept HTTP requests.

When the GPU machine and the bare metal node of dbc are in the same network, you can directly use the HTTP service of the bare metal node to get/set device information, and the request at this time does not need session_id and session_id_sign parameters. When the renter queries the device information through the HTTP service of the client node, it must have session_id and session_id_sign parameters.

The specific usage process is as follows:

  1. After the GPU machine is turned on, the service program of the cloud Internet cafe calls the DeepLink device information setting interface of the bare metal node immediately.
  • request method:POST

  • request URL:

http://{{dbc_baremetal_ip}}:{{dbc_baremetal_port}}/api/v1/deeplink/set
  • request Body:
{
  "peer_nodes_list": [
    // The node_id corresponding to the GPU machine
    "fcf2cd8b99958606d260ca00c5ac00c88c242bcf8eb38e7cc3f29e9719a73f39"
  ],
  "additional": {
    "device_id": "123456789",
    "device_password": "aAbBcC"
  },
  // Generated by the node_id and node_private_key of the GPU machine
  "wallet":"fcf2cd8b99958606d260ca00c5ac00c88c242bcf8eb38e7cc3f29e9719a73f39",
  "nonce":"3bxrsXVW2z2ELH7G9RvF7BMUQkEGkBfQhd8YD5r8somf3UdNWcEYAFa",
  "sign":"e096764ac7462220bc9b8fa223b81cfb9a501eaea9ea355c0d561b6fe61cb729abed61e5d8488178856e198d9cde51c37e2aac8886cb5e7b674591b1eca8108f"
}
  • return example:
{
  "errcode": 0,
  "message": "ok"
}

Note that the URL of this request is http://{{dbc_baremetal_ip}}:{{dbc_baremetal_port}}/api/v1/deeplink/set instead of http://{{dbc_client_ip}}:{{dbc_client_port}}/api/v1/deeplink/set, and the request content does not need session_id and session_id_sign parameters.

Similarly, you can also call http://{{dbc_baremetal_ip}}:{{dbc_baremetal_port}}/api/v1/deeplink at this time to query the device information of the bare metal node.

  1. The renter queries DeepLink device information.
  • request method:POST

  • request URL:

http://{{dbc_client_ip}}:{{dbc_client_port}}/api/v1/deeplink
  • request Body:
{
  "peer_nodes_list": [
    // The node_id corresponding to the GPU machine
    "fcf2cd8b99958606d260ca00c5ac00c88c242bcf8eb38e7cc3f29e9719a73f39"
  ],
  "additional": {},
  "session_id": "The session_id distributed by the renter",
  "session_id_sign": "session_id_sign distributed by the renter"
}
  • return example:
{
  "errcode": 0,
  "message": {
    "device_id": "123456789",
    "device_password": "aAbBcC"
  }
}

Note that the URL of this request is http://{{dbc_client_ip}}:{{dbc_client_port}}/api/v1/deeplink, and the request content requires session_id and session_id_sign parameters.

Loading...