Skip to content

Commit 7d3ea2b

Browse files
Add context to balena preload
Signed-off-by: Vipul Gupta (@vipulgupta2048) <vipul@balena.io>
1 parent 6c51ede commit 7d3ea2b

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

pages/learn/deploy/offline-updates.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ With the offline updates process, the device still resets to a default factory s
1818
3. Inserting the custom `config.json` file into the downloaded balenaOS image.
1919
4. Running `balena preload` on the image, pointing to whichever version of your code you want to deploy to the device.
2020
5. Flashing this preloaded image to an SD card, a device's eMMC or a separate (flasher) USB drive.
21-
6. Updating device state on balenaCloud and optionally tag the device.
21+
6. Updating device state on balenaCloud and optionally tagging the device.
2222

2323
When you insert the SD card or USB drive into your device and boot it, the device will be reflashed, retaining its balena identity, and all your updates will be in place and running.
2424

@@ -30,7 +30,7 @@ If this is the case, mount an external mass storage (USB) device into a privileg
3030

3131
## Performing an Offline Update
3232

33-
To perform an offline update, we will be using [balena-cli](https://www.balena.io/docs/reference/balena-cli/). All commands should work on Linux distributions running Docker on Linux Kernel with AUFS and overlay filesystem support. For Windows and macOS, the last version of Docker Desktop supporting AUFS is 18.06.1
33+
To perform an offline update, we will be using [balena-cli][balena-cli]. All commands should work on Linux distributions running Docker on Linux Kernel with AUFS and overlay filesystem support. For Windows and macOS, the last version of Docker Desktop supporting AUFS is 18.06.1
3434

3535
> Note: In an offline updates process, all data on the device is wiped at this point, making this different from a typical software update process in the balena ecosystem. Any additional user data and system settings written to various device partitions would be lost in this process.
3636
@@ -46,6 +46,8 @@ Offline update includes the following steps:
4646
- [Process of reprovisioning](#process-of-reprovisioning)
4747
- [Update device registration(s)](#update-device-registrations)
4848

49+
The process needs some prerequiste knowledge of the balena ecosystem, [balena-cli][balena-cli] commands and shell commands. Please read all instructions carefully and make sure to try the update process first on a test device.
50+
4951
### Setup
5052

5153
> Download and install [balena-cli][balena-cli] on a Linux distribution. The commands have been tested to work on Ubuntu 20.04.
@@ -68,7 +70,7 @@ $ ssh_key=id_ed25519.pub
6870

6971
### Create/Use Pre-existing Application
7072

71-
Initialize the `arch` and `device-type` environment variable with correct CPU architecture (`aarch64`, `armv7l`, etc.) and device type (`raspberrypi4-64`, `raspberrypi3`, etc.). The list of names for supported device types and their architectures can be found on the [hardware][supporteddeviceslist] page.
73+
Initialize the `arch` and `device-type` environment variable with correct CPU architecture (`aarch64`, `armv7l`, etc.) and device type (`raspberrypi4-64`, `raspberrypi3`, etc.). The list of names for supported device types and their architectures can be found on the [hardware][supported-devices-list] page.
7274

7375
If a pre-existing application needs to be re-used, then initialize the `app_name` variable with that application's name.
7476

@@ -102,7 +104,7 @@ OR
102104
$ uuid=<UUID OF YOUR DEVICE>
103105
```
104106

105-
With `balena device register`, devices can be preregistered to a balenaCloud application involving a simple call with a unique identifier for the device. You can read more about the full process of pre-registering a device in the [balena-cli advanced masterclass][balena-cli advanced masterclass]. This step can be skipped if a pre-existing device is needed to be updated.
107+
With [`balena device register`][balena-device-register], devices can be preregistered to a balenaCloud application involving a simple call with a unique identifier for the device. You can read more about the full process of pre-registering a device in the [balena-cli advanced masterclass][balena-cli advanced masterclass]. This step can be skipped if a pre-existing device is needed to be updated.
106108

107109
```bash
108110
$ balena device register ${app_slug} --uuid ${uuid}
@@ -123,7 +125,7 @@ $ balena os download ${device_type} \
123125

124126
### Configure balenaOS Image
125127

126-
Configure the downloaded image by injecting a [config.json][config-file] file using the [`balena os configure`][balena-os-configure] command. Most common system settings can be (re)specified via [config.json](config-file). To preserve the pre-existing registered device's identity, the same `uuid` initialized earlier will be used to generate a config.json file.
128+
Configure the downloaded image by injecting a [config.json][config-file] file using the [`balena os configure`][balena-os-configure] command. Most common system settings can be (re)specified via [config.json][config-file]. To preserve the pre-existing registered device's identity, the same `uuid` initialized earlier will be used to generate a config.json file.
127129

128130
```bash
129131
$ tmpconfig=$(mktemp)
@@ -158,7 +160,7 @@ Offline update revolve around the concept of [balena preload][balena-preload]. P
158160

159161
> Important note: [balena preload](https://github.com/balena-io/balena-cli/blob/master/INSTALL-MAC.md#balena-preload) functionality requires Docker with AUFS support.
160162
161-
Since preload involves flashing an application release with the balenaOS image, if the pre-existing application doesn't have any releases, then a release needs to be created. If release is present already, then the next step can be skipped.
163+
Since preload involves flashing an application release with the balenaOS image, if the pre-existing application doesn't have any releases, then a release needs to be created using [`balena deploy`][balena-deploy]. Navigate to the directory of your source code folder and run the command below to deploy the latest release of your application. If a release is present already, then the next step can be skipped.
162164

163165
```bash
164166
$ balena deploy ${app_slug} --build --emulated --source .
@@ -184,7 +186,6 @@ Next, a USB flash drive, an SD card or any relevant storage media needs to be pr
184186
```bash
185187
# list the devices available to flash
186188
$ balena util available-drives
187-
/dev/...
188189

189190
# Please make sure `--drive` is really the disk you want to write to.
190191
$ sudo balena local flash ${tmpimg} \
@@ -199,15 +200,15 @@ $ rm ${tmpimg}
199200
200201
With the update media ready having the latest release of the application preloaded. Follow the device's provisioning instructions present on balenaCloud dashboard for your specific device.
201202

202-
For example: For Raspberrypi devices, insert the recently flashed SD card and power up the device. When the process is complete, (re)connect any mass storage devices containing user data back to the device. Reconnect the device to the local air-gapped network(s). Later, use SSH to connect and inspect application logs, etc.
203+
For example: For Raspberry Pi devices, insert the recently flashed SD card and power up the device. When the process is complete, (re)connect any mass storage devices containing user data back to the device. Reconnect the device to the local air-gapped network(s). Later, use SSH to connect and inspect application logs, etc.
203204

204205
#### Strategies to remotely update with an SD card or USB device
205206

206207
If a device isn't locally deployed, one can ship the flashed SD cards or USB sticks/drives to a remote location. There someone can run the update by simply inserting them into the devices and booting.
207208

208-
If the target device exists on an air-gapped or Internet restricted network, inserting [ssh](https://www.balena.io/docs/reference/OS/configuration/#sshkeys) keys during the configuration step will allow fleet managers at the remote site to connect into the device directly via OpenSSH and verify the update by examining container logs, etc.
209+
If the target device exists on an air-gapped or Internet restricted network, [inserting ssh keys][insert-ssh-key] during the configuration step will allow fleet managers at the remote site to connect into the device directly via OpenSSH and verify the update by examining container logs, etc.
209210

210-
If the target device is connected via a low-bandwidth connection, it should eventually establish a connection to balenaCloud. Depending on the connection's quality, it may respond to [Web Terminal][web-terminal] commands and output container logs to the dashboard.
211+
If the target device is connected via a low-bandwidth connection, it should eventually establish a connection to balenaCloud. Depending on the connection's quality, it may respond to [web terminal][web-terminal] commands and output container logs to the dashboard.
211212

212213
### Update Device Registration(s)
213214

@@ -260,13 +261,16 @@ $ balena tag set 'offline:hostOS' "${os_version}" \
260261

261262
Read more about how the process can work better for your usecase in the [offline updates](https://balena.io/blog/offline-updates-make-it-easier-to-update-balena-devices-without-the-internet) blog.
262263

263-
[named volumes]: /learn/develop/multicontainer/#named-volumes
264+
[named-volumes]: /learn/develop/multicontainer/#named-volumes
264265
[persistent-logging]: /reference/OS/configuration/#persistentlogging
265266
[balena-cli]: /reference/balena-cli/
266-
[supporteddeviceslist]: /reference/hardware/devices/
267+
[supported-devices-list]: /reference/hardware/devices/
267268
[balena-cli advanced masterclass]: /learn/more/masterclasses/advanced-cli/#52-preregistering-a-device
269+
[balena-deploy]:/learn/deploy/deployment/#balena-build--deploy
268270
[balenaOS]:{{ $links.osSiteUrl }}
271+
[insert-ssh-key]:/reference/OS/configuration/#sshkeys
269272
[balena-os-configure]:/reference/balena-cli/#os-configure-image
273+
[balena-device-register]:/reference/balena-cli/#device-register-application
270274
[config-file]:/reference/OS/configuration/#valid-fields
271275
[balena-preload]:/reference/balena-cli/#preload
272276
[preloading-device-image]:/learn/more/masterclasses/advanced-cli/#51-preloading-a-device-image

0 commit comments

Comments
 (0)