This is an interesting idea, but I think maybe we might be able to come up with a simpler suggestion if we understand completely the use case. Our model is one of updates, so that a new release occurs when there are version updates to a particular service.
I think maybe the critical point here is ‘is the cloud service is unreachable’. Do you mean our balenaCloud backend, or the internet connection? Our cloud service is fairly unlikely to be unreachable as long as the device has an internet connection. Similarly, we have many customers who have secondary interfaces (such as GSM modems) to ensure that should the primary interface fail (eg. an ethernet connection) a secondary can work in its place. One of the issues I see here is even if you pushed a new release from the device, effectively to itself via local mode, if there are any dependencies that require building in that service, a lack of internet connection will mean building fails anyway. Finally, should the internet connection fail, any services running on the device will continue to run, regardless of lack of internet (although if those services require an internet connection then obviously they will fail).
If you have a set of pre-defined services, are we actually discussing customising the services that run on the device at any one time? We actually have a Supervisor endpoint that allows you to stop/start individual services, so you could load all of the services you need into a single application, and depending on net connection enable/disable them via the ‘orchestrator’ at runtime.
Unfortunately, what you’ve suggested switching between balenaCloud and then local mode isn’t particularly simple. The API service informs the Supervisor whether it should operate in local mode or not, and this requires our cloud backend to inform the Supervisor when this occurs. It’s currently not possible for services from balenaCloud to share persistent data with those in local mode. This causes issues with using the same data between these configurations as your services won’t be able to access the data stored in the other mode (and we don’t currently allowing the volume binding of arbitrary directories into services).
Would it be possible to give us some step-by-step examples of the type of use-case you are thinking of, as I think that will help us a large amount in offering you what maybe a simpler solution?
Thanks and best regards, Heds