Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix uwsgi log file permissions (PP-1667) #2077

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ COPY docker/services/nginx /etc/nginx/
# Setup uwsgi
COPY docker/services/uwsgi /etc/
RUN mkdir -p /var/log/uwsgi && \
chown -RHh simplified:simplified /var/log/uwsgi && \
chown root:adm /var/log/uwsgi && \
touch /var/log/uwsgi/uwsgi.log && \
chown simplified:adm /var/log/uwsgi/uwsgi.log && \
chmod 644 /var/log/uwsgi/uwsgi.log && \
mkdir /var/run/uwsgi && \
chown simplified:simplified /var/run/uwsgi

Expand Down
2 changes: 1 addition & 1 deletion docker/services/logrotate/logrotate.d/celery.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
missingok
daily
create 0660 simplified adm
rotate 30
rotate 13
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align this with the retention we have for our other logs

compress
delaycompress
notifempty
Expand Down
4 changes: 1 addition & 3 deletions docker/services/logrotate/logrotate.d/simplified.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/var/log/simplified/*.log {
missingok
daily
create 0700 root root
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we use copytruncate this line is actually ignored, so we might as well drop it.

rotate 13
copytruncate
compress
Expand All @@ -13,8 +12,7 @@
/var/log/uwsgi/*.log {
missingok
daily
create 0660 simplified adm
rotate 30
rotate 13
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align this with the configuration we push out in our playbook.

copytruncate
compress
delaycompress
Expand Down
1 change: 0 additions & 1 deletion docker/services/uwsgi/uwsgi.d/40_log.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[uwsgi]
log-format = [uwsgi] %(var.HTTP_X_FORWARDED_FOR) (%(addr)) - - [%(ltime)] "%(method) %(uri) %(proto)" %(status) %(size) "%(referer)" "%(uagent)" host_hdr=%(host) req_time_elapsed=%(msecs) process=%(pid) worker=%(wid)
logfile-chmod = 644
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This configuration option isn't used when using logger, its only used when using the log-to configuration. So we might as well drop it, since its deceiving that it is here.

When we switched to using logger in this config is probably when it broke.

logger = stdio:
logger = file:/var/log/uwsgi/uwsgi.log