docker-nginx icon indicating copy to clipboard operation
docker-nginx copied to clipboard

entrypoint: Monitor config dir for changes

Open oliv3r opened this issue 1 year ago • 8 comments

We see a lot of crudges and hacks to notify nginx or the nginx container informing it it needs to restart. While there certainly cases that require manual control, for the most, this could be easily automated.

With inotify, we can recursively monitor /etc/nginx (or any directory per config) for changes (currently, not monitoring for for access time changes, e.g. reads or touch events). On an event, we sleep first for (configurable) seconds, the default is 10, so that multiple updates don't cause multiple restarts. E.g. copying 10 certificates into /etc/nginx/certs, won't trigger 10 reloads.

The monitor will run indefinably, and can't be easily killed. This isn't a problem however, as this is specifically a docker entry point and it is fair to assume this will only ever be run under docker.

The current configuration won't change existing behavior, it needs to be explicitly enabled.

oliv3r avatar Jun 04 '23 15:06 oliv3r