thin-edge.io plugin to register child devices.
A http server which provides a simple interface for child devices to register themselves and indicate which operations they support via a HTTP API.
The device-registration-server should be installed on the device where thin-edge.io is running as it needs access to the same filesystem.
- A service called
device-registration-server
Technical summary
The following details the technical aspects of the plugin to get an idea what systems it supports.
| Languages | golang |
| CPU Architectures | armv7/arm64/x86_64 (though it can be built for other architectures) |
| Supported init systems | systemd and init.d/open-rc |
| Required Dependencies | - |
| Optional Dependencies (feature specific) | - |
The following linux package formats are provided on the releases page and also in the tedge-community repository:
| Operating System | Repository link |
|---|---|
| Debian/Raspbian (deb) | |
| Alpine Linux (apk) | |
| RHEL/CentOS/Fedora (rpm) |
A child device can register itself to the service
Example
curl \
http://127.0.0.1:9000/register \
-X POST \
--data '{"name":"mychild","supportedOperations":["c8y_Firmware"]}' -H "Content-Type: application/json"Response: 201
{
"id": "tedge01_mychild",
"name": "mychild",
"parent": "tedge01",
}| Property | Description |
|---|---|
id |
Child device id that should be used in all communication with thin-edge.io |
name |
Local child device name. This will be the value that was sent by the child device whilst registering itself |
parent |
Id of the parent device (for reference only) |
The device-registration-service can be controlled by either environment variables or command line flags.
The following flags are supported.
--bind string
Bind address to which the http server should attach to. It listens on all adapters by default.
--config-dir string
thin-edge.io base configuration directory (default "/etc/tedge")
--device-id string
Use static device id instead of using the tedge cli
--port int
Port (default 9000)
--separator string
Device name separator (default "_")
--use-prefix
Prefix the child id with the main device id (default true)
--version
Show version informationAlternatively the values for the flags can be provided via environment variables. The mapping between the flags to environment variables is as follows:
| Flag | Env Variable |
|---|---|
--device-id |
REGISTRATION_DEVICE_ID |
--config-dir |
REGISTRATION_CONFIG_DIR |
--bind |
REGISTRATION_BIND |
--port |
REGISTRATION_PORT |
--separator |
REGISTRATION_SEPARATOR |
| `--use-prefix=<true | false>` |
You can build the project and all of the packages by using, though the command will fail if you have uncommitted changes.
just releaseIf you have uncommitted changes then you can build a snapshot with the following command:
just release-snapshotYou can start the project locally by running:
mkdir -p tmp/operations/c8y
go run main.go --use-prefix=false --device-id main001 --config-dir tmpThen send a request to the local service using curl.
curl http://127.0.0.1:9000/register \
-X POST \
--data '{"name":"mychild","supportedOperations":["c8y_Firmware"]}' -H "Content-Type: application/json"Example output:
{"name":"mychild","id":"mychild","parent":"main001"}