Skip to content

Commit f17f96d

Browse files
doc: Document tti-lw-cli installation and usage
1 parent eb5e424 commit f17f96d

2 files changed

Lines changed: 139 additions & 6 deletions

File tree

doc/content/getting-started/cli/installing-cli/_index.md

Lines changed: 123 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,22 @@ This section contains instructions for installing the command-line interface.
1010

1111
### Package managers (recommended)
1212

13+
{{< tabs/container "Open Source" "Enterprise" >}}
14+
15+
{{< tabs/tab "Open Source" >}}
16+
1317
#### macOS
1418

1519
```bash
16-
$ brew install TheThingsNetwork/lorawan-stack/ttn-lw-stack
20+
$ brew install TheThingsNetwork/lorawan-stack/ttn-lw-cli
1721
```
1822

1923
{{< note >}} When installing with `brew`, auto completion is enabled automatically. {{</ note >}}
2024

2125
To upgrade the CLI if it is already installed, use:
2226

2327
```bash
24-
$ brew upgrade TheThingsNetwork/lorawan-stack/ttn-lw-stack
28+
$ brew upgrade TheThingsNetwork/lorawan-stack/ttn-lw-cli
2529
```
2630

2731
#### Linux
@@ -43,6 +47,43 @@ $ sudo snap refresh ttn-lw-stack
4347

4448
You can download [pre-built binaries](https://github.com/TheThingsNetwork/lorawan-stack/releases) for your operating system and processor architecture.
4549

50+
{{< /tabs/tab >}}
51+
52+
{{< tabs/tab "Enterprise" >}}
53+
54+
#### macOS
55+
56+
```bash
57+
$ brew install TheThingsIndustries/lorawan-stack/tti-lw-cli
58+
```
59+
60+
{{< note >}} When installing with `brew`, auto completion is enabled automatically. {{</ note >}}
61+
62+
To upgrade the CLI if it is already installed, use:
63+
64+
```bash
65+
$ brew upgrade TheThingsIndustries/lorawan-stack/tti-lw-cli
66+
```
67+
68+
#### Linux
69+
70+
```bash
71+
$ sudo snap install tti-lw-stack
72+
$ sudo snap alias tti-lw-stack.tti-lw-cli tti-lw-cli
73+
```
74+
75+
{{< note >}} When installing with `snap`, auto completion is enabled automatically. {{</ note >}}
76+
77+
To upgrade the CLI if it is already installed, use:
78+
79+
```bash
80+
$ sudo snap refresh tti-lw-stack
81+
```
82+
83+
{{< /tabs/tab >}}
84+
85+
{{< /tabs/container >}}
86+
4687
## Configuration
4788

4889
The command-line needs to be configured to connect to {{% tts %}}. You have multiple options to make the configuration file available to the CLI:
@@ -53,12 +94,18 @@ The command-line needs to be configured to connect to {{% tts %}}. You have mult
5394

5495
{{< warning >}} When using the snap packages, `~/.ttn-lw-cli.yml` will fail with permission errors. Choose a different path. {{</ warning >}}
5596

97+
{{< note >}} The default configuration file for both Open Source and Enterprise versions of the CLI is named `.ttn-lw-cli.yml`. {{</ note >}}
98+
5699
### Generate configuration file
57100

58101
If using {{% tts %}} Community Edition by The Things Network or {{% tts %}} Cloud, visit the addresses page for [The Things Network]({{< ref "getting-started/ttn/addresses" >}}) or [{{% tts %}} Cloud]({{< ref "getting-started/cloud-hosted/addresses" >}}) to find CLI configuration files for these deployments.
59102

60103
If hosting your own deployment, for example at `thethings.example.com`, all you need is:
61104

105+
{{< tabs/container "Open Source" "Enterprise" >}}
106+
107+
{{< tabs/tab "Open Source" >}}
108+
62109
```bash
63110
$ ttn-lw-cli use thethings.example.com [--fetch-ca] [--user] [--overwrite]
64111
```
@@ -68,14 +115,32 @@ $ ttn-lw-cli use thethings.example.com [--fetch-ca] [--user] [--overwrite]
68115

69116
{{< note >}} On Windows, use `ttn-lw-cli.exe` instead of `ttn-lw-cli`. {{</ note >}}
70117

118+
{{< /tabs/tab >}}
119+
120+
{{< tabs/tab "Enterprise" >}}
121+
122+
```bash
123+
$ tti-lw-cli use thethings.example.com [--fetch-ca] [--user] [--overwrite]
124+
```
125+
126+
{{< note >}} On Windows, use `tti-lw-cli.exe` instead of `tti-lw-cli`. {{</ note >}}
127+
128+
{{< /tabs/tab >}}
129+
130+
{{< /tabs/container >}}
131+
71132
This will generate and save the required CLI config file. By default, the file is saved on the current directory, use the `--user` to save it under the user config directory.
72133

73134
If the deployment is using a CA that is not already trusted by your system, use the `--fetch-ca` flag to also connect to the server and retrieve the CA required for establishing secure communication.
74135

75-
{{< note >}} If the file exists already, it is not overwritten and an error is printed instead. You can use `--overwrite` to overwrite the existing configuration file. {{</ note >}}
136+
If the file exists already, it is not overwritten and an error is printed instead. You can use `--overwrite` to overwrite the existing configuration file.
76137

77138
{{< note >}} You can also use the `--grpc-port` and `--oauth-server-address` flags to override the default values for the gRPC port and the OAuth server address. These are not needed for standard deployments. {{</ note >}}
78139

140+
{{< note >}} If you are using an `https` port other than `443` (for example if you are running {{% tts %}} on localhost), you need to specify the OAuth server address by appending the `--oauth-server-address="https://localhost:8885/oauth"` flag when running the CLI.
141+
142+
If you are using a [custom certificate authority]({{< ref "/getting-started/installation/certificates#custom-certificate-authority" >}}), you will have to specify the `--ca="/path/to/ca.pem"` flag when running the CLI. {{</ note >}}
143+
79144
### Manually create configuration file
80145

81146
If using The Things Network or {{% tts %}} Cloud, visit the addresses page for [The Things Network]({{< ref "getting-started/ttn/addresses" >}}) or [{{% tts %}} Cloud]({{< ref "getting-started/cloud-hosted/addresses" >}}) to find CLI configuration files for these deployments.
@@ -95,16 +160,28 @@ device-template-converter-grpc-address: 'thethings.example.com:8884'
95160
qr-code-generator-grpc-address: 'thethings.example.com:8884'
96161
```
97162
163+
{{< tabs/container "Open Source" "Enterprise" >}}
164+
165+
{{< tabs/tab "Open Source" >}}
166+
98167
{{< warning >}} If configuring `ttn-lw-cli` for {{% tts %}} Cloud, see [Cloud Addresses]({{< ref "getting-started/cloud-hosted/addresses" >}}) for information about endpoints.
99168
{{</ warning >}}
100169

101-
If you are using an `https` port other than `443`, you need to specify that port, e.g.:
170+
{{< /tabs/tab >}}
171+
172+
{{< tabs/tab "Enterprise" >}}
173+
174+
{{< /tabs/tab >}}
175+
176+
{{< /tabs/container >}}
177+
178+
If you are using an `https` port other than `443` (for example if running {{% tts %}} on localhost), you need to specify that port, e.g.:
102179

103180
```yaml
104181
oauth-server-address: 'https://thethings.example:8885/oauth'
105182
```
106183

107-
If your deployment uses a custom certificate authority, you'll need to add:
184+
If your deployment uses a custom certificate authority, you will need to add the following line in the configuration file:
108185

109186
```yaml
110187
ca: /path/to/ca.pem
@@ -116,6 +193,10 @@ For advanced options, see the [Configuration Reference]({{< ref "/reference/conf
116193

117194
Auto completion allows the shell to [automatically fill in commands](https://en.wikipedia.org/wiki/Command-line_completion) after you type the first few letters. It is completely optional but can save you time entering commands.
118195

196+
{{< tabs/container "Open Source" "Enterprise" >}}
197+
198+
{{< tabs/tab "Open Source" >}}
199+
119200
Use `ttn-lw-cli complete` to generate an auto completion script for the `ttn-lw-cli` command. `bash`, `zsh`, `fish` and `powershell` shells are supported:
120201

121202
```bash
@@ -128,7 +209,7 @@ Source the file to enable auto completion:
128209
$ . ./ttn-lw-cli-autocomplete
129210
```
130211

131-
Alternatively, put in a default directory so that it is loaded automatically (This directory depends on your Operating System and your shell).
212+
Alternatively, put in a default directory so that it is loaded automatically (this directory depends on your Operating System and your shell).
132213

133214
For `bash`, this directory is typically `/etc/bash_completion.d/`:
134215

@@ -143,3 +224,39 @@ $ ttn-lw-cli.exe complete --shell powershell --executable ttn-lw-cli.exe > ttn-l
143224
144225
$ . ./ttn-lw-cli-autocomplete.ps1
145226
```
227+
228+
{{< /tabs/tab >}}
229+
230+
{{< tabs/tab "Enterprise" >}}
231+
232+
Use `tti-lw-cli complete` to generate an auto completion script for the `tti-lw-cli` command. `bash`, `zsh`, `fish` and `powershell` shells are supported:
233+
234+
```bash
235+
$ tti-lw-cli complete --shell bash --executable tti-lw-cli > tti-lw-cli-autocomplete
236+
```
237+
238+
Source the file to enable auto completion:
239+
240+
```bash
241+
$ . ./tti-lw-cli-autocomplete
242+
```
243+
244+
Alternatively, put in a default directory so that it is loaded automatically (this directory depends on your Operating System and your shell).
245+
246+
For `bash`, this directory is typically `/etc/bash_completion.d/`:
247+
248+
```bash
249+
$ sudo cp ./tti-lw-cli-autocomplete /etc/bash_completion.d/
250+
```
251+
252+
Generating and sourcing an auto completion PowerShell script on Windows is slightly modified:
253+
254+
```bash
255+
$ tti-lw-cli.exe complete --shell powershell --executable tti-lw-cli.exe > tti-lw-cli-autocomplete.ps1
256+
257+
$ . ./tti-lw-cli-autocomplete.ps1
258+
```
259+
260+
{{< /tabs/tab >}}
261+
262+
{{< /tabs/container >}}

doc/content/getting-started/cli/login/_index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,26 @@ This section explains how to login to {{% tts %}} using the command-line interfa
1010

1111
The CLI needs to be logged on in order to create gateways, applications, devices and API keys. With {{% tts %}} running, login with the following command:
1212

13+
{{< tabs/container "Open Source" "Enterprise" >}}
14+
15+
{{< tabs/tab "Open Source" >}}
16+
1317
```bash
1418
$ ttn-lw-cli login
1519
```
1620

21+
{{< /tabs/tab >}}
22+
23+
{{< tabs/tab "Enterprise" >}}
24+
25+
```bash
26+
$ tti-lw-cli login
27+
```
28+
29+
{{< /tabs/tab >}}
30+
31+
{{< /tabs/container >}}
32+
1733
This will open a browser window with the OAuth login page where you can login with your credentials. This is also where you can create a new account if you do not already have one.
1834

1935
{{< note >}} During the login procedure, the CLI starts a webserver on `localhost` in order to receive the OAuth callback after login. If you are running the CLI on a machine that is not `localhost`, you can pass the `--callback=false` flag. This will allow you to perform part of the OAuth flow on a different machine, and copy-paste a code back into the CLI. {{</ note >}}

0 commit comments

Comments
 (0)