FIX #4: added DISABLE_STATS flag and moved stats refresh in a dedicated script
This commit is contained in:
@@ -35,6 +35,7 @@ services:
|
|||||||
FPM_MAX_SPARE_SERVERS: 3 # default: 3
|
FPM_MAX_SPARE_SERVERS: 3 # default: 3
|
||||||
DISABLE_WEBROOT_CHOWN: 1 # default: 0
|
DISABLE_WEBROOT_CHOWN: 1 # default: 0
|
||||||
DISABLE_SFTP: 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.
|
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.
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ FPM_MAX_SPARE_SERVERS=${FPM_MAX_SPARE_SERVERS:-3}
|
|||||||
|
|
||||||
DISABLE_WEBROOT_CHOWN=${DISABLE_WEBROOT_CHOWN:-0}
|
DISABLE_WEBROOT_CHOWN=${DISABLE_WEBROOT_CHOWN:-0}
|
||||||
DISABLE_SFTP=${DISABLE_SFTP:-0}
|
DISABLE_SFTP=${DISABLE_SFTP:-0}
|
||||||
|
DISABLE_STATS=${DISABLE_STATS:-0}
|
||||||
|
|
||||||
export USERNAME
|
export USERNAME
|
||||||
export GROUPNAME
|
export GROUPNAME
|
||||||
@@ -51,6 +52,7 @@ export FPM_MAX_SPARE_SERVERS
|
|||||||
|
|
||||||
export DISABLE_WEBROOT_CHOWN
|
export DISABLE_WEBROOT_CHOWN
|
||||||
export DISABLE_SFTP
|
export DISABLE_SFTP
|
||||||
|
export DISABLE_STATS
|
||||||
|
|
||||||
# run all scripts in order
|
# run all scripts in order
|
||||||
run-parts /app/entrypoint.sh.d
|
run-parts /app/entrypoint.sh.d
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ ${PATH_LOGS}/nginx-access.log {
|
|||||||
su ${USERNAME} ${GROUPNAME}
|
su ${USERNAME} ${GROUPNAME}
|
||||||
postrotate
|
postrotate
|
||||||
/usr/sbin/nginx -s reopen
|
/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
|
endscript
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ ${DISABLE_STATS} -eq 1 ] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
echo "# Configuring stats"
|
echo "# Configuring stats"
|
||||||
|
|
||||||
# make sure paths exists
|
# make sure paths exists
|
||||||
|
|||||||
15
rootfs/app/stats.sh
Executable file
15
rootfs/app/stats.sh
Executable 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
|
||||||
Reference in New Issue
Block a user