The recommended CLI tool for working with NervesHub and NervesCloud 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
brew install nerves-hub/tap/nh
curl --proto '=https' --tlsv1.2 -fsSL https://raw.githubusercontent.com/nerves-hub/nerves_hub_cli/master/install.sh | sh
This installs the nh
binary to /usr/local/bin
.
Note
It's best practice to read any installation scripts before running them
If you are using a Mac and your get an error message that the binary isn't trusted, please follow these steps:
- Open the System Settings.
- Click on the "Privacy & Security" icon.
- Scroll down to the "Security" section.
- Click open next to the warning about the
nh
executable. - Click on the "Open Anyway" button in the warning dialog.
- Run the
nh
command again.
For more information, see the Apple Support article.
The CLI is a compiled binary that can be downloaded from the releases page.
Once downloaded you can run the binary directly, although we recommend adding it to your PATH
so
that it's accessible across terminal sessions.
You can access available commands and documentation from the command-line using nh help
. eg.
$ nh help
$ nh help device
Burritos magic is how it creates a platform specific Erlang release, compresses it into a binary, which is then extracted to a directory managed by Burrito when the binary is executed for the first time.
Subsquent use of the binary will proxy the commands to the extracted release, invisible to the user.
NervesHubCLI must be configured to connect to your chosen NervesHub host.
To configure the NervesHub URI, run:
$ nh config set uri "https://my.nerveshub.instance/"
and for NervesCloud:
$ nh config set uri "https://manage.nervescloud.com/"
Finally, you need to authorize your account on the NervesHub instance by running:
$ nh user whoami
$ nh user auth
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_URI
- NervesHub API host, port, scheme (all in one)NERVES_HUB_HOST
- NervesHub API endpoint IP address or hostnameNERVES_HUB_PORT
- NervesHub API endpoint portNERVES_HUB_SCHEME
- NervesHub API endpoint schemeNERVES_HUB_NON_INTERACTIVE
- Force all yes/no user interaction to be yes
When you uninstall the NervesHubCLI it is highly recommended to run:
$ nh maintenance uninstall
which tells Burrito to remove the cached contents.
Once you have run the above command you can safely delete the nh
binary.