FIX #4: added DISABLE_STATS flag and moved stats refresh in a dedicated script

This commit is contained in:
2025-07-31 15:43:47 +02:00
parent 8d534bfd9b
commit b8c4e51fbe
5 changed files with 23 additions and 1 deletions

View File

@@ -35,6 +35,7 @@ services:
FPM_MAX_SPARE_SERVERS: 3 # default: 3
DISABLE_WEBROOT_CHOWN: 1 # default: 0
DISABLE_SFTP: 1 # default: 0
DISABLE_STATS: 1 # default: 0
```
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.

View File

@@ -26,6 +26,7 @@ FPM_MAX_SPARE_SERVERS=${FPM_MAX_SPARE_SERVERS:-3}
DISABLE_WEBROOT_CHOWN=${DISABLE_WEBROOT_CHOWN:-0}
DISABLE_SFTP=${DISABLE_SFTP:-0}
DISABLE_STATS=${DISABLE_STATS:-0}
export USERNAME
export GROUPNAME
@@ -51,6 +52,7 @@ export FPM_MAX_SPARE_SERVERS
export DISABLE_WEBROOT_CHOWN
export DISABLE_SFTP
export DISABLE_STATS
# run all scripts in order
run-parts /app/entrypoint.sh.d

View File

@@ -18,7 +18,7 @@ ${PATH_LOGS}/nginx-access.log {
su ${USERNAME} ${GROUPNAME}
postrotate
/usr/sbin/nginx -s reopen
nice -n 19 /usr/bin/goaccess ${PATH_LOGS}/nginx-access.log.1 --agent-list --anonymize-ip --real-os --exclude-ip 127.0.0.1 --output ${PATH_STATS}/index.html --log-format COMBINED --tz="${TZ}" --db-path=${PATH_STATSDB} --persist --restore
nice -n 19 /app/stats.sh
endscript
}
EOF

View File

@@ -1,5 +1,9 @@
#!/bin/sh
if [ ${DISABLE_STATS} -eq 1 ] ; then
exit 0
fi
echo "# Configuring stats"
# make sure paths exists

15
rootfs/app/stats.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
if [ "${DISABLE_STATS:-0}" -eq 1 ] ; then
exit 0
fi
PATH_BASE=/data
PATH_STATS=${PATH_BASE}/stats
PATH_STATSDB=${PATH_BASE}/stats.db
PATH_LOGS=${PATH_BASE}/logs
/usr/bin/goaccess "${PATH_LOGS}/nginx-access.log.1" \
--agent-list --anonymize-ip --real-os \
--output "${PATH_STATS}/index.html" --log-format COMBINED \
--tz="${TZ}" "--db-path=${PATH_STATSDB}" --persist --restore