There is a thread on GitHub around the automatic restart behaviour of Open Balena (https://github.com/balena-io/open-balena/issues/83), but it seems for the executing the startup script (’/scripts/compose up’) an init system will be used. I was surprised not to see a systemd service script for this.
Here is what I am looking to use, would be good to clarify whether there is an alternative already provided somewhere, or any comments on the below:
Hello @maggie0002 OpenBalena is designed to be a flexible solution for users and as a result we do not tie ourselves to a particular init system. This allows users to choose a start-up method that works best for their needs. In this case you are welcome to either add restart: always to the docker compose file or use a systemd script as you wish. We also find that not restarting OpenBalena by default is very useful during development and debugging as the logs are preserved.
Indeed, although I have tried to stick as close to the original OpenBalena design to avoid any potential issues during updates in the future (i.e. changes to the docker-compose files that require this to be redone without me noticing).
I have been visiting this again today, because my production implementation with the system file just seemed really clunky, and layering two init systems not really ok. Especially when it came to losing all the abilities of docker-compose to merge the logs.
Docker merges the two, adding in the restart policies when you run docker-compose up -d. And this way when an Open Balena update is released, you only have to flatten the docker file again and not need to manually add in all the restart policies (one exception being if Balena adds in more containers, but let’s call that unlikely).