Merge pull request #1115 from pi-hole/var-log-pihole
Account for renaming/moving of log files in main repos
This commit is contained in:
commit
0ec6f866cd
|
@ -21,7 +21,7 @@ RUN bash -ex install.sh 2>&1 && \
|
|||
ARG PHP_ENV_CONFIG
|
||||
ENV PHP_ENV_CONFIG /etc/lighttpd/conf-enabled/15-fastcgi-php.conf
|
||||
ARG PHP_ERROR_LOG
|
||||
ENV PHP_ERROR_LOG /var/log/lighttpd/error.log
|
||||
ENV PHP_ERROR_LOG /var/log/lighttpd/error-pihole.log
|
||||
COPY ./start.sh /
|
||||
COPY ./bash_functions.sh /
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ services:
|
|||
- './etc-pihole:/etc/pihole'
|
||||
- './etc-dnsmasq.d:/etc/dnsmasq.d'
|
||||
# run `touch ./var-log/pihole.log` first unless you like errors
|
||||
# - './var-log/pihole.log:/var/log/pihole.log'
|
||||
# - './var-log/pihole.log:/var/log/pihole/pihole.log'
|
||||
# Recommended but not required (DHCP needs NET_ADMIN)
|
||||
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
|
||||
cap_add:
|
||||
|
|
|
@ -28,7 +28,7 @@ if [ -z "$SKIPGRAVITYONBOOT" ] || [ ! -e "${gravityDBfile}" ]; then
|
|||
echo " Ignoring SKIPGRAVITYONBOOT on this occaision."
|
||||
fi
|
||||
|
||||
echo '@reboot root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole_updateGravity.log || cat /var/log/pihole_updateGravity.log' > /etc/cron.d/gravity-on-boot
|
||||
echo '@reboot root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole/pihole_updateGravity.log || cat /var/log/pihole/pihole_updateGravity.log' > /etc/cron.d/gravity-on-boot
|
||||
else
|
||||
echo " Skipping Gravity Database Update."
|
||||
[ ! -e /etc/cron.d/gravity-on-boot ] || rm /etc/cron.d/gravity-on-boot &>/dev/null
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
s6-echo "Starting lighttpd-access-log"
|
||||
|
||||
s6-setuidgid www-data cat /var/log/lighttpd/access.log 2>&1
|
||||
s6-setuidgid www-data cat /var/log/lighttpd/access-pihole.log 2>&1
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
s6-echo "Starting lighttpd-error-log"
|
||||
|
||||
s6-setuidgid www-data cat /var/log/lighttpd/error.log 2>&1
|
||||
s6-setuidgid www-data cat /var/log/lighttpd/error-pihole.log 2>&1
|
||||
|
|
|
@ -4,7 +4,7 @@ s6-echo "Starting lighttpd"
|
|||
|
||||
if [[ 1 -eq ${WEBLOGS_STDOUT:-0} ]]; then
|
||||
#lighthttpd cannot use /dev/stdout https://redmine.lighttpd.net/issues/2731
|
||||
for fi in /var/log/lighttpd/access.log /var/log/lighttpd/error.log
|
||||
for fi in /var/log/lighttpd/access-pihole.log /var/log/lighttpd/error-pihole.log
|
||||
do
|
||||
if [[ ! -p ${fi} ]]; then
|
||||
rm -f ${fi}
|
||||
|
@ -17,16 +17,16 @@ if [[ 1 -eq ${WEBLOGS_STDOUT:-0} ]]; then
|
|||
sleep 2
|
||||
else
|
||||
#remove fifo if exists
|
||||
[[ -p /var/log/lighttpd/access.log ]] && rm -Rf /var/log/lighttpd/access.log
|
||||
[[ -p /var/log/lighttpd/error.log ]] && rm -Rf /var/log/lighttpd/error.log
|
||||
[[ -p /var/log/lighttpd/access-pihole.log ]] && rm -Rf /var/log/lighttpd/access-pihole.log
|
||||
[[ -p /var/log/lighttpd/error-pihole.log ]] && rm -Rf /var/log/lighttpd/error-pihole.log
|
||||
|
||||
# install /dev/null log files to ensure they exist (create if non-existing, preserve if existing)
|
||||
[[ ! -f /var/log/lighttpd/access.log ]] && install /dev/null /var/log/lighttpd/access.log
|
||||
[[ ! -f /var/log/lighttpd/error.log ]] && install /dev/null /var/log/lighttpd/error.log
|
||||
[[ ! -f /var/log/lighttpd/access-pihole.log ]] && install /dev/null /var/log/lighttpd/access-pihole.log
|
||||
[[ ! -f /var/log/lighttpd/error-pihole.log ]] && install /dev/null /var/log/lighttpd/error-pihole.log
|
||||
|
||||
# Ensure that permissions are set so that lighttpd can write to the logs
|
||||
chown -R www-data:www-data /var/log/lighttpd
|
||||
chmod 0644 /var/log/lighttpd/access.log /var/log/lighttpd/error.log
|
||||
chmod 0644 /var/log/lighttpd/access-pihole.log /var/log/lighttpd/error-pihole.log
|
||||
fi
|
||||
|
||||
lighttpd -D -f /etc/lighttpd/lighttpd.conf
|
||||
|
|
|
@ -6,16 +6,16 @@ rm -f /dev/shm/FTL-* 2> /dev/null
|
|||
rm /run/pihole/FTL.sock 2> /dev/null
|
||||
|
||||
# install /dev/null files to ensure they exist (create if non-existing, preserve if existing)
|
||||
mkdir -pm 0755 /run/pihole
|
||||
mkdir -pm 0755 /run/pihole /var/log/pihole
|
||||
[[ ! -f /run/pihole-FTL.pid ]] && install /dev/null /run/pihole-FTL.pid
|
||||
[[ ! -f /run/pihole-FTL.port ]] && install /dev/null /run/pihole-FTL.port
|
||||
[[ ! -f /var/log/pihole-FTL.log ]] && install /dev/null /var/log/pihole-FTL.log
|
||||
[[ ! -f /var/log/pihole.log ]] && install /dev/null /var/log/pihole.log
|
||||
[[ ! -f /var/log/pihole/FTL.log ]] && install /dev/null /var/log/pihole/FTL.log
|
||||
[[ ! -f /var/log/pihole/pihole.log ]] && install /dev/null /var/log/pihole/pihole.log
|
||||
[[ ! -f /etc/pihole/dhcp.leases ]] && install /dev/null /etc/pihole/dhcp.leases
|
||||
|
||||
# Ensure that permissions are set so that pihole-FTL can edit all necessary files
|
||||
chown pihole:pihole /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole-FTL.log /var/log/pihole.log /etc/pihole/dhcp.leases /run/pihole /etc/pihole
|
||||
chmod 0644 /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole-FTL.log /var/log/pihole.log /etc/pihole/dhcp.leases
|
||||
chown pihole:pihole /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole/FTL.log /var/log/pihole/pihole.log /etc/pihole/dhcp.leases /run/pihole /etc/pihole
|
||||
chmod 0644 /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole/FTL.log /var/log/pihole/pihole.log /etc/pihole/dhcp.leases
|
||||
|
||||
# Ensure that permissions are set so that pihole-FTL can edit the files. We ignore errors as the file may not (yet) exist
|
||||
chmod -f 0644 /etc/pihole/macvendor.db
|
||||
|
@ -24,10 +24,22 @@ chown -f pihole:pihole /etc/pihole/pihole-FTL.db /etc/pihole/gravity.db /etc/pih
|
|||
# Chown database file permissions so that the pihole group (web interface) can edit the file. We ignore errors as the files may not (yet) exist
|
||||
chmod -f 0664 /etc/pihole/pihole-FTL.db
|
||||
|
||||
# Backward compatibility for user-scripts that still expect log files in /var/log instead of /var/log/pihole/
|
||||
# Should be removed with Pi-hole v6.0
|
||||
if [ ! -f /var/log/pihole.log ]; then
|
||||
ln -s /var/log/pihole/pihole.log /var/log/pihole.log
|
||||
chown -h pihole:pihole /var/log/pihole.log
|
||||
|
||||
fi
|
||||
if [ ! -f /var/log/pihole-FTL.log ]; then
|
||||
ln -s /var/log/pihole/FTL.log /var/log/pihole-FTL.log
|
||||
chown -h pihole:pihole /var/log/pihole-FTL.log
|
||||
fi
|
||||
|
||||
# Call capsh with the detected capabilities
|
||||
capsh --inh=${CAP_STR:1} --addamb=${CAP_STR:1} --user=$DNSMASQ_USER --keep=1 -- -c "/usr/bin/pihole-FTL $FTL_CMD >/dev/null 2>&1"
|
||||
|
||||
# Notes on above:
|
||||
# - DNSMASQ_USER default of pihole is in Dockerfile & can be overwritten by runtime container env
|
||||
# - /var/log/pihole*.log has FTL's output that no-daemon would normally print in FG too
|
||||
# - /var/log/pihole/pihole*.log has FTL's output that no-daemon would normally print in FG too
|
||||
# prevent duplicating it in docker logs by sending to dev null
|
||||
|
|
|
@ -162,7 +162,7 @@ def test_dns_interface_override_defaults(docker, slow, args_env, expected_stdout
|
|||
expected_debian_lines = [
|
||||
'"VIRTUAL_HOST" => "127.0.0.1"',
|
||||
'"ServerIP" => "127.0.0.1"',
|
||||
'"PHP_ERROR_LOG" => "/var/log/lighttpd/error.log"'
|
||||
'"PHP_ERROR_LOG" => "/var/log/lighttpd/error-pihole.log"'
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue