Skip to content

Commit 7a0328a

Browse files
committed
Extend Offline Updates documentation for low bandwidth networks
Change-type: minor
1 parent 8beabd1 commit 7a0328a

File tree

1 file changed

+32
-24
lines changed

1 file changed

+32
-24
lines changed

pages/learn/deploy/offline-updates.md

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ Offline update includes the following steps:
4343
- [Configure balenaOS image](#configure-balenaos-image)
4444
- [Create and preload release](#create-and-preload-release)
4545
- [Create update media](#create-update-media)
46-
- [Process of reprovisioning](#process-of-reprovisioning)
4746
- [Update device registration(s)](#update-device-registrations)
47+
- [Process of reprovisioning](#process-of-reprovisioning)
4848

4949
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.
5050

@@ -174,7 +174,7 @@ $ commit=$(balena app ${app_slug} | grep COMMIT | awk '{print $2}')
174174
$ balena preload ${tmpimg} \
175175
--app ${app_slug} \
176176
--commit ${commit} \
177-
--pin-device-to-release
177+
--no-pin-device-to-release
178178
```
179179

180180
### Create Update Media
@@ -194,33 +194,25 @@ $ sudo balena local flash ${tmpimg} \
194194
$ rm ${tmpimg}
195195
```
196196

197-
### Process of Reprovisioning
198-
199-
> Warning: For devices with internal storage, this procedure erases the internal media of your device. Hence, remove any mass storage devices containing user data.
200-
201-
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.
202-
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.
204-
205-
#### Strategies to remotely update with an SD card or USB device
206-
207-
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.
208-
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.
210-
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.
212-
213197
### Update Device Registration(s)
214198

215-
This section deals with device registration in the cloud (balenaCloud or openBalena). The following steps help in manually reflecting the new state of the device for offline devices or devices on private networks without Internet access.
199+
This section deals with device registration in the cloud (balenaCloud or openBalena). The following steps help in
200+
* manually reflecting the new state of the device for offline devices or devices on private networks without Internet access
201+
* prevent devices with restricted or low bandwidth connectivity from trying to download newer releases.
216202

217203
#### Patch State Endpoint - Update Device State in the Cloud
218204

219205
This step updates the device state in the cloud (balenaCloud or openBalena)
220-
on behalf of the device, as if the device was online. It is only required for
221-
devices that do not have an internet connection. If the device has an internet
222-
connection, even if low bandwidth, this step may be skipped because the device
223-
itself will be able to contact the cloud to update its state.
206+
on behalf of the device, as if the had just installed the new release. It is
207+
optional for devices that do not have an internet connection, but mandatory if
208+
the device has a unreliable/limited connectivity or low bandwidth internet
209+
connection.
210+
211+
In such unreliable or limited bandwidth connection situations, you will need to
212+
run the commands of this step after you have powered off the device. This step
213+
will pin the device to the release that was preloaded to the image, to ensure
214+
that the device doesn't attempt to download a newer release over an unreliable
215+
or limited bandwidth connection.
224216

225217
```bash
226218
$ os_version_tag=$(echo ${os_version} | awk -F'+' '{print $1}')
@@ -244,7 +236,7 @@ $ curl --silent \
244236
-X 'PATCH' "https://api.${BALENARC_BALENA_URL}/v6/device(uuid='${uuid}')" \
245237
-H "Authorization: Bearer $(cat ~/.balena/token)" \
246238
-H 'Content-type: application/json' \
247-
--data-binary "{\"os_variant\":\"${os_variant}\",\"os_version\":\"balenaOS ${os_version_semver}+${os_revision}\",\"supervisor_version\":\"${supervisor_version}\",\"is_running__release\":${release_id}}"
239+
--data-binary "{\"os_variant\":\"${os_variant}\",\"os_version\":\"balenaOS ${os_version_semver}+${os_revision}\",\"supervisor_version\":\"${supervisor_version}\",\"is_running__release\":${release_id},\"should_be_running__release\":${release_id}}"
248240
```
249241

250242
#### [Optional] Set Tags on Devices
@@ -259,6 +251,22 @@ $ balena tag set 'offline:hostOS' "${os_version}" \
259251
--device ${uuid}
260252
```
261253

254+
### Process of Reprovisioning
255+
256+
> Warning: For devices with internal storage, this procedure erases the internal media of your device. Hence, remove any mass storage devices containing user data.
257+
258+
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.
259+
260+
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.
261+
262+
#### Strategies to remotely update with an SD card or USB device
263+
264+
If a device isn't locally deployed, one can ship the flashed SD cards or USB sticks/drives to a remote location.
265+
266+
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. In such cases someone can run the update by simply inserting them into the devices and booting.
267+
268+
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.
269+
262270
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.
263271

264272
[named-volumes]: /learn/develop/multicontainer/#named-volumes

0 commit comments

Comments
 (0)