Skip to content

Commit 2eac06a

Browse files
Merge pull request #3129 from wesleymccloy/wesleymccloy/device-cmds-rename
patch: update to `balena device <subcommand>`
2 parents 1295c4d + 8d15415 commit 2eac06a

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

pages/learn/develop/local-mode.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ To use local mode on a device:
3030

3131
## Scan the network and find your device
3232

33-
Before you can get your app running on your device in local mode, you have to find your device. You can find the `short-uuid` and local IP address of the device from the device dashboard or by scanning the network. To perform a scan, login to the {{ $names.company.lower }} CLI and use `{{ $names.company.short }} scan` to find any local {{ $names.os.lower }} devices. All {{ $names.os.lower }} devices advertise themselves on the network using [Avahi][avahi]. The names take the form `<short-uuid>.local`, where the `short-uuid` is the UUID you see on your device dashboard.
33+
Before you can get your app running on your device in local mode, you have to find your device. You can find the `short-uuid` and local IP address of the device from the device dashboard or by scanning the network. To perform a scan, login to the {{ $names.company.lower }} CLI and use `{{ $names.company.short }} device detect` to find any local {{ $names.os.lower }} devices. All {{ $names.os.lower }} devices advertise themselves on the network using [Avahi][avahi]. The names take the form `<short-uuid>.local`, where the `short-uuid` is the UUID you see on your device dashboard.
3434

35-
__Note:__ You may need administrator privileges to run `{{ $names.company.short }} scan` as it requires access to all network interfaces.
35+
__Note:__ You may need administrator privileges to run `{{ $names.company.short }} device detect` as it requires access to all network interfaces.
3636

3737
**Command**
3838

3939
```bash
40-
sudo {{ $names.company.short }} scan
40+
sudo {{ $names.company.short }} device detect
4141
```
4242

4343
**Output**
@@ -66,7 +66,7 @@ Reporting scan results
6666

6767
## Push over a new project
6868

69-
When local mode has been activated, {{ $names.company.lower }} CLI can push code directly to the local device instead of going via the {{ $names.cloud.lower }} builders. As code is built on the device and then executed, this can significantly speed up development when requiring frequent changes. To do this, we use the `{{ $names.company.lower }} push` command providing either the local IP address or `<short-uuid>.local`, obtained from the preceding `{{ $names.company.short }} scan` command.
69+
When local mode has been activated, {{ $names.company.lower }} CLI can push code directly to the local device instead of going via the {{ $names.cloud.lower }} builders. As code is built on the device and then executed, this can significantly speed up development when requiring frequent changes. To do this, we use the `{{ $names.company.lower }} push` command providing either the local IP address or `<short-uuid>.local`, obtained from the preceding `{{ $names.company.short }} device detect` command.
7070

7171
__Note:__ By default `{{ $names.company.short }} push` will build from the current working directory, but it is also possible to specify the project directory via the `--source` option.
7272

@@ -167,48 +167,48 @@ By default, when pushing code to a device in local mode using the {{ $names.comp
167167
{{ $names.company.short }} push 63ec46c.local --detached
168168
```
169169

170-
When detached, the services continue to run on the device, and you can access the logs using the `{{ $names.company.short }} logs` command, again passing the local IP address or `<short-uuid>.local`.
170+
When detached, the services continue to run on the device, and you can access the logs using the `{{ $names.company.short }} device logs` command, again passing the local IP address or `<short-uuid>.local`.
171171

172172
```shell
173-
{{ $names.company.short }} logs 63ec46c.local
173+
{{ $names.company.short }} device logs 63ec46c.local
174174
```
175175

176176
This command will output logs for the system and all running services. You may optionally filter the output to include only system or specific service logs using the available `--system` (`-S`) and `--service` (`-s`) options. For example, to output only the system logs:
177177

178178
```bash
179-
{{ $names.company.short }} logs 63ec46c.local --system
179+
{{ $names.company.short }} device logs 63ec46c.local --system
180180
```
181181

182182
To filter logs by a service, use the `--service` option. You may specify this option multiple times to output logs from multiple services.
183183

184184
```bash
185-
{{ $names.company.short }} logs 63ec46c.local --service main
186-
{{ $names.company.short }} logs 63ec46c.local --service first --service second
185+
{{ $names.company.short }} device logs 63ec46c.local --service main
186+
{{ $names.company.short }} device logs 63ec46c.local --service first --service second
187187
```
188188

189189
These options can be combined to output system and selected service logs e.g.
190190

191191
```bash
192-
{{ $names.company.short }} logs 827b231.local --system --service first --service second
192+
{{ $names.company.short }} device logs 827b231.local --system --service first --service second
193193
```
194194

195195
__Note:__ You may also specify the `--service` and `--system` options using the `{{ $names.company.short }} push` command to filter the log output.
196196

197197
## SSH into the running app container or host OS
198198

199-
To access the local device over [SSH][ssh], use the `{{ $names.company.short }} ssh` command specifying the device IP address or `<short-uuid>.local`. By default, SSH access is routed into the host OS shell and, from there, we can check system logs and [perform other troubleshooting tasks][troubleshooting]:
199+
To access the local device over [SSH][ssh], use the `{{ $names.company.short }} device ssh` command specifying the device IP address or `<short-uuid>.local`. By default, SSH access is routed into the host OS shell and, from there, we can check system logs and [perform other troubleshooting tasks][troubleshooting]:
200200

201201
```bash
202-
{{ $names.company.short }} ssh 192.168.86.45
202+
{{ $names.company.short }} device ssh 192.168.86.45
203203
```
204204

205205
To connect to a container, we can specify the service name e.g.
206206

207207
```bash
208-
sudo {{ $names.company.short }} ssh 63ec46c.local my-service
208+
sudo {{ $names.company.short }} device ssh 63ec46c.local my-service
209209
```
210210

211-
__Note:__ If an IP address or a `.local` hostname is used (instead of a fleet name or device UUID), `{{ $names.company.short }} ssh` establishes a direct connection to the device on port `22222` that does not rely on cloudlink.
211+
__Note:__ If an IP address or a `.local` hostname is used (instead of a fleet name or device UUID), `{{ $names.company.short }} device ssh` establishes a direct connection to the device on port `22222` that does not rely on cloudlink.
212212

213213
## Using a Private Docker Registry
214214

shared/general/container-ssh.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,31 @@ A terminal session should be initiated for you in a second or two. If you would
1414

1515
__Note:__ To copy and paste in the terminal window, you cannot use the normal Ctrl + C and Ctrl + V shortcuts. You can either select Copy and Paste from a menu, or use Ctrl + Insert for copy and Shift + Insert for Paste. For MacOS users, ⌘ + C and ⌘ + V work as expected.
1616

17-
## Using `{{ $names.company.short }} ssh` from the CLI
17+
## Using `{{ $names.company.short }} device ssh` from the CLI
1818

1919
To use the CLI, first [install it][cli-install] and [add an SSH key to {{ $names.cloud.lower }}][add-ssh-key]. Then run the following command on your development machine's terminal:
2020

2121
```shell
22-
$ {{ $names.company.short }} ssh <device-uuid>
22+
$ {{ $names.company.short }} device ssh <device-uuid>
2323
```
2424

25-
`<device-uuid>` is the unique identifier for the device you want to access, which can be found via the dashboard or in the output of the `{{ $names.company.short }} devices` CLI command. By default, SSH access is routed into the host OS shell. However, you can SSH into a service by specifying its name as part of the command:
25+
`<device-uuid>` is the unique identifier for the device you want to access, which can be found via the dashboard or in the output of the `{{ $names.company.short }} device list` CLI command. By default, SSH access is routed into the host OS shell. However, you can SSH into a service by specifying its name as part of the command:
2626

2727
```shell
28-
$ {{ $names.company.short }} ssh <device-uuid> main
28+
$ {{ $names.company.short }} device ssh <device-uuid> main
2929
```
3030

3131
This also works in multicontainer fleets; simply pass the name of the appropriate service (as defined in docker-compose.yml) instead of `main`.
3232

33-
__Note:__ To run a command in a non-interactive way, you can pipe commands to the CLI's stdin. For example, `echo "uptime; exit;" | balena ssh <device-uuid>`.
33+
__Note:__ To run a command in a non-interactive way, you can pipe commands to the CLI's stdin. For example, `echo "uptime; exit;" | balena device ssh <device-uuid>`.
3434

3535
When a fleet name or device UUID is used as above, `{{ $names.company.short }}` ssh uses Cloudlink to create a secure tunnel to the device and then forward SSH traffic between the device and your development machine.
3636

3737
If an IP address or a .local hostname is used (instead of a fleet name or device UUID), `{{ $names.company.short }}` ssh establishes a direct connection that does not rely on Cloudlink:
3838

3939
```shell
40-
$ balena ssh 192.168.1.23
41-
$ balena ssh <device-uuid>.local
40+
$ balena device ssh 192.168.1.23
41+
$ balena device ssh <device-uuid>.local
4242
```
4343

4444
When used with a [production variant of {{ $names.os.lower }}][development-image], this
@@ -70,19 +70,19 @@ Development variants of {{ $names.os.lower }} allow unauthenticated access and s
7070
directly exposed to the public internet.
7171

7272
The IP address will typically be a private IP address of a local network. For remote devices,
73-
see [{{ $names.company.short }} tunnel][balena-tunnel].
73+
see [{{ $names.company.short }} device tunnel][balena-tunnel].
7474

75-
## {{ $names.company.short }} tunnel
75+
## {{ $names.company.short }} device tunnel
7676

7777
The SSH server of a {{ $names.os.lower }} device (host OS) listens on TCP port `22222`.
7878
This port is not blocked by any firewall on the device itself, but external firewalls or NAT
7979
routers will often block access at the network level. To get around this, you can use the
80-
`{{$names.company.short }} tunnel` command of the {{ $names.cli.lower }}, which tunnels a
80+
`{{$names.company.short }} device tunnel` command of the {{ $names.cli.lower }}, which tunnels a
8181
TCP connection between a localhost port and a port on the device. For example, the following
8282
command maps local port `4321` to remote port `22222` on the device:
8383

8484
```shell
85-
$ balena tunnel <device-uuid> -p 22222:4321
85+
$ balena device tunnel <device-uuid> -p 22222:4321
8686
```
8787

8888
The device can then be accessed on local port `4321` with a standalone SSH client:

0 commit comments

Comments
 (0)