added logs rotation
This commit is contained in:
@@ -2,7 +2,7 @@ FROM alpine:3.21
|
|||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
apk --no-cache upgrade && \
|
apk --no-cache upgrade && \
|
||||||
apk --no-cache add tini nginx curl openssh-server nginx-mod-http-dav-ext \
|
apk --no-cache add tini nginx curl logrotate openssh-server nginx-mod-http-dav-ext \
|
||||||
php84 php84-fpm php84-mbstring php84-curl php84-ctype php84-dom php84-gd php84-json php84-openssl php84-session php84-simplexml php84-xml php84-zip \
|
php84 php84-fpm php84-mbstring php84-curl php84-ctype php84-dom php84-gd php84-json php84-openssl php84-session php84-simplexml php84-xml php84-zip \
|
||||||
php84-apcu php84-opcache php84-pecl-yaml php84-sqlite3 php84-mysqli \
|
php84-apcu php84-opcache php84-pecl-yaml php84-sqlite3 php84-mysqli \
|
||||||
php83 php83-fpm php83-mbstring php83-curl php83-ctype php83-dom php83-gd php83-json php83-openssl php83-session php83-simplexml php83-xml php83-zip \
|
php83 php83-fpm php83-mbstring php83-curl php83-ctype php83-dom php83-gd php83-json php83-openssl php83-session php83-simplexml php83-xml php83-zip \
|
||||||
|
|||||||
@@ -14,11 +14,12 @@ services:
|
|||||||
- 8888:80
|
- 8888:80
|
||||||
- 2222:22
|
- 2222:22
|
||||||
volumes:
|
volumes:
|
||||||
- ./www:/data/www
|
- ./data:/data
|
||||||
- ./ssh:/ssh # add authorized_keys file here
|
- ./ssh:/ssh # add authorized_keys file here
|
||||||
- ./extra_nginx.conf:/etc/nginx/custom.d/extra.conf # optional
|
- ./extra_nginx.conf:/etc/nginx/custom.d/extra.conf # optional
|
||||||
- ./htpasswd:/app/htpasswd # optional, for webdav auth
|
- ./htpasswd:/app/htpasswd # optional, for webdav auth
|
||||||
environment:
|
environment:
|
||||||
|
LOG_DAYS: 14 # default 7
|
||||||
WEBDAV_PORT: 8080 # default: 8080
|
WEBDAV_PORT: 8080 # default: 8080
|
||||||
PHP: php84 # none (default), php82, php83, php84
|
PHP: php84 # none (default), php82, php83, php84
|
||||||
POSTSIZE: 256M # default: 256M
|
POSTSIZE: 256M # default: 256M
|
||||||
@@ -31,4 +32,4 @@ services:
|
|||||||
FPM_MAX_SPARE_SERVERS: 3 # default: 3
|
FPM_MAX_SPARE_SERVERS: 3 # default: 3
|
||||||
```
|
```
|
||||||
|
|
||||||
The `/data/www` directory and its contents will be chowned to `$PUID:$PGID` and chmodded to `0755` for directories and `0644` for files at container start.
|
The `/data/www` and `/data/logs` directories and their contents will be chowned to `$PUID:$PGID` and chmodded to `0755` for directories and `0644` for files at container start.
|
||||||
|
|||||||
@@ -128,5 +128,24 @@ touch /app/htpasswd
|
|||||||
mkdir -p /data/logs
|
mkdir -p /data/logs
|
||||||
chown -R "${USERNAME}" /data/logs
|
chown -R "${USERNAME}" /data/logs
|
||||||
|
|
||||||
|
# configure logrotate
|
||||||
|
LOG_DAYS=${LOG_DAYS:-7}
|
||||||
|
cat >/etc/logrotate.d/nginx <<EOF
|
||||||
|
/data/logs/nginx-access.log {
|
||||||
|
missingok
|
||||||
|
daily
|
||||||
|
rotate ${LOG_DAYS}
|
||||||
|
compress
|
||||||
|
delaycompress
|
||||||
|
sharedscripts
|
||||||
|
su ${USERNAME} ${GROUPNAME}
|
||||||
|
postrotate
|
||||||
|
/usr/sbin/nginx -s reopen
|
||||||
|
endscript
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
crond -b
|
||||||
|
|
||||||
|
# start nginx
|
||||||
echo starting nginx
|
echo starting nginx
|
||||||
nginx
|
nginx
|
||||||
|
|||||||
Reference in New Issue
Block a user