Named volumes between application & using config.json file

Hi all,

I have a question about using named volumes between applications and using the config.json file. I’ve created a setup process, after the flashing a device, to register itself to our servers. It receives a serial, which is linked to the balena UUID. Our servers knows what sort of device it is, and which Balena application the device has to have.

But I’d like to save the serial and some other data in a named volume, let the server change the application on cloudBalena for that specific device, so it downloads the right container, and still have the serial and other data stored in that named volume, which I then can access in the new application. Is this even possible?

Also, I’d like to use a variable from the config.json file from an image. So like: “device_sort”: “REGISTER”. So that I can send that to my server, so the server knows: This device is of sort “REGISTER” and has to have this application. Is that also possible?

If these are things that aren’t even possible, then I’ve to think about other solutions to implement a ‘provisioning’ process for our servers.

Thanks in advance!

Hi @bversluijs,
Unfortunately data in persistent storage (named volumes) is automatically purged when a device is moved to a new application. Let me point you to our docs for persistent storage:

If the amount of data isn’t large, then you could possibly store them in device tags or device env vars, which persist when the device is moved between apps.

Tags & env vars can be managed both from the dashboard and from the balena-cli & balena-sdk as well.
https://www.balena.io/docs/learn/manage/filters-tags/#filters-and-tags
https://www.balena.io/docs/reference/cli/#tags-1

Can you describe your provisioning process a bit more?
The config.json doesn’t sound like the ideal place to store settings.
Would it make sense to pre-register the device before provisioning and set specific device tags/env vars to it, which will be picked up on boot?
This can be done with the balena device register command from the balena-cli.
https://www.balena.io/docs/reference/cli/#device-register-application

Kind regards,
Thodoris