App Lifecycle on an Edge Device¶
Starting Order¶
The Industrial Edge Device OS does NOT have any strict starting order. You can
not predict which application / container will be started first. If your
application / container does rely on a certain container, you need to add the
depends_on
setting in the docker-compose.yaml or add corresponding probes to your
program code which test the availability of the other application to
ensure that it will wait until the other application is started up.
[Recommended] - Write you application in a way so that it is able to recover if a necessary service is temporarily unavailable.
Restart Policy of an Application¶
We need to prepare all components to be scalable in order to create an ecosystem which can scale over its lifecycle. This is why we have adopted the "12-factor" strategy. In case of having a failure in the underlying layers, the processes should also be robust against sudden death.
[Must Have] If the scope of your application is a commercial usage, none
is NOT an acceptable restart policy for your container.
Process Supervisor¶
Docker engine itself acts as the supervisor for the initial process which is started within the container. In multi-process containers, you'll need to use a process supervisor to manage these processes. Supervisord is a popular choice for this role. It allows you to configure, start, and stop multiple processes based on a single configuration file. This helps ensure that if one process fails, it can be automatically restarted without affecting the other processes in the container.
Graceful Shutdown¶
Ensure that in multi-process containers if required the e.g. SIGTERM signal is populated properly to the child processes. This might be crucial for avoiding data corruption and ensuring that services can clean up resources properly.