logrotate new
This commit is contained in:
parent
c6d9201768
commit
7e871997ea
|
@ -1,6 +1,8 @@
|
||||||
FROM openresty/openresty:1.19.9.1-bionic
|
FROM openresty/openresty:1.19.9.1-bionic
|
||||||
|
|
||||||
RUN luarocks install lua-resty-http && \
|
RUN luarocks install lua-resty-http && \
|
||||||
|
apt-get update -qq && \
|
||||||
|
apt-get install cron logrotate -qq && \
|
||||||
openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 \
|
openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 \
|
||||||
-subj '/CN=local-certificate' \
|
-subj '/CN=local-certificate' \
|
||||||
-keyout /etc/ssl/local-certificate.key \
|
-keyout /etc/ssl/local-certificate.key \
|
||||||
|
@ -10,10 +12,14 @@ COPY mo ./
|
||||||
COPY conf.d /etc/nginx/conf.d
|
COPY conf.d /etc/nginx/conf.d
|
||||||
COPY conf.d.templates /etc/nginx/conf.d.templates
|
COPY conf.d.templates /etc/nginx/conf.d.templates
|
||||||
|
|
||||||
|
COPY ./logrotate /etc/logrotate.d/nginx
|
||||||
|
|
||||||
CMD [ "bash", "-c", \
|
CMD [ "bash", "-c", \
|
||||||
"./mo < /etc/nginx/conf.d.templates/server.account.conf > /etc/nginx/conf.d/server.account.conf ; \
|
"./mo < /etc/nginx/conf.d.templates/server.account.conf > /etc/nginx/conf.d/server.account.conf ; \
|
||||||
./mo < /etc/nginx/conf.d.templates/server.api.conf > /etc/nginx/conf.d/server.api.conf; \
|
./mo < /etc/nginx/conf.d.templates/server.api.conf > /etc/nginx/conf.d/server.api.conf; \
|
||||||
./mo < /etc/nginx/conf.d.templates/server.hns.conf > /etc/nginx/conf.d/server.hns.conf; \
|
./mo < /etc/nginx/conf.d.templates/server.hns.conf > /etc/nginx/conf.d/server.hns.conf; \
|
||||||
./mo < /etc/nginx/conf.d.templates/server.skylink.conf > /etc/nginx/conf.d/server.skylink.conf ; \
|
./mo < /etc/nginx/conf.d.templates/server.skylink.conf > /etc/nginx/conf.d/server.skylink.conf ; \
|
||||||
|
mv /etc/cron.daily/logrotate /etc/cron.hourly/logrotate ; \
|
||||||
|
service cron start ; \
|
||||||
/usr/local/openresty/bin/openresty '-g daemon off;'" \
|
/usr/local/openresty/bin/openresty '-g daemon off;'" \
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
/usr/local/openresty/nginx/logs/*.log {
|
||||||
|
hourly
|
||||||
|
dateext
|
||||||
|
rotate 3650
|
||||||
|
missingok
|
||||||
|
notifempty
|
||||||
|
nocompress
|
||||||
|
create 640 root root
|
||||||
|
sharedscripts
|
||||||
|
postrotate
|
||||||
|
openresty -s reopen
|
||||||
|
endscript
|
||||||
|
}
|
Reference in New Issue