latest version of pi-hole/web, refactor, fixes

This commit is contained in:
diginc 2016-10-30 12:13:52 -05:00
parent 6c721163e6
commit 6a1d16d6fb
10 changed files with 72 additions and 42 deletions

@ -1 +1 @@
Subproject commit b270c6130b3fc1bb9a221d2ee7178169c64ccac1
Subproject commit 3e6955d4a01d78bb8c73a8f9fcec6d3be51bea4c

View File

@ -1 +1 @@
v1.4.3.1
v1.4.4.2

View File

@ -15,16 +15,16 @@ RUN apk add --update \
# Customized from submodules
COPY ./pi-hole/gravity.sh /usr/local/bin/
COPY ./pi-hole/advanced/Scripts/* /usr/local/bin/
COPY ./pi-hole/pihole /usr/local/bin/
RUN sed -i 's|service dnsmasq \(re\)\{0,1\}start|dnsmasq -7 /etc/dnsmasq.d|g' \
/usr/local/bin/pihole \
/usr/local/bin/gravity.sh \
/usr/local/bin/whitelist.sh \
/usr/local/bin/blacklist.sh
/usr/local/bin/list.sh
COPY ./alpine/nginx.conf /etc/nginx/nginx.conf
# Original upstream pihole code being used
COPY ./pi-hole/adlists.default /etc/pihole/
COPY ./pi-hole/adlists.default /etc/.pihole/
COPY ./pi-hole/pihole /usr/local/bin/
RUN mkdir -p /opt/ && ln -s /usr/local/bin /opt/pihole
COPY ./pi-hole/advanced/dnsmasq.conf.original /etc/dnsmasq.conf
COPY ./pi-hole/advanced/01-pihole.conf /etc/dnsmasq.d/
@ -63,7 +63,7 @@ RUN grep -q '^user=root' || echo 'user=root' >> /etc/dnsmasq.conf
# php config start passes special ENVs into
ENV PHP_ENV_CONFIG '/etc/php5/fpm.d/envs.conf'
ENV PHP_ERROR_LOG '/var/log/nginx/error.log'
COPY ./alpine/start.sh /
COPY ./start.sh /
COPY ./common_start.sh /
# IPV6 disable flag for networks/devices that do not support it

View File

@ -1,23 +0,0 @@
#!/bin/sh
. /common_start.sh
# Dockerfile variables
export IMAGE
export ServerIP
export ServerIPv6
export PYTEST
export PHP_ENV_CONFIG
export PHP_ERROR_LOG
validate_env
setup_saved_variables
setup_php_env
setup_dnsmasq "$DNS1" "$DNS2"
setup_ipv4_ipv6
test_configs
test_framework_stubbing
gravity.sh # dnsmasq start included
php-fpm
nginx
tail -F /var/log/nginx/*.log /var/log/pihole.log

View File

@ -12,7 +12,7 @@ setup_saved_variables() {
echo "IPv6_address=$ServerIPv6" >> /etc/pihole/setupVars.conf;
}
setup_dnsmasq() {
setup_dnsmasq_dns() {
local DNS1="${1:-8.8.8.8}"
local DNS2="${2:-8.8.4.4}"
local dnsType='default'
@ -25,6 +25,43 @@ setup_dnsmasq() {
sed -i "s/@DNS2@/$DNS2/" /etc/dnsmasq.d/01-pihole.conf
}
setup_dnsmasq_hostnames() {
# largely borrowed from automated install/basic-install.sh
local IPv4_address="${1}"
local IPv6_address="${2}"
local hostname="${3}"
local dnsmasq_pihole_01_location="/etc/dnsmasq.d/01-pihole.conf"
if [ -z "$hostname" ]; then
if [[ -f /etc/hostname ]]; then
hostname=$(</etc/hostname)
elif [ -x "$(command -v hostname)" ]; then
hostname=$(hostname -f)
fi
fi;
if [[ "${IPv4_address}" != "" ]]; then
tmp=${IPv4_address%/*}
sed -i "s/@IPv4@/$tmp/" ${dnsmasq_pihole_01_location}
else
sed -i '/^address=\/pi.hole\/@IPv4@/d' ${dnsmasq_pihole_01_location}
sed -i '/^address=\/@HOSTNAME@\/@IPv4@/d' ${dnsmasq_pihole_01_location}
fi
if [[ "${IPv6_address}" != "" ]]; then
sed -i "s/@IPv6@/$IPv6_address/" ${dnsmasq_pihole_01_location}
else
sed -i '/^address=\/pi.hole\/@IPv6@/d' ${dnsmasq_pihole_01_location}
sed -i '/^address=\/@HOSTNAME@\/@IPv6@/d' ${dnsmasq_pihole_01_location}
fi
if [[ "${hostname}" != "" ]]; then
sed -i "s/@HOSTNAME@/$hostname/" ${dnsmasq_pihole_01_location}
else
sed -i '/^address=\/@HOSTNAME@*/d' ${dnsmasq_pihole_01_location}
fi
}
setup_php_env() {
case $IMAGE in
"debian") setup_php_env_debian ;;
@ -113,3 +150,19 @@ test_configs_alpine() {
test_framework_stubbing() {
if [ -n "$PYTEST" ] ; then sed -i 's/^gravity_spinup$/#gravity_spinup # DISABLED FOR PYTEST/g' "$(which gravity.sh)"; fi;
}
main() {
IMAGE="$1"
case $IMAGE in
"alpine")
gravity.sh # dnsmasq start included
php-fpm
nginx
;;
"debian")
gravity.sh # dnsmasq start included
service lighttpd start
;;
esac
tail -F /var/log/lighttpd/*.log /var/log/pihole.log
}

View File

@ -65,7 +65,7 @@ RUN grep -q '^user=root' || echo 'user=root' >> /etc/dnsmasq.conf
# php config start passes special ENVs into
ENV PHP_ENV_CONFIG '/etc/lighttpd/conf-enabled/15-fastcgi-php.conf'
ENV PHP_ERROR_LOG '/var/log/lighttpd/error.log'
COPY ./debian/start.sh /
COPY ./start.sh /
COPY ./common_start.sh /
# IPv6 disable flag for networks/devices that do not support it

View File

@ -8,6 +8,11 @@
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This file is under source-control of the Pi-hole installation and update
# scripts, any changes made to this file will be overwritten when the softare
# is updated or re-installed. Please make any changes to the appropriate crontab
# or other cron file snippets.
# Your container name goes here:
DOCKER_NAME=pihole
@ -21,10 +26,6 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# pihole software update commands are unsupported in docker!
#30 2 * * 7 root docker exec $DOCKER_NAME pihole updatePihole > /dev/null
# Pi-hole: Parse the log file before it is flushed and save the stats to a database
# This will be used for a historical view of your Pi-hole's performance
#50 23 * * * root docker exec $DOCKER_NAME dailyLog.sh # note: this is outdated > /dev/null
# Pi-hole: Flush the log daily at 00:00 so it doesn't get out of control
# Stats will be viewable in the Web interface thanks to the cron job above
00 00 * * * root docker exec $DOCKER_NAME pihole flush > /dev/null

@ -1 +1 @@
Subproject commit fc89851ce95b4ea059ed430e1ad514bdbb3605dd
Subproject commit c65e5ff8e0741d5eb552211779a6fd35a90d13f3

View File

@ -1 +1 @@
v2.9.4
v2.9.5

9
debian/start.sh → start.sh Executable file → Normal file
View File

@ -7,16 +7,15 @@ export ServerIPv6
export PYTEST
export PHP_ENV_CONFIG
export PHP_ERROR_LOG
export HOSTNAME
validate_env
setup_saved_variables
setup_php_env
setup_dnsmasq "$DNS1" "$DNS2"
setup_dnsmasq_dns "$DNS1" "$DNS2"
setup_dnsmasq_hostnames "$ServerIP" "$ServerIPv6" "$HOSTNAME"
setup_ipv4_ipv6
test_configs
test_framework_stubbing
gravity.sh # dnsmasq start included
service lighttpd start
tail -F /var/log/lighttpd/*.log /var/log/pihole.log
main "$IMAGE"