Repository navigation
Improve: send nginx request errors to the container log - #24
Merged
Merged
Conversation
Alpine's packaged nginx.conf writes the access and error logs to files under /var/log/nginx. Nothing in the container reads them and nothing trims them: no logrotate binary is installed and no cron runs. Request failures were therefore invisible in `docker logs` while the files grew unbounded in the writable layer. Both directives are set in the server context, so this stays in a file the repo owns. Master and startup errors still follow the main context, which docker-entrypoint.sh already guards by refusing to start on a rejected config.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
error_log stderr warn;tonginx/dashboard.conf, so request-time failures appear indocker logs.access_log off;, replacing an unrotated file in the container's writable layer.access_log off;on the/healthlocation untouched.Alpine's packaged
nginx.confsends both logs to files under/var/log/nginx. The container installs nologrotateand runs no cron, so nothing read those files and nothing trimmed them.Both directives are valid in the
servercontext, so this needs no change to/etc/nginx/nginx.conf. The scope limit is deliberate: master and startup errors still follow the main context, anddocker-entrypoint.shalready refuses to start on a config nginx rejects.Testing
All green, including the Docker build. Verified in a built container: a request over the body limit now writes
client intended to send too large bodytodocker logs, an unreachable upstream writesconnect() failed, and both files under/var/log/nginxstay at zero bytes. Added 3 tests pinning the two directives and the health-check exclusion.Checklist