Skip to content

Debug Apps

In this tutorial, we demonstrate how to debug issues on the node using Edge Builder CLI. This will cover how to:

Initialise the Edge Builder server components and CLI

To initialize the Edge Builder server components and CLI, complete the following steps:

  1. Set up the environment as described in Tutorials Setup

  2. SSH into the master node:

    vagrant ssh master
    

  3. Start the Edge Builder server components using the following command:

    sudo edgebuilder-server up -a 192.168.56.10
    
    When the server components are up, you should see all server components up and running via the docker ps command:
    vagrant@master:~$ docker ps
    
    CONTAINER ID   IMAGE                                    COMMAND                  CREATED          STATUS                      PORTS                                                                                                                                                     NAMES
    7760c2ef24ff   iotechsys/dev-eb-controller:1.2.0.dev    "./entrypoint.sh"        20 minutes ago   Up 20 minutes               0.0.0.0:8085->8085/tcp, :::8085->8085/tcp, 0.0.0.0:50000-50100->50000-50100/tcp, :::50000-50100->50000-50100/tcp, 0.0.0.0:1022->22/tcp, :::1022->22/tcp   eb-controller
    1b727b4d9836   iotechsys/dev-eb-vault-setup:1.2.0.dev   "/bin/sh -c ./setup-…"   20 minutes ago   Exited (0) 20 minutes ago                                                                                                                                                             eb-vault-setup
    639b032001a2   chronograf:1.8.8-alpine                  "./custom-entrypoint…"   20 minutes ago   Up 20 minutes               0.0.0.0:8888->8888/tcp, :::8888->8888/tcp                                                                                                                 eb-chronograf
    f58f2c929117   vault:1.7.1                              "./entrypoint.sh"        20 minutes ago   Up 20 minutes               8200/tcp                                                                                                                                                  eb-vault
    ecddbcb443cf   portainer/portainer-ce:2.1.0-alpine      "/portainer -H unix:…"   20 minutes ago   Up 20 minutes               0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp                                                                      eb-portainer
    b073acb8864d   postgres:alpine                          "./entrypoint.sh"        20 minutes ago   Up 20 minutes               5432/tcp                                                                                                                                                  eb-db
    590bc53e2adf   iotechsys/dev-eb-webssh:1.2.0.dev        "wssh --address=0.0.…"   20 minutes ago   Up 20 minutes               0.0.0.0:8989->8989/tcp, :::8989->8989/tcp                                                                                                                 eb-webssh
    d941d61bcfbb   iotechsys/dev-eb-redis:1.2.0.dev         "redis-server /etc/r…"   20 minutes ago   Up 20 minutes               6379/tcp                                                                                                                                                  eb-redis
    70fdf21ff278   influxdb:1.8.1-alpine                    "./custom-entrypoint…"   20 minutes ago   Up 20 minutes               0.0.0.0:8086->8086/tcp, :::8086->8086/tcp                                                                                                                 eb-influxdb
    56f986f6a243   iotechsys/dev-eb-salt-master:1.2.0.dev   "/bin/sh -c 'sed -i …"   20 minutes ago   Up 20 minutes               0.0.0.0:4505-4506->4505-4506/tcp, :::4505-4506->4505-4506/tcp, 0.0.0.0:8099->8099/tcp, :::8099->8099/tcp                                                  eb-salt-master
    6b6ce98355f1   grafana/grafana:7.4.2                    "/run.sh"                20 minutes ago   Up 20 minutes               0.0.0.0:3000->3000/tcp, :::3000->3000/tcp                                                                                                                 eb-grafana
    97656c20a6c0   kapacitor:1.5-alpine                     "/entrypoint.sh kapa…"   20 minutes ago   Up 20 minutes               9092/tcp                                                                                                                                                  eb-kapacitor
    

  4. Log in to Edge Builder with the default user credentials using the following command:

    edgebuilder-cli user login -u iotech -p EdgeBuilder123 -c "http://192.168.56.10:8085"
    
    You should see the following INFO message:
    INFO: User "iotech" logged in successfully
    

  5. Confirm that you have a valid license in the Vagrant project directory (edgebuilder-vagrant)

  6. Add the license using the following command:
    edgebuilder-cli license add -l DemoLicense -f /vagrant/EdgeBuilder_test_Evaluation.lic
    
    You should see the output similar to that shown below:
    INFO: License added successfully
    +-------------+--------------------------------------+---------------------------------+-----------+-----------+
    | NAME        | ID                                   | FILENAME                        | MAX NODES | EXPIRY    |
    +-------------+--------------------------------------+---------------------------------+-----------+-----------+
    | DemoLicense | b65c2ba0-c78b-4031-aaf4-cc030d3d763d | EdgeBuilder_test_Evaluation.lic | 100       | unlimited |
    +-------------+--------------------------------------+---------------------------------+-----------+-----------+
    INFO: Viewing 1 result(s)
    

Add a node

In this section of the tutorial, we will add a node to Edge Builder. It is accessible on 192.168.56.11.

To add an edge node, complete the following steps:

  1. Confirm that the example node configuration file is avaliable using the cat command:

    cat /vagrant/examples/single-node-config.json
    
    Expected output:
    {
      "NodeConfig": [
          {
              "name": "node1",
              "description": "virtual node 1",
              "nodeaddress": "192.168.56.11",
              "username" : "vagrant",
              "password" : "vagrant",
              "serveraddress": "192.168.56.10",
              "groups" : []
          }
      ]
    }
    

  2. Add the node to Edge Builder using the following command:

     edgebuilder-cli node add -f /vagrant/examples/single-node-config.json
    
    Expected output:
    INFO: SSH Node(s) added successfully:
    +-------+--------------------------------------+
    | NODE  | ID                                   |
    +-------+--------------------------------------+
    | node1 | e01c540b-fa87-4721-b38c-5f0109210381 |
    +-------+--------------------------------------+
    INFO: Viewing 1 result(s)
    

  3. Confirm that the node has been added using the following command:

    edgebuilder-cli node view --all
    
    Expected output:
    INFO: Finding all nodes...
    INFO: *** Node View Results ***
    +-------+----------+------------+--------------+----------------+--------------------------------------+
    | NAME  |  STATUS  | DEBUG MODE | METRICS MODE | DESCRIPTION    | ID                                   |
    +-------+----------+------------+--------------+----------------+--------------------------------------+
    | node1 | Deploying| Off        | Local        | virtual node 1 | e01c540b-fa87-4721-b38c-5f0109210381 |
    +-------+----------+------------+--------------+----------------+--------------------------------------+
    INFO: Viewing 1 result(s)
    

    Note

    • The status of the node is initially shown as Deploying. After a few minutes, you can re-issue the command and the status will have changed to Up
    • You can also use the watch command with the node view above to automatically track the status changes

Activate Debug Mode

In this section of the tutorial, we demonstrate how to enable debug mode on a node. Debug mode starts an instance of the Portainer edge agent on the node to provide detailed access to any containers on the edge node.

  1. Start debug mode on the node using the following command:

    edgebuilder-cli node debug -n node1 --start -w
    
    Expected output:
    INFO: Debug mode started on node "node1", access Portainer here "http://192.168.56.10:9000" and navigate to endpoint corresponding to the node for further details
    

  2. Confirm that the debug mode is enabled on the node using node view command

    edgebuilder-cli node view -n node1
    
    Expected output:
    INFO: Finding nodes: ["node1"]
    INFO: *** Node View Results ***
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    | NAME  | ID                                   | STATUS | DEBUG MODE | METRICS MODE | LABELS                                   | DESCRIPTION    |
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    | node1 | d5a1fc67-9369-478f-a73e-667c484c56ef | Up     | On         | Local        | OSArch:amd64, Kernel:Linux, Timezone:UTC | virtual node 1 |
    |       |                                      |        |            |              | , CPUArch:x86_64, Hostname:node1, Virtua |                |
    |       |                                      |        |            |              | l:VirtualBox, label2, OSFinger:Ubuntu-20 |                |
    |       |                                      |        |            |              | .04, UserName:root, OSFamily:Debian, CPU |                |
    |       |                                      |        |            |              | Model:Intel(R)Core(TM)i9-9900CPU@3.10GHz |                |
    |       |                                      |        |            |              | , GroupName:root, ProductName:VirtualBox |                |
    |       |                                      |        |            |              | , Manufacturer:innotekGmbH, Language:en_ |                |
    |       |                                      |        |            |              | US, label1                               |                |
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    INFO: Viewing 1 result(s)
    

  3. Portainer can be accessed on http://192.168.56.10:9000 using the login credentials below.

    username: admin
    password: Portainer123
    

  4. This should result in a Portainer window with node1 as shown below:

    Portainer1

  5. Once logged in navigate to the Dashboard for node1

Deactivate debug mode

  1. After debugging the node and apps running on the node, turn off the debug mode:

    edgebuilder-cli node debug -n node1 --stop
    
    Expected output:
    INFO: stopped node debug mode
    

  2. Confirm that the debug mode is disabled on the node using node view command

    edgebuilder-cli node view -n node1
    
    Expected output:
    INFO: Finding nodes: ["node1"]
    INFO: *** Node View Results ***
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    | NAME  | ID                                   | STATUS | DEBUG MODE | METRICS MODE | LABELS                                   | DESCRIPTION    |
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    | node1 | d5a1fc67-9369-478f-a73e-667c484c56ef | Up     | off        | Local        | OSArch:amd64, Kernel:Linux, Timezone:UTC | virtual node 1 |
    |       |                                      |        |            |              | , CPUArch:x86_64, Hostname:node1, Virtua |                |
    |       |                                      |        |            |              | l:VirtualBox, label2, OSFinger:Ubuntu-20 |                |
    |       |                                      |        |            |              | .04, UserName:root, OSFamily:Debian, CPU |                |
    |       |                                      |        |            |              | Model:Intel(R)Core(TM)i9-9900CPU@3.10GHz |                |
    |       |                                      |        |            |              | , GroupName:root, ProductName:VirtualBox |                |
    |       |                                      |        |            |              | , Manufacturer:innotekGmbH, Language:en_ |                |
    |       |                                      |        |            |              | US, label1                               |                |
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    INFO: Viewing 1 result(s)