mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-16 17:48:49 +02:00
fix:#52 added log rotation and anonymized
This commit is contained in:
@ -40,8 +40,8 @@ services:
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
context: ./frontend
|
||||
target: dev
|
||||
command: "npm run dev"
|
||||
target: prod
|
||||
#command: "npm run dev"
|
||||
# open port 8000
|
||||
ports:
|
||||
- "8000:8000"
|
||||
|
@ -35,8 +35,13 @@ COPY . ./
|
||||
# https://hub.docker.com/r/bitnami/nginx -> always run as non-root user
|
||||
FROM bitnami/nginx:1.25 AS prod
|
||||
|
||||
USER root
|
||||
RUN install_packages logrotate
|
||||
USER 1001
|
||||
|
||||
# copy build files from build container
|
||||
COPY --from=build /app/dist /app
|
||||
COPY ./nginx.conf /opt/bitnami/nginx/conf/nginx.conf
|
||||
COPY nginx-logrotate /etc/logrotate.d/nginx
|
||||
|
||||
EXPOSE 8000
|
||||
|
14
frontend/nginx-logrotate
Normal file
14
frontend/nginx-logrotate
Normal file
@ -0,0 +1,14 @@
|
||||
/opt/bitnami/nginx/logs/proxy_*.log {
|
||||
rotate 5
|
||||
daily
|
||||
notifempty
|
||||
compress
|
||||
delaycompress
|
||||
create 0640 root root
|
||||
sharedscripts
|
||||
|
||||
postrotate
|
||||
# Reload NGINX to reopen the log files after rotation
|
||||
[ -f /opt/bitnami/nginx/tmp/nginx.pid ] && kill -USR1 `cat /opt/bitnami/nginx/tmp/nginx.pid`
|
||||
endscript
|
||||
}
|
@ -27,7 +27,10 @@ http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
access_log /opt/bitnami/nginx/logs/proxy_access.log;
|
||||
# Define a custom log format for anonymizing logs
|
||||
log_format anonymized '[$time_local] "$request" $status $body_bytes_sent "$http_referer"';
|
||||
|
||||
access_log /opt/bitnami/nginx/logs/proxy_access.log anonymized;
|
||||
error_log /opt/bitnami/nginx/logs/proxy_error.log;
|
||||
|
||||
sendfile on;
|
||||
|
@ -59,7 +59,10 @@ http {
|
||||
|
||||
real_ip_header CF-Connecting-IP;
|
||||
|
||||
access_log /opt/bitnami/nginx/logs/proxy_access.log;
|
||||
# Define a custom log format for anonymizing logs
|
||||
log_format anonymized '[$time_local] "$request" $status $body_bytes_sent "$http_referer"';
|
||||
|
||||
access_log /opt/bitnami/nginx/logs/proxy_access.log anonymized;
|
||||
error_log /opt/bitnami/nginx/logs/proxy_error.log;
|
||||
|
||||
sendfile on;
|
||||
|
Reference in New Issue
Block a user