haiwen / seafile-docker

A Docker image for Seafile server
Other
544 stars 183 forks source link

postrotate action for nginx logfiles fails #198

Closed rsmuc closed 8 months ago

rsmuc commented 4 years ago

The postrotate action for nginx logfiles is not working, so nginx will continue logging to e.g. access.log.1 and not to access.log after the first rotate, because nginx is not reloaded.

That is causing some trouble with fail2ban and maybe some trouble with diskspace after a long time.

Issue in /etc/logrotate.d/nginx:

Solution:

AlexVonB commented 3 years ago

I'm having the same issue (Seafile CE 8.0.5) and running sv reload nginx works. I'll have to manually edit /etc/logrotate.d/nginx after every update until this is fixed.

From what I read in the Dockerfiles, this issue comes directly from the bundled logrotate config in the nginx apt package:

https://github.com/haiwen/seafile-docker/blob/0d24e199e438e2f45134c8171119135862402795/image/seafile_8.0/Dockerfile#L14

I don't know how to fix this, if not with a sed in the Dockerfile around here:

https://github.com/haiwen/seafile-docker/blob/0d24e199e438e2f45134c8171119135862402795/image/seafile_8.0/Dockerfile#L41-L44

Adding sed -i 's/invoke-rc.d nginx rotate/sv reload nginx/' /etc/logrotate.d/nginx could be enough.

Best!

zs-gabor commented 2 years ago

I have the same problem.

Please replace the suggested line in the nginx logrotate configuration file.

Some other information that may help with the solution.

invoke-rc.d: policy-rc.d denied execution of rotate. The reason for these message: In the base image "phusion/baseimage:focal-1.0.0" invoke-rc.d service starting function is disabled by policy-rc.d file. In the base image configuration file, this line creates the policy-rc.d: ... echo '#!/bin/sh' > /usr/sbin/policy-rc.d && echo 'exit 101' >> /usr/sbin/policy-rc.d && chmod +x /usr/sbin/policy-rc.d ...

invoke-rc.d: could not determine current runlevel The reason for these message is the systemctl command can't determine the current and previous runlevels, because systemd isn't the init process. invoke-rc.d uses the runlevel command, which is symlinked to systemctl: lrwxrwxrwx 1 root root 14 Mar 17 2021 /usr/sbin/runlevel -> /bin/systemctl