Skip to content

Commit 289d179

Browse files
committed
Adds logrotate
1 parent deca493 commit 289d179

File tree

5 files changed

+34
-5
lines changed

5 files changed

+34
-5
lines changed

Diff for: docker/Dockerfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ENV SUPPRESS_NO_CONFIG_WARNING=1 \
2020

2121
RUN echo "fs.file-max = 65535" > /etc/sysctl.conf \
2222
&& apt-get update \
23-
&& apt-get install -y --no-install-recommends jq \
23+
&& apt-get install -y --no-install-recommends jq logrotate \
2424
&& apt-get clean \
2525
&& rm -rf /var/lib/apt/lists/*
2626

@@ -43,6 +43,9 @@ COPY docker/rootfs /
4343
# Remove frontend service not required for prod, dev nginx config as well
4444
RUN rm -rf /etc/services.d/frontend /etc/nginx/conf.d/dev.conf
4545

46+
# Change permission of logrotate config file
47+
RUN chmod 644 /etc/logrotate.d/nginx-proxy-manager
48+
4649
VOLUME [ "/data", "/etc/letsencrypt" ]
4750
ENTRYPOINT [ "/init" ]
4851
HEALTHCHECK --interval=5s --timeout=3s CMD /bin/check-health

Diff for: docker/dev/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ENV S6_LOGGING=0 \
77

88
RUN echo "fs.file-max = 65535" > /etc/sysctl.conf \
99
&& apt-get update \
10-
&& apt-get install -y certbot jq python3-pip \
10+
&& apt-get install -y certbot jq python3-pip logrotate \
1111
&& apt-get clean \
1212
&& rm -rf /var/lib/apt/lists/*
1313

@@ -18,6 +18,7 @@ RUN cd /usr \
1818

1919
COPY rootfs /
2020
RUN rm -f /etc/nginx/conf.d/production.conf
21+
RUN chmod 644 /etc/logrotate.d/nginx-proxy-manager
2122

2223
# s6 overlay
2324
RUN curl -L -o /tmp/s6-overlay-amd64.tar.gz "https://github.com/just-containers/s6-overlay/releases/download/v1.22.1.0/s6-overlay-amd64.tar.gz" \

Diff for: docker/rootfs/etc/logrotate.d/nginx-proxy-manager

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/data/logs/*_access.log /data/logs/*/*_access.log {
2+
create 0644 root root
3+
weekly
4+
rotate 4
5+
missingok
6+
notifempty
7+
compress
8+
sharedscripts
9+
postrotate
10+
/bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
11+
endscript
12+
}
13+
14+
/data/logs/*_error.log /data/logs/*/*_error.log {
15+
create 0644 root root
16+
weekly
17+
rotate 10
18+
missingok
19+
notifempty
20+
compress
21+
sharedscripts
22+
postrotate
23+
/bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
24+
endscript
25+
}

Diff for: docker/rootfs/etc/nginx/conf.d/default.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ server {
88
set $port "80";
99

1010
server_name localhost-nginx-proxy-manager;
11-
access_log /data/logs/fallback-access.log standard;
11+
access_log /data/logs/fallback_access.log standard;
1212
error_log /dev/null crit;
1313
include conf.d/include/assets.conf;
1414
include conf.d/include/block-exploits.conf;

Diff for: docker/rootfs/etc/nginx/nginx.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ worker_processes auto;
99
# Enables the use of JIT for regular expressions to speed-up their processing.
1010
pcre_jit on;
1111

12-
error_log /data/logs/fallback-error.log warn;
12+
error_log /data/logs/fallback_error.log warn;
1313

1414
# Includes files with directives to load dynamic modules.
1515
include /etc/nginx/modules/*.conf;
@@ -46,7 +46,7 @@ http {
4646
log_format proxy '[$time_local] $upstream_cache_status $upstream_status $status - $request_method $scheme $host "$request_uri" [Client $remote_addr] [Length $body_bytes_sent] [Gzip $gzip_ratio] [Sent-to $server] "$http_user_agent" "$http_referer"';
4747
log_format standard '[$time_local] $status - $request_method $scheme $host "$request_uri" [Client $remote_addr] [Length $body_bytes_sent] [Gzip $gzip_ratio] "$http_user_agent" "$http_referer"';
4848

49-
access_log /data/logs/fallback-access.log proxy;
49+
access_log /data/logs/fallback_access.log proxy;
5050

5151
# Dynamically generated resolvers file
5252
include /etc/nginx/conf.d/include/resolvers.conf;

0 commit comments

Comments
 (0)