|
| 1 | +--- |
| 2 | +title: 'Using FoundriesFactory Waves Fleet Management' |
| 3 | +description: 'Learn how to manage multiple Portenta X8 devices using FoundriesFactory fleet management tool, Waves' |
| 4 | +difficulty: intermediate |
| 5 | +tags: |
| 6 | + - Embedded Linux |
| 7 | + - Flashing |
| 8 | + - Foundries.io |
| 9 | +author: 'Benjamin Dannegård' |
| 10 | +hardware: |
| 11 | + - hardware/04.pro/boards/portenta-x8 |
| 12 | +--- |
| 13 | + |
| 14 | +## Overview |
| 15 | + |
| 16 | +In a production environment it is convenient to plan updates, and have control over when and which devices are updated. FoundriesFactory® Waves is the feature for this. It allows you to easily define a group of Portenta X8s and then push updates to that specific group. The difference between standard updates and using Waves to update, is that the Wave update will promote targets to production by double signing them, which makes the updates more manageable and controllable. This tutorial will show you how to define that group and how to construct a Wave that can then be pushed to a group. |
| 17 | + |
| 18 | +## Goals |
| 19 | + |
| 20 | +- Learn how to use Waves fleet manager |
| 21 | +- Learn how to assign a target to a Wave |
| 22 | +- Learn how to push a Wave to a group of devices |
| 23 | + |
| 24 | +### Required Hardware and Software |
| 25 | + |
| 26 | +- USB-C to USB-A or USB-C to USB-C |
| 27 | +- Portenta X8 |
| 28 | +- Arduino Create account |
| 29 | +- Arduino Pro Cloud Subscription. [Learn more about the Pro Cloud](https://www.arduino.cc/pro/hardware/product/portenta-x8#pro-cloud). |
| 30 | +- Foundries.io™ account (linked with the Pro Cloud subscription) |
| 31 | +- FoundriesFactory® and devices already attached to your Factory. ([Check the Getting Started tutorial](https://docs.arduino.cc/tutorials/portenta-x8/out-of-the-box)) |
| 32 | + |
| 33 | +## Instructions |
| 34 | + |
| 35 | +### Setting Up the Terminal |
| 36 | + |
| 37 | +Waves fleet management requires us to have the X8 setup with FoundriesFactory. If you have not done so, please follow our [Getting Started tutorial](https://docs.arduino.cc/tutorials/portenta-x8/out-of-the-box), as it will walk you through setting up the X8 with your Factory. To use Waves, you need to have fioctl installed and configured. Follow this [guide](https://docs.foundries.io/latest/getting-started/install-fioctl/index.html) to do so.Creating Waves and device groups will be done via the host, which is your factory. As such, the following commands will be entered in a terminal using fioctl to connect to your Factory. |
| 38 | + |
| 39 | +### Rotating Our Keys |
| 40 | + |
| 41 | +For security purposes, we recommend that you rotate your FoundriesFactory keys. Rotation of the key will convert the root role's online-key, which was generated during the bootstrap of your Factory, to an [offline key](https://docs.foundries.io/latest/reference-manual/security/offline-keys.html). |
| 42 | + |
| 43 | +First we will rotate the root keys. These are the most important keys, as they can be used to create new target keys. Rotate them with the command: |
| 44 | +``` |
| 45 | +fioctl keys rotate-root --initial /absolute/path/to/root.keys.tgz |
| 46 | +``` |
| 47 | + |
| 48 | +Now we can rotate the target only keys with: |
| 49 | +``` |
| 50 | +fioctl keys rotate-targets /absolute/path/to/root.keys.tgz |
| 51 | +``` |
| 52 | + |
| 53 | +And finally, for security reasons, we separate the target keys from root using: |
| 54 | +``` |
| 55 | +fioctl keys copy-targets /absolute/path/to/root.keys.tgz /path/to/target.only.key.tgz |
| 56 | +``` |
| 57 | + |
| 58 | +Now we can move on to creating our Wave. |
| 59 | + |
| 60 | +### Creating a Dummy Wave for Production Targets |
| 61 | + |
| 62 | +Before a Factory can start doing production OTAs, an initial production Targets file must be created. More information can be found [here](https://docs.foundries.io/latest/reference-manual/ota/production-targets.html). This can be done by creating a dummy wave with the command: |
| 63 | +``` |
| 64 | +fioctl wave init -k /absolute/path/to/targets.only.key.tgz populate-targets |
| 65 | +``` |
| 66 | + |
| 67 | +Then complete the Wave with: |
| 68 | +``` |
| 69 | +fioctl wave complete populate-targets |
| 70 | +``` |
| 71 | +This creates a new targets.json file for production devices subscribing to the production tag. It will include a single Target from CI build. |
| 72 | + |
| 73 | +### Creating a Wave |
| 74 | + |
| 75 | +Now we can start creating our Wave. The command below will create a Wave that can then be pushed to our devices. To create a Wave, we will sign it with a key, here we will use the targets only key. Then we give the Wave a name, target number, and tag. The `target number` needs to correspond to the target that we want the Wave to contain for our devices. The `tag` can be set as production or development. |
| 76 | +``` |
| 77 | +fioctl wave init -k /absolute/path/to/targets.only.key.tgz <waveName> <targetNumber> <tag> |
| 78 | +``` |
| 79 | + |
| 80 | +And then we can complete the Wave by passing the name to the "complete" function: |
| 81 | +``` |
| 82 | +fioctl wave complete <waveName> |
| 83 | +``` |
| 84 | + |
| 85 | +Or we can cancel it with: |
| 86 | +``` |
| 87 | +fioctl waves cancel <waveName> |
| 88 | +``` |
| 89 | + |
| 90 | +After creating the Wave, you should see it on your Factory page. It should also be marked as complete after you call the Wave complete command. |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | +### Create the Device Group |
| 95 | + |
| 96 | +With this command, we create our group, giving it a name and a short description: |
| 97 | +``` |
| 98 | +fioctl config device-group create <groupName> "<shortDescription>" |
| 99 | +``` |
| 100 | + |
| 101 | +Now to assign a device to our group we use: |
| 102 | +``` |
| 103 | +fioctl device config group <deviceName> <groupName> |
| 104 | +``` |
| 105 | + |
| 106 | +On your FoundriesFactory device page you can sort and view devices by group. |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +To rollout our Wave to our device group, use: |
| 111 | +``` |
| 112 | +fioctl waves rollout <waveName> <deviceGroupName> |
| 113 | +``` |
| 114 | + |
| 115 | +Every device in the device group should now have the target specified in the Wave creation. |
| 116 | + |
| 117 | +### Conclusion |
| 118 | + |
| 119 | +In this tutorial we first looked at what is required to use the Wave tool. We then went through the process of creating a Wave and device group. Then we pushed a target to the device group using the Wave tool. |
| 120 | + |
| 121 | +## Troubleshooting |
| 122 | + |
| 123 | +- If you are having trouble with any fioctl commands you can use `fioctl wave --help` or `fioctl wave rollout --help` depending on the context. |
0 commit comments