Skip to content

Un-Containerized Apps

This tutorial demonstrates how systemd applications can deployed and provisioned with custom configurations. This covers:

Initialize 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"
    
    The following message displays:
    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 add an edge node to Edge Builder, which 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
    
    The output is similar to the following:
    {
      "NodeConfig": [
          {
            "name": "node1",
            "description": "virtual node 1",
            "nodeaddress": "192.168.56.11",
            "nodesshport": "22",
            "username" : "vagrant",
            "password" : "vagrant",
            "serveraddress": "192.168.56.10",
            "labels" : ["label1", "label2"]
          }
      ]
    }
    

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

     edgebuilder-cli node add -f /vagrant/examples/single-node-config.json
    
    The output is similar to the following:
    INFO: SSH Node(s) added successfully:
    +-------+--------------------------------------+----------------+
    | NODE  | ID                                   | LABELS         |
    +-------+--------------------------------------+----------------+
    | node1 | 81b5b8fe-ebba-42bf-b301-df1aa872aba3 | label1, label2 |
    +-------+--------------------------------------+----------------+
    INFO: Viewing 1 result(s)
    

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

    edgebuilder-cli node view --all
    
    The output is similar to the following:
    INFO: Finding all nodes...
    INFO: *** Node View Results ***
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    | NAME  | ID                                   | STATUS | DEBUG MODE | METRICS MODE | LABELS                                   | DESCRIPTION    |
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    | node1 | 81b5b8fe-ebba-42bf-b301-df1aa872aba3 | Up     | Off        | Local        | CPUModel:11thGenIntel(R)Core(TM)i7-11800 | virtual node 1 |
    |       |                                      |        |            |              | H@2.30GHz, Language:en_US, label1, OSArc |                |
    |       |                                      |        |            |              | h:amd64, OSFinger:Ubuntu-20.04, CPUArch: |                |
    |       |                                      |        |            |              | x86_64, OSFamily:Debian, GroupName:root, |                |
    |       |                                      |        |            |              |  label2, Manufacturer:innotekGmbH, Virtu |                |
    |       |                                      |        |            |              | al:VirtualBox, Timezone:UTC, Kernel:Linu |                |
    |       |                                      |        |            |              | x, UserName:root, ProductName:VirtualBox |                |
    |       |                                      |        |            |              | , Hostname:node1                         |                |
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    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

Add a systemd app definition

In this section of the tutorial, we create a systemd app definition for managing sshd.

  • Confirm that the example systemd app definition configuration file is available using the cat command:
    cat /vagrant/examples/appConfiguration/sshd-example/app-def.json
    
    The output is similar to the following:
    {
      "AppDefinitionConfig": [
        {
          "Name": "AppDefinitionSystemd1",
          "Description": "An example app definition (systemd)",
          "FilePath": "/vagrant/examples/appConfiguration/sshd-example/systemd-conf.json",
          "Type": "systemd"
        }
      ]
    }
    
  • Confirm that the example systemd JSON file, which defines the sshd service to be managed, is available using the following command:

    cat /vagrant/examples/appConfiguration/sshd-example/systemd-conf.json
    
    The output is similar to the following:
    {
      "service_name": "sshd",
      "config_paths": [
        "/opt"
      ]
    }
    

  • Add the app definition to Edge Builder using the following command:

    edgebuilder-cli appDefinition add -f /vagrant/examples/appConfiguration/sshd-example/app-def.json
    
    The output is similar to the following:
    INFO: AppDefinition(s) added successfully:
    +-----------------------+--------------------------------------+--------+
    | NAME                  | ID                                   | LABELS |
    +-----------------------+--------------------------------------+--------+
    | AppDefinitionSystemd1 | e09f0323-3f34-4dce-8648-9f5e22450786 |        |
    +-----------------------+--------------------------------------+--------+
    INFO: Viewing 1 result(s)
    

  • Confirm that the app definition has been added using the following command:
    edgebuilder-cli appDefinition view --all
    
    The output is similar to the following:
    INFO: Finding all appDefinitions...
    INFO: *** AppDefinition View Results ***
    +------------------------+--------------------------------------+-------------------------------------+----------------+--------+
    | NAME                   | ID                                   | DESCRIPTION                         | TYPE           | LABELS |
    +------------------------+--------------------------------------+-------------------------------------+----------------+--------+
    | AppDefinitionSystemd1  | e09f0323-3f34-4dce-8648-9f5e22450786 | An example app definition (systemd) | systemd        |        |
    +------------------------+--------------------------------------+-------------------------------------+----------------+--------+
    INFO: Viewing 1 result(s)
    

Add a systemd app config file definition

This section of the tutorial illustrates how application configuration files can be added to be used by a systemd app definition.

  • Confirm that the AppConfigFile definition is available using the cat command:
    cat /vagrant/examples/appConfiguration/sshd-example/app-config-file.json
    
    The output is similar to the following:
    {
      "AppConfigFileConfig": [
        {
          "Name": "temporaryFile",
          "Description": "a file to configure the systemd daemon",
          "FileName": "temporary.txt",
          "FilePath": "/vagrant/examples/appConfiguration/sshd-example/config.txt"
        }
      ]
    }
    
  • Confirm that the config file, config.txt, is available using the cat command:
    cat /vagrant/examples/appConfiguration/sshd-example/config.txt
    
    The output is similar to the following:
    This is an example config file.
    
  • Add the AppConfigFile using the following command:
    edgebuilder-cli appConfigFile add -f /vagrant/examples/appConfiguration/sshd-example/app-config-file.json
    
    The output is similar to the following:
    INFO: appConfigFile(s) added successfully:
    +---------------+--------------------------------------+----------------------------------------+
    | NAME          | ID                                   | DESCRIPTION                            |
    +---------------+--------------------------------------+----------------------------------------+
    | temporaryFile | ef6d082b-d047-49f8-a10c-ca14296ee9e1 | a file to configure the systemd daemon |
    +---------------+--------------------------------------+----------------------------------------+
    INFO: Viewing 1 result(s)
    

Add a systemd app config definition

This section creates a systemd AppConfig by associating the above AppConfigFile with a filepath in our AppDefinition.

  • Confirm that the AppConfig definition is available using the cat command:

    cat /vagrant/examples/appConfiguration/sshd-example/app-config.json
    
    The output is similar to the following:
    {
      "AppConfig": [
        {
          "Name": "sshdConfig",
          "Description": "Configuration for sshd",
          "AppDefinitionID": "e09f0323-3f34-4dce-8648-9f5e22450786",
          "ConfigMappings": [
            {
              "Destination": "/opt",
              "AppConfigFiles": [
                "temporaryFile"
              ]
            }
          ]
        }
      ]
    }
    

    Note

    • The app config maps one or many app config files to one or more filepaths. The filepaths must exist in the AppDefinition.
  • Change the 'AppDefinitionID' to the ID returned when the app definition AppDefinitionSystemd1 was added.

  • Add the AppConfig using the following command:
    edgebuilder-cli appConfig add -f /vagrant/examples/appConfiguration/sshd-example/app-config.json
    
    The output is similar to the following:
    INFO: AppConfig(s) added successfully:
    +------------+--------------------------------------+------------------------+--------------------------------------+
    | NAME       | ID                                   | DESCRIPTION            | APP_DEFINITION ID                    |
    +------------+--------------------------------------+------------------------+--------------------------------------+
    | sshdConfig | 1b2028ca-289e-412a-8c45-92a5c00c6bd0 | Configuration for sshd | e09f0323-3f34-4dce-8648-9f5e22450786 |
    +------------+--------------------------------------+------------------------+--------------------------------------+
    INFO: Viewing 1 result(s)
    

Start Systemd App and Inject Configuration

The section explains how to deploy a systemd app using the app definition and app config defined above.

  • To create the systemd application run the following command:
    edgebuilder-cli app create -n node1 -d AppDefinitionSystemd1 -c sshdConfig
    
    The output is similar to the following:
    INFO: Creating app(s):
    +-------------------------------------------+--------------------------------------+----------+--------------------------------------+--------+
    | APP NAME                                  | APP ID                               | STATUS   | NODE ID                              | LABELS |
    +-------------------------------------------+--------------------------------------+----------+--------------------------------------+--------+
    | sshd_d7e00b83-a843-4aa3-85e6-0ccbbd90191c | d7e00b83-a843-4aa3-85e6-0ccbbd90191c | Creating | d5a1fc67-9369-478f-a73e-667c484c56ef |        |
    +-------------------------------------------+--------------------------------------+----------+--------------------------------------+--------+
    INFO: Viewing 1 result(s)
    
  • Confirm the app is in the created state using the following command:

    edgebuilder-cli app view --all
    
    Output is similar to the following:
    INFO: Finding all apps...
    INFO: *** App View Results ***
    +----------------------------------------------+---------+--------------------------------------+------------------------+-------+--------+
    | NAME                                         | STATUS  | ID                                   | APP_DEFINITION         | NODE  | LABELS |
    +----------------------------------------------+---------+--------------------------------------+------------------------+-------+--------+
    | sshd_d7e00b83-a843-4aa3-85e6-0ccbbd90191c    | Created | d7e00b83-a843-4aa3-85e6-0ccbbd90191c | AppDefinitionSystemd1  | node1 |        |
    +----------------------------------------------+---------+--------------------------------------+------------------------+-------+--------+
    INFO: Viewing 1 result(s)
    

    Note

    • The status of the app is initially shown as Creating. After a few seconds, you can re-issue the command and the status will have changed to Created
    • You can also use the watch command with the app view above to automatically track the status changes
  • Start the app using the following command, where <appname/id> is the ID or Name of your app.

    edgebuilder-cli app start -a <appname/id>
    
    The output is similar to the following:
    INFO: Finding apps: ["sshd_d7e00b83-a843-4aa3-85e6-0ccbbd90191c"]
    INFO: Starting 1 app(s)
    

  • To view the status of the app, use the app view command again:
    edgebuilder-cli app view --all
    
    The output is similar to the following:
    INFO: Finding all apps...
    INFO: *** App View Results ***
    +--------------------------------------------+---------+--------------------------------------+------------------------+-------+--------+
    | NAME                                       | STATUS  | ID                                   | APP_DEFINITION         | NODE  | LABELS |
    +--------------------------------------------+---------+--------------------------------------+------------------------+-------+--------+
    | sshd_d7e00b83-a843-4aa3-85e6-0ccbbd90191c  | Running | d7e00b83-a843-4aa3-85e6-0ccbbd90191c | AppDefinitionSystemd1  | node1 |        |
    +--------------------------------------------+---------+--------------------------------------+------------------------+-------+--------+
    INFO: Viewing 1 result(s)
    

Delete the app

This section explains how to remove the application which is running.

  • Stop the running application using the following command, where <appname/Id> is the ID or Name of your app:
    edgebuilder-cli app stop -a <appName/Id>
    
    Expected Output:
    INFO: Finding apps: ["d7e00b83-a843-4aa3-85e6-0ccbbd90191c"]
    INFO: Stopping 1 app(s)
    
  • Confirm the app is stopped by running the following command

    edgebuilder-cli app view --all
    
    The output is similar to the following:
    INFO: Processing all apps...
    INFO: *** App View Results ***
    +--------------------------------------------+---------+--------------------------------------+------------------------+-------+--------+
    | NAME                                       | STATUS  | ID                                   | APP_DEFINITION         | NODE  | LABELS |
    +--------------------------------------------+---------+--------------------------------------+------------------------+-------+--------+
    | sshd_d7e00b83-a843-4aa3-85e6-0ccbbd90191c  | Stopped | d7e00b83-a843-4aa3-85e6-0ccbbd90191c | AppDefinitionSystemd1  | node1 |        |
    +--------------------------------------------+---------+--------------------------------------+------------------------+-------+--------+
    INFO: Viewing 1 result(s)
    

  • Remove the app using the following command, where <appname/Id> is the ID or Name of your app:

    edgebuilder-cli app remove -a <appname/Id> -y
    
    Expected Output:
    INFO: Finding apps: ["d7e00b83-a843-4aa3-85e6-0ccbbd90191c"]
    INFO: Attempting to remove 1 app(s)
    INFO: Removal request for 1 app(s) accepted for processing by Edge Builder. Use 'app view' command to get updated status
    

Remove the node

To remove an edge node, complete the following steps:

  1. Remove the edge node node1 using the following command:

    edgebuilder-cli node rm -n node1 -y
    
    Expected output:
    INFO: Processing nodes: ["node1"]
    INFO: Attempting to remove 1 node(s)
    INFO: Removal request for 1 node(s) accepted for processing by Edge Builder. Use 'node view' command to get updated status
    

  2. Confirm that the node has been removed using the following command:

    edgebuilder-cli node view -n node1
    
    Expected output:
    INFO: Finding nodes: ["node1"]
    WARN: node "node1" not found
    WARN: 0 results to view