Skip to content

ADU Agent Container

Pantavisor turns the all the runtime into a set of containers. This means the updates you push from Azure Device Update UI are going to be simply that: a set of containers that can be added, updated or removed. This includes the Azure Device Update agent, which have been containerized to be run on a Pantavisor enabled device.

The container contents are defined in the Dockerfile.template and built for arm32, arm64 and x64 architectures from GitLab CI with the help of container-ci. To sum up, the components of the container are:

NOTE: the containers are not natively run by Docker but by Pantavisor. The dockerfile is only used to define the container root file system.

Get Started

  1. Download latest flashable image:
Target Image
BPi r64 https://pantavisor-ci.s3.amazonaws.com/adu-ci/tags/001/371237583/bpi_r64_azure_stable.img.xz
RPi64 https://pantavisor-ci.s3.amazonaws.com/adu-ci/tags/001/371237583/rpi64_azure_stable.img.xz
x64 https://pantavisor-ci.s3.amazonaws.com/adu-ci/tags/001/371237583/x64_azure_stable.img.xz

NOTE: RPi or BPi images are recommended, as x64 lacks OEM partition support. x64 will work too, but you will have to manually edit the configuration in the device during runtime.

  1. Flash the downloaded image in an SD card:

Uncompress and flash your device:

unxz rpi64_azure_stable.img.xz
umount /dev/mmcblk0*
sudo dd if=rpi64_azure_stable.img of=/dev/mmcblk0 bs=32M
sync
  1. Set your adu-conf.txt into the 2nd partition of the newly flashed SD card:

NOTE: Remember your device has to be previously registered in Azure IOT Hub.

Prepare your adu-conf.txt with this format:

connection_string=<your connection string here>
aduc_manufacturer=Fabrikam
aduc_model=Toaster

Flash adu-conf.txt:

sudo dd if=adu-conf.txt of=/dev/mmcblk0p2 bs=1M
sync
  1. Insert your SD card in the device, turn it on and check its connected in Azure IOT Hub

  2. Clone the current running revision in your host computer with pvr

First, you will need to know your device IP. If your host computer is in the same network, you can use pvr device scan command.

After that, clone the revision into your computer with:

pvr clone http://192.168.1.122:12368/cgi-bin/pvr my-checkout
  1. Make changes in the checkout. For example, we are going to install a new NGINX container from DockerHub.
cd my-checkout
pvr app add --from nginx:stable-alpine webserver
pvr add .
pvr commit
  1. Convert the pvr checkout into ADU format with the pvr2adu script
pvr2adu -p Pantacor -n Toaster -m Fabrikam -d Toaster -v 1.1 -o out
  1. Deploy the resulting manifest from Device Update

TODO

  • Step 3 reduced if we flash the configuration with a mechanism similar to the one we use in our image-service.
  • Steps that require interaction with Azure UI (steps 3 and 4) could be automated using Azure API
  • Pantabox could make the updation requests easier (steps 5, 6, 7 and 8) if we could deploy updates using Azure API