We’re trying out balena, and it looks great!
I’m wondering what would be the correct approach to run one time pre & post install steps -
One of our containers we would like to run on the device is a database.
In our current installation script, we have preliminary sensitive steps - such as certificates creation,
which we don’t want to be executed on remote build machines, but locally on the device, as well as additional steps, like automatic settings files generation, which need to be done locally on the machine before the DB container starts.
Additionally, after the DB container is successfully started, and the DB starts running, we do post install steps - such as automatically creating local databases, populating initial data, defining replications, and so on.
I understand that there is no way to define some script to be run directly on the host machine outside of all containers. Then what would be the best approach to run some code only once before & after a container starts running, when performing first installation on the device? Defining one container for pre install steps and another for post install steps sounds like a huge overkill! Especially as there is no way to run them only once, and they would have to check for some flag upon startup?