Hi,
How can we add (programmatically) our own config to a BalenaOS image before writing it to an SD card? The config would need to be read by our container. This could be via a file to the /data
directory or adding an environment variable, or some other solution.
Some background:
We investigating if Balena is the right solution for a new project. We’d like users of our web-based application to be able to download an image to write to an SD card with Etcher and then put into their own Raspberry Pi. We can generate the “base image” from BalenaCloud and we just need to find a way to link the image that our users download back to their account with us without them doing anything other than writing to to an SD and connecting up a Raspberry Pi (with Ethernet for the internet connection).
I hope that makes sense? Thanks for your help.
Luke
Hi @violuke - thanks for your post. Can you give a bit more info about what kind of info you want to include? Are you thinking of something like an API key, or a particular binary, or something else?
All the best,
Hugh
Hi Huge,
Yeah an API Key would suffice. We just need something to initially know which account on our system to link this device to and then anything else we need to can be retrieved after the device has been booted.
Luke
Hi @violuke – if all you need to do is associate a particular device with a particular account, have you thought about pre-registering the device? This is documented in our Advanced CLI Masterclass. In a nutshell, you configure an image with a pre-specified, unique device ID; after that, the device that boots from that image would use that pre-specified device ID, rather than getting one assigned when it contacts the balena Cloud. You could then note which unique device ID was provided to a particular customer.
Would that suit your needs?
All the best,
Hugh
Hi Huge,
Yes, that would definitely work, thanks for your help.
Luke