{"id":19772277,"url":"https://github.com/recordevolution/devicemanagementagent","last_synced_at":"2025-11-10T12:04:48.084Z","repository":{"id":122413303,"uuid":"314514906","full_name":"RecordEvolution/DeviceManagementAgent","owner":"RecordEvolution","description":"A daemon running on edge devices to establish a connection to the Reswarm router and manage apps and containers","archived":false,"fork":false,"pushed_at":"2024-08-19T09:29:00.000Z","size":1207,"stargazers_count":3,"open_issues_count":38,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-19T10:44:30.287Z","etag":null,"topics":["apps","container","device-management","iot","reswarm","wamp"],"latest_commit_sha":null,"homepage":"","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/RecordEvolution.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-20T10:04:59.000Z","updated_at":"2024-08-19T09:29:03.000Z","dependencies_parsed_at":"2023-07-10T04:48:30.806Z","dependency_job_id":"36ff818a-3e14-4735-b406-119cec999b2e","html_url":"https://github.com/RecordEvolution/DeviceManagementAgent","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RecordEvolution%2FDeviceManagementAgent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RecordEvolution%2FDeviceManagementAgent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RecordEvolution%2FDeviceManagementAgent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RecordEvolution%2FDeviceManagementAgent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RecordEvolution","download_url":"https://codeload.github.com/RecordEvolution/DeviceManagementAgent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224219688,"owners_count":17275477,"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":["apps","container","device-management","iot","reswarm","wamp"],"created_at":"2024-11-12T05:06:09.108Z","updated_at":"2025-11-10T12:04:48.078Z","avatar_url":"https://github.com/RecordEvolution.png","language":"Go","readme":"\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.ironflock.com/reswarm\"\u003e\n    \u003cimg\n      alt=\"reagent.svg\"\n      src=\"assets/reagent.svg\"\n      width=\"400\"\n    /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# REswarm Device Management AGENT\n\nThe _Reagent_ is a (lightweight) daemon running on IoT devices that provides\nan interface to manage containers on the device and to collect/request app logs.\nIn particular, the daemon enables the\n[IronFlock IoT Development Studio](https://www.ironflock.com/reswarm)\nto authenticate and securely connect to an IoT device in order to control apps\nrunning in containers on the device and retrieve their result and logs.\n\n## Overview\n\n- [REswarm Device Management AGENT](#reswarm-device-management-agent)\n  - [Overview](#overview)\n  - [Introduction](#introduction)\n  - [Usage](#usage)\n  - [Development](#development)\n  - [Build, Publish and Release](#build-publish-and-release)\n    - [Build (with Docker)](#build-with-docker)\n    - [Targets](#targets)\n    - [Target platform and architecture limitations](#target-platform-and-architecture-limitations)\n    - [Versioning](#versioning)\n    - [Publishing](#publishing)\n    - [Release](#release)\n    - [Rollout](#rollout)\n  - [Implementation](#implementation)\n    - [WAMP](#wamp)\n      - [References](#references)\n    - [Docker](#docker)\n\n## Introduction\n\n## Usage\n\nThe _Reagent_ is provided as a statically linked binary and accepts various\nCLI parameters to configure it when launched. To show a list of the parameters\nit accepts apply the help parameter `./reagent -help`\n\n```Shell\nUsage of ./reagent:\n  -agentDir string\n    \tdefault location of the agent binary (default \"/opt/reagent\", (linux), \"$HOME/reagent\", (other))\n  -appsDir string\n       default path for apps and app-data (default (default agentDir) + \"/apps\")\n  -arch\n       displays the architecture for which the binary was built\n  -compressedBuildExtension string\n       sets the extension in which the compressed build files will be provided (default \"tgz\")\n  -config string\n       reswarm configuration file\n  -connTimeout uint\n       Sets the connection timeout for the socket connection in milliseconds (0 means no timeout) (default 1250)\n  -dbFileName string\n       defines the name used to persist the database file (default \"reagent.db\")\n  -debug\n       sets the log level to debug (default true)\n  -debugMessaging\n    \tenables debug logs for messenging layer\n  -env string\n    \tdetermines in which environment the agent will operate. Possible values: (production, test, local) (default \"production\")\n  -logFile string\n       log file used by the reagent (default \"/var/log/reagent.log\" (linux), \"$HOME/reagent/reagent.log\" (other))\n  -nmw\n    \tenables the agent to use the NetworkManager API on Linux machines (default true)\n  -offline\n       starts the agent without establishing a socket connection. meant for debugging (default=false)\n  -ppTimeout uint\n       Sets the ping pong timeout of the client in milliseconds (0 means no timeout)\n  -prettyLogging\n       enables the pretty console writing, intended for debugging\n  -profiling\n       sets up a pprof webserver on the defined port\n  -profilingPort uint\n       port of the profiling service (default 80)\n  -remoteUpdateURL string\n    \tbucket to be used to download updates (default \"https://storage.googleapis.com\")\n  -respTimeout uint\n       Sets the response timeout of the client in milliseconds (default 5000)\n  -update\n       determines if the agent should update on start (default true)\n  -version\n       displays the current version of the agent\n```\n\nThe `config` parameter needs to be populated with the path to a local `.flock` file. This `.flock` file contains all the neccessary device configuration and authentication data required to run the agent.\n\nRead more on `.flock` files and how they work here: https://docs.ironflock.com/#/en/Reswarm/reflasher\n\n**Example Usage**\n```\n./reagent -config path/to/config.flock -prettyLogging\n```\n\n\n## Development\n\nThe agent embeds the frp client into the binary. For that to work locally you first have to download the frp client.\n\n```\nmake download_frpc\n```\n\nOnce Go has been [downloaded and installed](https://go.dev/doc/install), users can run the project locally by running the following command :\n\n```\nmake run\n\n# or on a mac\nmake run_mac\n\n```\n\nDuring development the `/opt/reagent` folder is used as the agent directory. There you can find additional config like the frpc.ini for the tunnel configuration.\nTo test with a local test device use the `test-config.flock` file when connecting to the local dev environment. A few things might need to be adjusted according to your environment.\nThe secret must be the one from the device's database record. Also use the insecure (ws instead of wss) endpoint and make sure the swarm_key and device_key are set.\n\nIf you encounter any privilege issues, please try removing the agent home directory beforehand (by default found in `${HOME}/reagent`) or try running `go` as root.\n\n## Build, Publish and Release\n\nUsing `go`'s built-in (cross-)compilation and some _shell_ scripts we can easily build, publish and release a binary for a lot of different architectures and operating systems.\n\n### Build (with Docker)\n\nIt is recommended to build the agent within Docker, to do so you can run `make build-all-docker` in the root of this project.\n\nWhile **not recommended** users can also build the Reagent on the host machine using the `make build-all` command.\n\nBoth commands make use of the [_targets_](#targets) file to determine the target platform(s) and architecture(s).\n\nOnce building has completed, the resulting binaries can be found within the `build/` directory at the root of this project.\n\n### Targets\n\nThe `targets` file, which can be found in the root of this project, determines which platforms and architectures the binary should be (cross-)compiled into.\n\nThe following platforms are set by default:\n```\nlinux/amd64\nlinux/arm64\nlinux/arm/7\nlinux/arm/6\nlinux/arm/5\nwindows/amd64\ndarwin/amd64\n```\n\nRun `go tool dist list` to see all possible combinations supported by `go` in case you wish to add your own.\n\n**NOTE: The Reagent only supports a limited amount of targets, please read more [here](#target-platform-and-architecture-limitations)**\n\n### Target platform and architecture limitations\n\nDue to this project using a [CGo-free port of SQLite/SQLite3](https://gitlab.com/cznic/sqlite), the Reagent can only be built into a [limited amount of target platforms and architectures](https://pkg.go.dev/modernc.org/sqlite?utm_source=godoc#hdr-Supported_platforms_and_architectures):\n\n```\nlinux/386\nlinux/amd64\nlinux/arm\nlinux/arm64\nlinux/riscv64\nwindows/amd64\nwindows/arm64\ndarwin/amd64\ndarwin/arm64\nfreebsd/amd64\n```\n\n### Versioning\n\nThe version that is baked into the binary on build is determined by the string provided in the `src/release/version.txt` file. Adjust this file accordingly **before** making a build.\n\nOnce built the version of a binary can be verified with:\n```\n./reagent -version\n```\n\n### Publishing\n\nOnce the Reagent has been built into the platform(s) and architecture(s) of your needs the binaries can then be published into our remote bucket.\n\nThe `make publish` command will publish all binaries that are found within the `build/` folder to our [re-agent](https://console.cloud.google.com/storage/browser/re-agent) gcloud bucket.\n\n### Release\n\nOnce the new binaries have been published they need to be made public for each _IronFlock_ environment (local, production and test cloud).\n\nTo update the latest available Reagent binary, the `availableVersions.json` must be updated and published.\n\nOnce updated, the file can be published using the `make publish-latestVersions` command.\n\n### Rollout\n\n**!!!!! USE WITH CAUTION !!!!!**\n\n`make rollout` can be used to build, publish the binary and publish the version files in one step.\n\nBefore doing so make sure the version files (`availableVersions.json`, `src/release/version.txt`) have been updated properly as explained in the [Versioning](#versioning) and [Release](#release) sections.\n\n\n## Implementation\n\nThe _Reagent_ makes use of [WAMP](https://wamp-proto.org)\nand [Docker](https://www.docker.com) as its two key technologies.\n\n### WAMP\n\n#### References\n\n- https://wamp-proto.org/_static/gen/wamp_latest.html\n- https://godoc.org/github.com/gammazero/nexus/client#ConnectNet\n- https://crossbar.io/docs/Challenge-Response-Authentication/\n\n- https://github.com/gammazero/nexus\n- https://github.com/gammazero/nexus/wiki\n- https://sourcegraph.com/github.com/gammazero/nexus@96d8c237ee8727b31fbebe0074d5cfec3f7b8a81/-/blob/aat/auth_test.go\n\n### Docker\n\nIn order to implement a _daemon_ running on an IoT device that is able to manage,\ncreate, stop and remove _Docker containers_ we use the officially supported _Go_\nSDK.\n\nPlease remember that on a default docker setup on a Linux platform we always\nhave to launch the daemon with root permissions, since the docker daemon is\naccessed via the socket `///var/run/docker.sock` which is only readable with\nroot permissions by default.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecordevolution%2Fdevicemanagementagent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frecordevolution%2Fdevicemanagementagent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecordevolution%2Fdevicemanagementagent/lists"}