Bootstrap app from common device image


#1

I would like to image devices (all the same type) with a common image which “bootstraps” the config.json rather than have the config baked in the image. Any thoughts on:

balenaCloud app called noncommisioned. The device image for this app has a few modifications:

  • config.json is moved to config-default.json
  • config.json symlink pointed to config-default.json
  • a program invoked by systemd. Program needs to be suitably small and may just be a shell script but could also be cloud-init, puppet, preseed …

When ran, the script does something along the lines of:

  1. If BALENA_APP_CONFIG environment variable is set, capture the applicaitonId.
  2. If config-applicationId.json is found exit.
  3. Write BALENA_APP_CONFIG to config-applicationId.json
  4. Update the config.json symlink
  5. Continue the startup.

This could be used for staged roll outs but I believe that use case is getting solved. This direction lets us completely change the device to a different app without forking the git workflow. I mentioned cm tools like cloud-init because I would also like a robust way to have more control over the host’s networking.