{"id":19108085,"url":"https://github.com/balena-io-experimental/edge-node-manager","last_synced_at":"2025-04-30T19:00:19.097Z","repository":{"id":49916297,"uuid":"65510883","full_name":"balena-io-experimental/edge-node-manager","owner":"balena-io-experimental","description":"Resin uC edge-node-manager written in Go","archived":false,"fork":false,"pushed_at":"2021-07-05T13:55:06.000Z","size":7757,"stargazers_count":22,"open_issues_count":23,"forks_count":6,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-19T08:10:35.328Z","etag":null,"topics":["bluetooth-low-energy","dependent-devices","dfu","gateway","micro","microcontroller","ota","resin"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/balena-io-experimental.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-12T00:37:33.000Z","updated_at":"2024-04-22T22:09:02.000Z","dependencies_parsed_at":"2022-08-29T17:51:02.203Z","dependency_job_id":null,"html_url":"https://github.com/balena-io-experimental/edge-node-manager","commit_stats":null,"previous_names":["balenalabs-incubator/edge-node-manager","resin-io/edge-node-manager"],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balena-io-experimental%2Fedge-node-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balena-io-experimental%2Fedge-node-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balena-io-experimental%2Fedge-node-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balena-io-experimental%2Fedge-node-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/balena-io-experimental","download_url":"https://codeload.github.com/balena-io-experimental/edge-node-manager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251767210,"owners_count":21640467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bluetooth-low-energy","dependent-devices","dfu","gateway","micro","microcontroller","ota","resin"],"created_at":"2024-11-09T04:15:00.678Z","updated_at":"2025-04-30T19:00:19.069Z","avatar_url":"https://github.com/balena-io-experimental.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# edge-node-manager\n[![Go Report Card](https://goreportcard.com/badge/github.com/resin-io/edge-node-manager)](https://goreportcard.com/report/github.com/resin-io/edge-node-manager)\n[![Build Status](https://travis-ci.com/resin-io/edge-node-manager.svg?token=SsmNYChpKvn5yEXMkM2D\u0026branch=master)](https://travis-ci.com/resin-io/edge-node-manager)\n\nresin.io dependent device edge-node-manager written in Go.\n\n## Getting started\n - Sign up on [resin.io](https://dashboard.resin.io/signup)\n - Work through the [getting started\n   guide](https://docs.resin.io/raspberrypi3/nodejs/getting-started/)\n - Create a new application\n - Set these variables in the `Fleet Configuration` application side tab\n    - `RESIN_SUPERVISOR_DELTA=1`\n    - `RESIN_UI_ENABLE_DEPENDENT_APPLICATIONS=1`\n - Clone this repository to your local workspace\n - Add the dependent application `resin remote` to your local workspace\n - Provision a gateway device\n - Push code to resin as normal :)\n - Follow the readme of the [supported dependent\n   device](#supported-dependent-devices) you would like to use\n\n## Configuration variables\nMore info about environment variables can be found in\nthe [documentation](https://docs.resin.io/management/env-vars/). If you\ndon't set environment variables the default will be used.\n\nEnvironment Variable | Default | Description\n------------ | ------------- | -------------\nENM_LOG_LEVEL | `info` | the edge-node-manager log level\nDEPENDENT_LOG_LEVEL | `info` | the dependent device log level\nENM_SUPERVISOR_CHECK_DELAY | `1` | the time delay in seconds between each supervisor check at startup\nENM_HOTSPOT_DELETE_DELAY | `10` | the time delay in seconds between hotspot deletion and creation\nENM_CONFIG_LOOP_DELAY | `10` | the time delay in seconds between each application process loop\nENM_CONFIG_PAUSE_DELAY | `10` | the time delay in seconds between each pause check\nENM_HOTSPOT_SSID | `resin-hotspot` | the SSID used for the hotspot\nENM_HOTSPOT_PASSWORD | `resin-hotspot` | the password used for the hotspot\nENM_BLUETOOTH_SHORT_TIMEOUT | `1` | the timeout in seconds for instantaneous bluetooth operations\nENM_BLUETOOTH_LONG_TIMEOUT | `10` | the timeout in seconds for long running bluetooth operations\nENM_AVAHI_TIMEOUT | `10` | the timeout in seconds for Avahi scan operations\nENM_UPDATE_RETRIES | `1` | the number of times the firmware update process should be retried\nENM_ASSETS_DIRECTORY | `/data/assets` | the root directory used to store the dependent device firmware\nENM_DB_DIRECTORY | `/data/database` | the root directory used to store the database\nENM_DB_FILE | `enm.db` | the database file name\nENM_API_VERSION | `v1` | the proxyvisor API version\nRESIN_SUPERVISOR_ADDRESS | `http://127.0.0.1:4000` | the address used to communicate with the proxyvisor\nRESIN_SUPERVISOR_API_KEY | `na` | the api key used to communicate with the proxyvisor\nENM_LOCK_FILE_LOCATION | `/tmp/resin/resin-updates.lock` | the [lock file](https://github.com/resin-io/resin-supervisor/blob/master/docs/update-locking.md) location\n\n## API\nThe edge-node-manager provides an API that allows the user to set the\ntarget status of the main process. This is useful to free up the on-board radios\nallowing user code to interact directly with the dependent devices e.g. to\ncollect sensor data.\n\n**Warning** - Do not try and interact with the on-board radios whilst the\nedge-node-manager is running (this leads to inconsistent, unexpected behaviour).\n\n### SET /v1/enm/status\nSet the edge-node-manager process status.\n\n#### Example\n```\ncurl -i -H \"Content-Type: application/json\" -X PUT --data \\\n'{\"targetStatus\":\"Paused\"}' localhost:1337/v1/enm/status\n\ncurl -i -H \"Content-Type: application/json\" -X PUT --data \\\n'{\"targetStatus\":\"Running\"}' localhost:1337/v1/enm/status\n```\n\n#### Response\n```\nHTTP/1.1 200 OK\n```\n\n### GET /v1/enm/status\nGet the edge-node-manager process status.\n\n#### Example\n```\ncurl -i -X GET localhost:1337/v1/enm/status\n```\n\n#### Response\n```\nHTTP/1.1 200 OK\n{\n    \"currentStatus\":\"Running\",\n    \"targetStatus\":\"Paused\",\n}\n```\n\n### GET /v1/devices\nGet all dependent devices.\n\n#### Example\n```\ncurl -i -X GET localhost:1337/v1/devices\n```\n\n#### Response\n```\nHTTP/1.1 200 OK\n[{\n\t\"ApplicationUUID\": 511898,\n\t\"BoardType\": \"esp8266\",\n\t\"Name\": \"holy-sunset\",\n\t\"LocalUUID\": \"1265892\",\n\t\"ResinUUID\": \"64a1ae375b213d7e5af8409da3ad63108df4c8462089a05aa9af358c3f0df1\",\n\t\"Commit\": \"16b5cd4df8085d2872a6f6fc0c378629a185d78b\",\n\t\"TargetCommit\": \"16b5cd4df8085d2872a6f6fc0c378629a185d78b\",\n\t\"Status\": \"Idle\",\n\t\"Config\": null,\n\t\"TargetConfig\": {\n\t\t\"RESIN_HOST_TYPE\": \"esp8266\",\n\t\t\"RESIN_SUPERVISOR_DELTA\": \"1\"\n\t},\n\t\"Environment\": null,\n\t\"TargetEnvironment\": {},\n\t\"RestartFlag\": false,\n\t\"DeleteFlag\": false\n}]\n```\n\n### GET /v1/devices/{uuid}\nGet a dependent device.\n\n#### Example\n```\ncurl -i -X GET localhost:1337/v1/devices/1265892\n```\n\n#### Response\n```\nHTTP/1.1 200 OK\n{\n\t\"ApplicationUUID\": 511898,\n\t\"BoardType\": \"esp8266\",\n\t\"Name\": \"holy-sunset\",\n\t\"LocalUUID\": \"1265892\",\n\t\"ResinUUID\": \"64a1ae375b213d7e5af8409da3ad63108df4c8462089a05aa9af358c3f0df1\",\n\t\"Commit\": \"16b5cd4df8085d2872a6f6fc0c378629a185d78b\",\n\t\"TargetCommit\": \"16b5cd4df8085d2872a6f6fc0c378629a185d78b\",\n\t\"Status\": \"Idle\",\n\t\"Config\": null,\n\t\"TargetConfig\": {\n\t\t\"RESIN_HOST_TYPE\": \"esp8266\",\n\t\t\"RESIN_SUPERVISOR_DELTA\": \"1\"\n\t},\n\t\"Environment\": null,\n\t\"TargetEnvironment\": {},\n\t\"RestartFlag\": false,\n\t\"DeleteFlag\": false\n}\n```\n\n## Supported dependent devices\n- [micro:bit](https://github.com/resin-io-projects/micro-bit)\n- [nRF51822-DK](https://github.com/resin-io-projects/nRF51822-DK)\n- [ESP8266](https://github.com/resin-io-projects/esp8266)\n\n## Further reading\n### About\nThe edge-node-manager is an example of a gateway\napplication designed to bridge the gap between Resin OS capable single board\ncomputers (e.g. the Raspberry Pi) and non Resin OS capable devices (e.g.\nmicro-controllers). It has been designed to make it as easy as possible to add\nnew supported dependent device types and to run alongside your user application.\n\nThe following functionality is implemented:\n - Dependent device detection\n - Dependent device provisioning\n - Dependent device restart\n - Dependent device over-the-air (OTA) updating\n - Dependent device logging and information updating\n - API\n\n### Definitions\n#### Dependent application\nA dependent application is a Resin application that targets devices not capable\nof interacting directly with the Resin API.\n\nThe dependent application is scoped under a Resin application, which gets the\ndefinition of gateway application.\n\nA dependent application follows the same development cycle as a conventional\nResin application:\n - It binds to your git workspace via the `resin remote`\n - It consists of a Docker application\n - It offers the same environment and configuration variables management\n\nThere are some key differences:\n - It does not support Dockerfile templating\n - The Dockerfile must target an x86 base image\n - The actual firmware must be stored in the `/assets` folder within the built\n   docker image\n\n#### Dependent device\nA dependent device is a device not capable of interacting directly with the\nResin API - the reasons can be several, the most common are:\n - No direct Internet capabilities\n - Not able to run the Resin OS (being a microcontroller, for example)\n\n#### Gateway application\nThe gateway application is responsible for detecting, provisioning and managing\ndependent devices belonging to one of its dependent applications. This is\npossible leveraging a new set of endpoints exposed by the [Resin\nSupervisor](https://github.com/resin-io/resin-supervisor).\n\nThe edge-node-manager (this repository) is an example of a gateway application.\n\n#### Gateway device\nThe gateway device runs the gateway application and has the needed on-board\nradios to communicate with the managed dependent devices, for example:\n - Bluetooth\n - WiFi\n - LoRa\n - ZigBee\n\nThroughout development a Raspberry Pi 3 has been used as the gateway device.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalena-io-experimental%2Fedge-node-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbalena-io-experimental%2Fedge-node-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalena-io-experimental%2Fedge-node-manager/lists"}