Compare commits

...
This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.

4 Commits

Author SHA1 Message Date
Karol Wypchło 9a9467263c Update logrotate 2021-05-30 17:24:50 +02:00
Karol Wypchlo 43dc3b2058 invalid user 2021-05-30 17:24:50 +02:00
Karol Wypchlo 0553a067b8 fix logrotate 2021-05-30 17:24:50 +02:00
Karol Wypchlo 9e67cd1c88 add daily logrotate to nginx 2021-05-30 17:24:48 +02:00
2 changed files with 22 additions and 3 deletions

View File

@ -1,7 +1,13 @@
FROM openresty/openresty:1.19.3.1-8-bionic
# RUN apt-get update -qq && apt-get install cron logrotate -qq
RUN apt-get update -qq && apt-get install cron logrotate -qq
RUN luarocks install luasocket
# CMD ["sh", "-c", "service cron start;", "/usr/local/openresty/bin/openresty -g daemon off;"]
CMD ["/usr/local/openresty/bin/openresty", "-g", "daemon off;"]
# change "syslog" user to "adm" user in logrotate.conf
RUN sed -i 's/^su root syslog/su root adm/' /etc/logrotate.conf
# copy nginx logrotate config and assign correct owner
COPY ./logrotate /etc/logrotate.d/nginx
RUN chown root:root /etc/logrotate.d/nginx
CMD ["sh", "-c", "service cron start ; /usr/local/openresty/bin/openresty -g 'daemon off;'"]

13
docker/nginx/logrotate Normal file
View File

@ -0,0 +1,13 @@
/usr/local/openresty/nginx/logs/*.log {
daily
dateext
rotate 3650
missingok
notifempty
nocompress
create 640 root root
sharedscripts
postrotate
[ ! -f /usr/local/openresty/nginx/logs/nginx.pid ] || kill -USR1 `cat /usr/local/openresty/nginx/logs/nginx.pid`
endscript
}