Make supervisord exit when key processes die, fixes #1137 #1142
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Problem/Issue/Bug:
In the web container, supervisord can happily work along even though php-fpm or the webserver has died or is not runnable.
How this PR Solves The Problem:
Use technique from https://blog.zhaw.ch/icclab/process-management-in-docker-containers/ to add an event listener, so supervisord and thus the container will die in cases like this.
Manual Testing Instructions:
ddev ssh
killall nginx
orkillall php-fpm
or introduce an error into /etc/nginx/nginx.conf and killall -1 nginx, or kill -1 1 (to reload supervisord itself).Those should result in nginx or php-fpm or apache croaking, and the container exiting.
Automated Testing Overview:
Related Issue Link(s):
OP #1137
Release/Deployment notes:
This does in fact change the behavior of the web container. Previously, if a process died (like apache or nginx) the container would continue on. It would probably become "unhealthy" but would stay up. Here instead if one of those croaks you get a container that stops.
One interesting thing about this implementation is there is just one event listener, which is causing supervisord to exit if any process dies. It would be easy to implement separate listeners that had separate behavior. For example, we could then ignore the failure of mailhog.