Linking devices to customers

Hi, I’m in the early planning phase where I’m exploring management and provisioning systems for potential project.
The use case I have would be to run a collection of docker containers on a device. These devices would be sent to different customers, in different locations.
Looking at balenaCloud, I’m unclear how I’d handle a couple of issues:

  • When a device is shipped out, it would have a standard image (this may be through a distribution partner). On 1st boot it would register with balenaCloud. How do I determine which device is for which customer and which customer location? (i.e. Customer: SuperShops Location: Oxford Street, London. Customer: SuperShops Location: Bond Street, London, Customer: EatingHouse Location: Oxford Street, London).
  • How do I maintain grouping to know which devices belong with one customer vs another? I guess this is question around how balenaCloud handles multi-tenancy. If my system needs to maintain the mapping, then that’s ok, but would need a mechanism to determine which device belonged to whom and a way for them to claim it.

Thanks Martin

Hi,
Devices have a per-device API key exposed to them via an environment variable. This key can be used to set tags on the device and update device fields on our API. You could potentially have a setup wizard on the device that would ask the customer for their company name and location and then set those values as tags, which would then appear on the balenaCloud dashboard where we have functionality for searching and filtering by tag.

Hi,
Devices have a per-device API key exposed to them via an environment variable. This key can be used to set tags on the device and update device fields on our API. You could potentially have a setup wizard on the device that would ask the customer for their company name and location and then set those values as tags, which would then appear on the balenaCloud dashboard where we have functionality for searching and filtering by tag.

Sorry I should have said, then device is aimed to be headless, just power and network connection. So we need something that we can know in advance that can tie a physical device to what appears in balenaCloud.

Obviously pre-registering all the devices is an option, just one that isn’t appealing.
Does the MAC address propagate through or factor in to how the unique device ID is generated?

The Device ID is randomly generated and is not calculated based on other factors. We do gather latitude and longitude data for devices and expose it on the dashboard (using an IP lookup I believe) this could be made more accurate using a GPS module on the device - you could then use this data to determine the location of the device.

You could look into using the CLI to configure the device prior to shipping the device to a customer, or some variation with our balena-preload utility (https://github.com/balena-io/balena-preload) but I can imagine there will be some logistical issues if the device is fulfilled via a distribution partner.

Pre-registering the devices would give you more options considering that the device is headless - what about it is unappealing to you?

The unappealing bit is that we would need to power on every device with an active network connection before it could be shipped out and capture and record each unique device ID registered in balenaCloud and potentially label the device with that information. Then we’d either have to record which device got shipped to which customer, or more likely have the customer claim their pre-registered device based on the unique ID.

This would process would add costs the the supply/distribution side, rather than just writing a standard image to the device.

Another option we could explore would be a small OLED display to show some information, would the balenaCloud device ID be available to be queried from within a container running on the device?

Hi @martinrowan,

If you want to identify via MAC, perhaps your code could pull it and add it as device tag. Would that work?

By the way, we have an extensive blog post that explains how one could pre-provision a fleet of devices. It’s more or less your scenario:

Finally, on your last question: Seems like we have been exposing the device ID as environment variable earlier. But for some reason we removed this functionality. I’m now checking with my team why and if it makes sense to bring it back. For now, you could query balena API from within a container to get the device ID.

I’ll go and do some more reading. Really appreciate the rapid responses to my questions. Great support!

Glad to be helpful : )

To add one more bit: We expose device UUID in the container as the variable BALENA_DEVICE_UUID. This is the unique device identifier you could utilize.