I figured I’d pose the question here first before descending down a rabbit hole. Here’s the hypothetical situation. I have two devices,
deviceTwo, both of which are a Rpi3 running BalenaOS.
Both devices run the same BalenaCloud application, however each has a different functional use. Eg.
deviceOne has a screen attached and
deviceTwo reads a sensor. I have two services that run as part of the app, let’s call them
sensor. In theory, both devices run both services, each in a separate container. However, there’s no real need for
deviceTwo to run the
kiosk service as it has no screen attached, and vice versa for
deviceOne. To save on resources, I’d like to selectively decide which service to run on each device, probably using a device ENV variable.
My thought process was this:
- create a third service and call it something like
boot-manager, have this service depend_on
sensorto ensure it launches last. When the container runs, run a script that sends a request to the supervisor API stopping the container that isn’t required (determined by reading of the device ENV, eg.
Is there a better way to do this? How do people usually tackle this problem?