From 8d154152c9461d408b90a4fe0f13ced0c2fdd4f8 Mon Sep 17 00:00:00 2001 From: Wesley McCloy Date: Sat, 11 Jan 2025 23:27:10 -0800 Subject: [PATCH] patch: update to `balena device ` updated all instances of `{{ $names.company.short }}` commands to use the renamed versions using https://github.com/balena-io/balena-cli/blob/v20.2.1/docs/balena-cli.md as reference --- pages/learn/develop/local-mode.md | 28 ++++++++++++++-------------- shared/general/container-ssh.md | 22 +++++++++++----------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pages/learn/develop/local-mode.md b/pages/learn/develop/local-mode.md index af016bbe34..ba33f06f5e 100644 --- a/pages/learn/develop/local-mode.md +++ b/pages/learn/develop/local-mode.md @@ -30,14 +30,14 @@ To use local mode on a device: ## Scan the network and find your device -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 `.local`, where the `short-uuid` is the UUID you see on your device dashboard. +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 `.local`, where the `short-uuid` is the UUID you see on your device dashboard. -__Note:__ You may need administrator privileges to run `{{ $names.company.short }} scan` as it requires access to all network interfaces. +__Note:__ You may need administrator privileges to run `{{ $names.company.short }} device detect` as it requires access to all network interfaces. **Command** ```bash -sudo {{ $names.company.short }} scan +sudo {{ $names.company.short }} device detect ``` **Output** @@ -66,7 +66,7 @@ Reporting scan results ## Push over a new project -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 `.local`, obtained from the preceding `{{ $names.company.short }} scan` command. +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 `.local`, obtained from the preceding `{{ $names.company.short }} device detect` command. __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. @@ -167,48 +167,48 @@ By default, when pushing code to a device in local mode using the {{ $names.comp {{ $names.company.short }} push 63ec46c.local --detached ``` -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 `.local`. +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 `.local`. ```shell -{{ $names.company.short }} logs 63ec46c.local +{{ $names.company.short }} device logs 63ec46c.local ``` 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: ```bash -{{ $names.company.short }} logs 63ec46c.local --system +{{ $names.company.short }} device logs 63ec46c.local --system ``` To filter logs by a service, use the `--service` option. You may specify this option multiple times to output logs from multiple services. ```bash -{{ $names.company.short }} logs 63ec46c.local --service main -{{ $names.company.short }} logs 63ec46c.local --service first --service second +{{ $names.company.short }} device logs 63ec46c.local --service main +{{ $names.company.short }} device logs 63ec46c.local --service first --service second ``` These options can be combined to output system and selected service logs e.g. ```bash -{{ $names.company.short }} logs 827b231.local --system --service first --service second +{{ $names.company.short }} device logs 827b231.local --system --service first --service second ``` __Note:__ You may also specify the `--service` and `--system` options using the `{{ $names.company.short }} push` command to filter the log output. ## SSH into the running app container or host OS -To access the local device over [SSH][ssh], use the `{{ $names.company.short }} ssh` command specifying the device IP address or `.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]: +To access the local device over [SSH][ssh], use the `{{ $names.company.short }} device ssh` command specifying the device IP address or `.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]: ```bash -{{ $names.company.short }} ssh 192.168.86.45 +{{ $names.company.short }} device ssh 192.168.86.45 ``` To connect to a container, we can specify the service name e.g. ```bash -sudo {{ $names.company.short }} ssh 63ec46c.local my-service +sudo {{ $names.company.short }} device ssh 63ec46c.local my-service ``` -__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. +__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. ## Using a Private Docker Registry diff --git a/shared/general/container-ssh.md b/shared/general/container-ssh.md index 5538e576ec..93e25b6a95 100644 --- a/shared/general/container-ssh.md +++ b/shared/general/container-ssh.md @@ -14,31 +14,31 @@ A terminal session should be initiated for you in a second or two. If you would __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. -## Using `{{ $names.company.short }} ssh` from the CLI +## Using `{{ $names.company.short }} device ssh` from the CLI 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: ```shell -$ {{ $names.company.short }} ssh +$ {{ $names.company.short }} device ssh ``` -`` 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: +`` 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: ```shell -$ {{ $names.company.short }} ssh main +$ {{ $names.company.short }} device ssh main ``` This also works in multicontainer fleets; simply pass the name of the appropriate service (as defined in docker-compose.yml) instead of `main`. -__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 `. +__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 `. 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. 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: ```shell -$ balena ssh 192.168.1.23 -$ balena ssh .local +$ balena device ssh 192.168.1.23 +$ balena device ssh .local ``` 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 directly exposed to the public internet. The IP address will typically be a private IP address of a local network. For remote devices, -see [{{ $names.company.short }} tunnel][balena-tunnel]. +see [{{ $names.company.short }} device tunnel][balena-tunnel]. -## {{ $names.company.short }} tunnel +## {{ $names.company.short }} device tunnel The SSH server of a {{ $names.os.lower }} device (host OS) listens on TCP port `22222`. This port is not blocked by any firewall on the device itself, but external firewalls or NAT routers will often block access at the network level. To get around this, you can use the -`{{$names.company.short }} tunnel` command of the {{ $names.cli.lower }}, which tunnels a +`{{$names.company.short }} device tunnel` command of the {{ $names.cli.lower }}, which tunnels a TCP connection between a localhost port and a port on the device. For example, the following command maps local port `4321` to remote port `22222` on the device: ```shell -$ balena tunnel -p 22222:4321 +$ balena device tunnel -p 22222:4321 ``` The device can then be accessed on local port `4321` with a standalone SSH client: