Important
This is the 2.0 development branch of NervesHubCLI. If you have been using NervesHub prior to around April, 2023 and are not following 2.0 development, see the maint-v0
branch. The maint-v0
branch is being used in production. 2.0 development is in progress, and we don't have guides or good documentation yet. If you use the 2.0 development branch, we don't expect breaking changes, but please bear with us as we complete the 2.0 release.
NervesHubCLI
provides a set of Mix tasks so
that you can work with NervesHub from the
command-line. Features include:
- Uploading firmware to NervesHub
- Generating device certificates and registration
- Managing device provisioning metadata
- Creating and managing firmware signing keys
- Manage firmware deployments
- Manage user and organization accounts
The recommended way of using the CLI is to include
nerves_hub_link
in your dependencies.
nerves_hub_link
pulls in nerves_hub_cli
and includes the target runtime
components necessary to use it.
Once installed, you can access available commands and documentation from the
command-line using mix help
:
$ mix help
...
mix nerves_hub.deployment # Manages NervesHub deployments
mix nerves_hub.device # Manages your NervesHub devices
mix nerves_hub.firmware # Manages firmware on NervesHub
mix nerves_hub.key # Manages your firmware signing keys
mix nerves_hub.product # Manages your products
mix nerves_hub.user # Manages your NervesHub user account
...
$ mix help nerves_hub.device
...
NervesHubCLI
may be configured using environment variables to simplify
automation. The following variables are available:
NERVES_HUB_TOKEN
(orNH_TOKEN
) - Token used to authenticate API requestsNERVES_HUB_CERT
- Certificate contents for authenticating with NervesHubNERVES_HUB_KEY
- The private key associated withNERVES_HUB_CERT
NERVES_HUB_ORG
- NervesHub organization to useNERVES_HUB_FW_PRIVATE_KEY
- Fwup signing private keyNERVES_HUB_FW_PUBLIC_KEY
- Fwup signing public keyNERVES_HUB_HOME
- NervesHub CLI data directory (defaults to~/.nerves-hub
)NERVES_HUB_HOST
- NervesHub API endpoint IP address or hostname (defaults toapi.nerves-hub.org
)NERVES_HUB_PORT
- NervesHub API endpoint port (defaults to 443)NERVES_HUB_NON_INTERACTIVE
- Force all yes/no user interaction to be yes
For more information on using the CLI, see the
nerves_hub_link
documentation.
NervesHubCLI can be directed to target other environments beside the public NervesHub instance. See the documentation for example config values to do this.