{"id":20077401,"url":"https://github.com/drogue-iot/drg","last_synced_at":"2026-03-14T21:32:57.532Z","repository":{"id":37904473,"uuid":"343774328","full_name":"drogue-iot/drg","owner":"drogue-iot","description":"A command line tool for managing apps and devices in Drogue IoT cloud","archived":false,"fork":false,"pushed_at":"2023-02-08T09:52:11.000Z","size":496,"stargazers_count":11,"open_issues_count":21,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-28T20:55:12.945Z","etag":null,"topics":["cli","drogue-cloud","iot"],"latest_commit_sha":null,"homepage":"https://drogue.io","language":"Rust","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/drogue-iot.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-02T12:55:26.000Z","updated_at":"2024-05-10T06:23:33.000Z","dependencies_parsed_at":"2023-02-16T08:01:00.725Z","dependency_job_id":null,"html_url":"https://github.com/drogue-iot/drg","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drogue-iot%2Fdrg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drogue-iot%2Fdrg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drogue-iot%2Fdrg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drogue-iot%2Fdrg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drogue-iot","download_url":"https://codeload.github.com/drogue-iot/drg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252586016,"owners_count":21772238,"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":["cli","drogue-cloud","iot"],"created_at":"2024-11-13T15:08:02.221Z","updated_at":"2026-03-14T21:32:52.487Z","avatar_url":"https://github.com/drogue-iot.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Release (latest SemVer)](https://img.shields.io/github/v/tag/drogue-iot/drg?sort=semver)](https://github.com/drogue-iot/drg/releases)\n[![Build](https://github.com/drogue-iot/drg/actions/workflows/build.yaml/badge.svg?branch=main)](https://github.com/drogue-iot/drg/actions/workflows/build.yaml)\n[![Matrix](https://img.shields.io/matrix/drogue-iot:matrix.org)](https://matrix.to/#/#drogue-iot:matrix.org)\n\n# drg : Drogue cloud command line tool\n\nA Command line tool for managing apps and devices in a drogue cloud instance. \n\n# Installation \n\n## Install from sources \n\nVia crates.io:\n\n    cargo install drg\n\n## Download a release\n\nDownload the latest release from the [github release page](https://github.com/drogue-iot/drg/releases) and place it somewhere in your `$PATH`.\n\nNote: Debian users must install the `libssl1.1` package.\n\n## Homebrew\n\n    brew tap drogue-iot/drg\n    brew install drg\n\n## Snap\n\n    sudo snap install drogue-cli\n    sudo snap alias drogue-cli drg\n\n# Usage\n\n## Log in to a drogue cloud instance\n\nIn order to use `drg` to manage resources in drogue cloud you first need to authenticate : \n    \n    drg login https://drogue-cloud-api-endpoint\n\nThen follow the steps to authenticate. drg will generate a config file to save your configuration.\n\nYou can also use a refresh token to authenticate, suitable when the browser can't be accessed:\n    \n    drg login https://drogue-cloud-api-endpoint --token \u003crefresh_token\u003e\n\n\n## Managing resources \n\n`drg` interacts with resources existing in drogue-cloud, currently `apps` and  `devices` operations are supported. \nThe following operations are handled :\n* create\n* delete\n* edit\n* get\n* list\n\n###  Create resources\n\n    # Create an app \n    drg create app \u003cappId\u003e\n    # adding data\n    drg create app \u003cappId\u003e -d `{\"foo\":\"bar\"}`\n    \n    # Create a device\n    drg create device \u003cdeviceId\u003e --app \u003cappId\u003e    # --app and -a are interchangeable\n    # Add some data\n    drg create device \u003cdeviceId\u003e -a \u003cappId\u003e -d `{\"foo\":\"bar\"}`\n    \n### Read resources\n\n    # Read an app\n    drg get appp \u003cappId\u003e\n    # Get a list of apps\n    drg get apps\n    \n    # Read a device\n    drg get device \u003cdeviceId\u003e --app \u003cappId\u003e\n    # Get a list of devices\n    drg get devices --app \u003cappId\u003e\n    \nNote: `list` support adding labels for filtering results:\n\n          # Get a list of devices (here all 3 labels will be applied.\n          drg get apps -l key=value,foo=bar --label fiz!=buz\n    \n### Edit and delete resources\n    \n    # edit an app - this will open an editor. \n    drg edit app \u003cappId\u003e\n    \n    # update an app providing the data\n    drg edit app \u003cappId\u003e -f \u003c/path/to/json\u003e\n    \n    # Edit a device data - this will open an editor\n    drg edit device \u003cdeviceId\u003e --app \u003cappId\u003e\n    \n    # update a device providing the data\n    drg edit device \u003cdeviceId\u003e -a \u003cappId\u003e -f \u003c/path/to/json\u003e\n    \n    # Delete an app \n    drg delete app \u003cappId\u003e\n    \n    # Delete a device \n    drg delete device \u003cdeviceId\u003e - \u003cappId\u003e\n    \n    # Quickly add a gateway, credentials or alias to a device\n    drg set gateway foo bar # set device bar as a gateway for device foo\n    drg set password foo verysecret --username johndoe #username is optional here\n    drg set alias foo waldo # Add waldo as an alias for device foo.\n\n### Send commands to devices\n\n    # Using the context default app\n    drg cmd \u003ccommand\u003e \u003cdeviceId\u003e\n    # Specifying the app and an opionnal payload\n    drg cmd \u003ccommand\u003e \u003cdeviceId\u003e -a myApp -p '{\"foo\":\"bar\"}'\n    # Reading the payload from a file \n    drg cmd \u003ccommand\u003e \u003cdeviceId\u003e -a myApp -f /path/to/json\n\n## Configuration file\n\n`drg` will load cluster settings from the default context of a configuration file. The `DRGCFG` environment variable can point to a config file location.\nThe default config file location is `$HOME/.config/drg_config.yaml`. This default value will be used if the environment variable is not set. \nThis location can be overriden with the `--config` argument : \n   \n    drg --config path/to/config create device \u003cdeviceId\u003e --app \u003cappId\u003e\n\nTo get a working config file, run see [login to a drogue cloud instance](#Log-in-to-a-drogue-cloud-instance)\n\n### Context management\n\nA valid configuration can contain multiple context allowing you to switch between cluster easily. \nTo create a new context simply log into a cluster with `drg login` : [login to a drogue cloud instance](#Log-in-to-a-drogue-cloud-instance)\nIf it's the first context created for this configuration file it will be set as active by default. \n\nTo update the active context for a config file : \n    \n    drg context set-active \u003ccontextId\u003e\n\nHere are some other commads available to manage contexts :\n\n    drg context show #will display the whole config file. \n    drg context list\n    drg context set-default-app \u003cappId\u003e #will use active context\n    drg context set-default-app \u003cappId\u003e --context \u003canotherContextId\u003e\n    drg context delete \u003ccontextId\u003e \n    drg context rename \u003ccontextId\u003e \u003cnewContextId\u003e\n\ncontext and app can be set with environment variables : `DRG_CONTEXT` and `DRG_APP`.\n\n### Trust-anchor management\n\nx.509 certificates can be used to authenticate devices in Drogue Cloud. To do this, the application object needs\nto contain a root CA certificate, and the intended user must have its private key. This cert+key pair is used to sign\ndevice cert+key pair.\n\n    drg create app-cert --application \u003cappId\u003e --key-output \u003cpath/to/app-private.key\u003e\n\nHere, `--key-output` is the output file for root CA private key, and it needs to be saved and stored securely.\n\nOnce Trust-anchor is set, we can use it to sign device certificates, for example:\n\n    drg create device-cert \u003cdeviceId\u003e --app \u003cappId\u003e --ca-key \u003capp-private-key\u003e --cert_output \u003cfilename\u003e --key-output \u003cfilename\u003e\n\nHere, `--ca-key` is the input file for root CA private key file.\n      `--cert_output` is the output file for device certificate.\n      `--key-output` is the output file for device private key.\n\nWhen a device certificate is signed, the common name of the certificate will be added for the device. so the certificate can be used for authentication. \n\nIf you know from the get go that you will use a certificate for a deviice you can create it with the `--cert flag:\n```\ndrg create device foo --cert\n```\nThis will create an alias : \"CN=\u003cdeviceId\u003e, O=Drogue IoT, OU=\u003cappId\u003e\" for the device. \n\n### Consume events from drogue-cloud\n\nYou can see the stream of events for a drogue-cloud application using :\n```\ndrg stream --app \u003cappId\u003e\n# or if you have a default application set in your context :\ndrg stream\n```\n\n### Admin\n\nYou can create and manage access tokens with the admin subcommand : \n```\ndrg create token \ndrg create token --description \"some text\"\ndrg get token \ndrg delete token \u003cprefix\u003e\n```\n\nDrg can also transfer apps ownership and manage apps members :\n```\ndrg create member \u003cuser\u003e --role reader --application \u003capp\u003e\ndrg get member\ndrg edit member\n\n#Transfer operations\ndrg transfer init \u003cnewOwnerUSername\u003e --application \u003cappId\u003e\ndrg transfer cancel\n# The new owner can accept the transfer :\ndrg transfer accept \u003capp\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrogue-iot%2Fdrg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrogue-iot%2Fdrg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrogue-iot%2Fdrg/lists"}