Un-Containerized Apps
This tutorial demonstrates how systemd applications can deployed and provisioned with custom configurations. This covers:
- Initialise the Edge Builder server components and CLI
- Add a node
- Add a systemd app definition
- Add a systemd app config file definition
- Add a systemd app config definition
- Start systemd app and inject configuration
Initialize Edge Builder server components and CLI
To initialize the Edge Builder server components and CLI, complete the following steps:
-
Set up the environment as described in Tutorials Setup
-
SSH into the master node:
vagrant ssh master
-
Start the Edge Builder server components using the following command:
When the server components are up, you should see all server components up and running via thesudo edgebuilder-server up -a 192.168.56.10
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
-
Log in to Edge Builder with the default user credentials using the following command:
The following message displays:edgebuilder-cli user login -u iotech -p EdgeBuilder123 -c "http://192.168.56.10:8085"
INFO: User "iotech" logged in successfully
-
Confirm that you have a valid license in the Vagrant project directory (
edgebuilder-vagrant
) - Add the license using the following command:
You should see the output similar to that shown below:
edgebuilder-cli license add -l DemoLicense -f /vagrant/EdgeBuilder_test_Evaluation.lic
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:
-
Confirm that the example node configuration file is avaliable using the
cat
command:The output is similar to the following:cat /vagrant/examples/single-node-config.json
{ "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"] } ] }
-
Add the edge node to Edge Builder using the following command:
The output is similar to the following:edgebuilder-cli node add -f /vagrant/examples/single-node-config.json
INFO: SSH Node(s) added successfully: +-------+--------------------------------------+----------------+ | NODE | ID | LABELS | +-------+--------------------------------------+----------------+ | node1 | 81b5b8fe-ebba-42bf-b301-df1aa872aba3 | label1, label2 | +-------+--------------------------------------+----------------+ INFO: Viewing 1 result(s)
-
Confirm that the node has been added using the following command:
The output is similar to the following:edgebuilder-cli node view --all
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 toUp
- You can also use the
watch
command with thenode view
above to automatically track the status changes
- The status of the node is initially shown as
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:The output is similar to the following:cat /vagrant/examples/appConfiguration/sshd-example/app-def.json
{ "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:
The output is similar to the following:cat /vagrant/examples/appConfiguration/sshd-example/systemd-conf.json
{ "service_name": "sshd", "config_paths": [ "/opt" ] }
-
Add the app definition to Edge Builder using the following command:
The output is similar to the following:edgebuilder-cli appDefinition add -f /vagrant/examples/appConfiguration/sshd-example/app-def.json
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:
The output is similar to the following:
edgebuilder-cli appDefinition view --all
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:The output is similar to the following:cat /vagrant/examples/appConfiguration/sshd-example/app-config-file.json
{ "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:The output is similar to the following:cat /vagrant/examples/appConfiguration/sshd-example/config.txt
This is an example config file.
- Add the AppConfigFile using the following command:
The output is similar to the following:
edgebuilder-cli appConfigFile add -f /vagrant/examples/appConfiguration/sshd-example/app-config-file.json
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:The output is similar to the following:cat /vagrant/examples/appConfiguration/sshd-example/app-config.json
{ "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:
The output is similar to the following:
edgebuilder-cli appConfig add -f /vagrant/examples/appConfiguration/sshd-example/app-config.json
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:
The output is similar to the following:
edgebuilder-cli app create -n node1 -d AppDefinitionSystemd1 -c sshdConfig
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:Output is similar to the following:edgebuilder-cli app view --all
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 toCreated
- You can also use the
watch
command with theapp view
above to automatically track the status changes
- The status of the app is initially shown as
-
Start the app using the following command, where
<appname/id>
is the ID or Name of your app.The output is similar to the following:edgebuilder-cli app start -a <appname/id>
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:The output is similar to the following:edgebuilder-cli app view --all
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:Expected Output:edgebuilder-cli app stop -a <appName/Id>
INFO: Finding apps: ["d7e00b83-a843-4aa3-85e6-0ccbbd90191c"] INFO: Stopping 1 app(s)
-
Confirm the app is stopped by running the following command
The output is similar to the following:edgebuilder-cli app view --all
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:Expected Output:edgebuilder-cli app remove -a <appname/Id> -y
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:
-
Remove the edge node
node1
using the following command:Expected output:edgebuilder-cli node rm -n node1 -y
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
-
Confirm that the node has been removed using the following command:
Expected output:edgebuilder-cli node view -n node1
INFO: Finding nodes: ["node1"] WARN: node "node1" not found WARN: 0 results to view