From cd716289927003daa2ae54982830b7e88ea8ca2d Mon Sep 17 00:00:00 2001 From: Adam Hill Date: Mon, 8 Jan 2018 12:38:11 -0600 Subject: [PATCH 01/20] Update install.sh Try out using the updated installer that fixes the version number footer --- install.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 468c65fd7..78d5764f8 100755 --- a/install.sh +++ b/install.sh @@ -13,7 +13,8 @@ mv "$(which systemctl)" /bin/no_systemctl && \ mv "$(which debconf-apt-progress)" /bin/no_debconf-apt-progress # Get the install functions -wget -O "$PIHOLE_INSTALL" https://raw.githubusercontent.com/pi-hole/pi-hole/${CORE_TAG}/automated%20install/basic-install.sh +CUSTOM_INSTALL='677033afcae14738116f1080a4dc08031b72eb62' +wget -O "$PIHOLE_INSTALL" https://raw.githubusercontent.com/pi-hole/pi-hole/${CUSTOM_INSTALL:-$CORE_TAG}/automated%20install/basic-install.sh PH_TEST=true . "${PIHOLE_INSTALL}" # Run only what we need from installer @@ -39,8 +40,6 @@ if [[ $USE_DEVELOPMENT_BRANCHES == true ]] ; then else pushd "${PI_HOLE_LOCAL_REPO}"; git reset --hard "${CORE_TAG}"; - # Can be removed once https://github.com/pi-hole/pi-hole/pull/1779 is in a release - git checkout 8d721d086cbe4b49665c9e0b1d81499b284776a9 gravity.sh popd; pushd "${webInterfaceDir}"; git reset --hard "${WEB_TAG}"; popd; fi From 3c96d9e556514809f35415fc9ce75e121b28013c Mon Sep 17 00:00:00 2001 From: Adam Hill Date: Mon, 8 Jan 2018 12:48:12 -0600 Subject: [PATCH 02/20] May as well bump dev to the new RC --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 78d5764f8..69fc24bd7 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #!/bin/bash -ex mkdir -p /etc/pihole/ -export CORE_TAG='v3.2.1' +export CORE_TAG='v3.3-rc1' export WEB_TAG='v3.2.1' export FTL_TAG='v2.13.2' export USE_DEVELOPMENT_BRANCHES=false From e58aa2e69e643d32e5d40374aff819c1728cf755 Mon Sep 17 00:00:00 2001 From: Adam Hill Date: Mon, 8 Jan 2018 12:53:45 -0600 Subject: [PATCH 03/20] Update install.sh --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 69fc24bd7..fb721afe7 100755 --- a/install.sh +++ b/install.sh @@ -13,7 +13,7 @@ mv "$(which systemctl)" /bin/no_systemctl && \ mv "$(which debconf-apt-progress)" /bin/no_debconf-apt-progress # Get the install functions -CUSTOM_INSTALL='677033afcae14738116f1080a4dc08031b72eb62' +# CUSTOM_INSTALL='677033afcae14738116f1080a4dc08031b72eb62' wget -O "$PIHOLE_INSTALL" https://raw.githubusercontent.com/pi-hole/pi-hole/${CUSTOM_INSTALL:-$CORE_TAG}/automated%20install/basic-install.sh PH_TEST=true . "${PIHOLE_INSTALL}" From ec9f513beb94e4e71c383b10b2c9e239d7c7d866 Mon Sep 17 00:00:00 2001 From: Adam Hill Date: Wed, 10 Jan 2018 09:26:55 -0600 Subject: [PATCH 04/20] Update Dockerfile.py --- Dockerfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.py b/Dockerfile.py index 37a3f5c5a..b8855b7a0 100755 --- a/Dockerfile.py +++ b/Dockerfile.py @@ -40,7 +40,7 @@ images = { 'debian': [ { - 'base': 'debian:jessie', + 'base': 'debian:stretch', 'arch': 'amd64' }, { From d30f024db1c6044f957a3bab791b4266db439592 Mon Sep 17 00:00:00 2001 From: Adam Hill Date: Wed, 10 Jan 2018 10:05:27 -0600 Subject: [PATCH 05/20] Update install.sh --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index fb721afe7..e9e480540 100755 --- a/install.sh +++ b/install.sh @@ -1,9 +1,9 @@ #!/bin/bash -ex mkdir -p /etc/pihole/ -export CORE_TAG='v3.3-rc1' +export CORE_TAG='v3.2.1' export WEB_TAG='v3.2.1' export FTL_TAG='v2.13.2' -export USE_DEVELOPMENT_BRANCHES=false +export USE_DEVELOPMENT_BRANCHES=true # Make pihole scripts fail searching for `systemctl`, # which fails pretty miserably in docker compared to `service` @@ -13,7 +13,7 @@ mv "$(which systemctl)" /bin/no_systemctl && \ mv "$(which debconf-apt-progress)" /bin/no_debconf-apt-progress # Get the install functions -# CUSTOM_INSTALL='677033afcae14738116f1080a4dc08031b72eb62' +CUSTOM_INSTALL='development' wget -O "$PIHOLE_INSTALL" https://raw.githubusercontent.com/pi-hole/pi-hole/${CUSTOM_INSTALL:-$CORE_TAG}/automated%20install/basic-install.sh PH_TEST=true . "${PIHOLE_INSTALL}" From 16127f48fc4412f9a64fab701a3023df408c039c Mon Sep 17 00:00:00 2001 From: diginc Date: Thu, 25 Jan 2018 12:44:32 -0600 Subject: [PATCH 06/20] split build out from dockerfile.py to print to buffer and prevent timeout --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4623f2450..a672b686f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,8 @@ script: # prepare qemu - docker run --rm --privileged multiarch/qemu-user-static:register --reset # generate and build dockerfile - - ./Dockerfile.py --os=${OS} --arch=${ARCH} -v + - ./Dockerfile.py --os=${OS} --arch=${ARCH} -v --no-build + - docker build --pull --cache-from="diginc/pi-hole:debian_${ARCH},pi-hole:debian_${ARCH}" -f Dockerfile_debian_${ARCH} -t pi-hole:debian_${ARCH} . - docker images # run docker build & tests - py.test -vv -n auto -k "${OS}-${ARCH}" ./test/ From 62ddf72d157b92d4d00e71f15cd2745b467cbd3e Mon Sep 17 00:00:00 2001 From: diginc Date: Thu, 25 Jan 2018 12:45:05 -0600 Subject: [PATCH 07/20] exit on config fest failure --- bash_functions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash_functions.sh b/bash_functions.sh index 51a41a321..56d0a24b5 100644 --- a/bash_functions.sh +++ b/bash_functions.sh @@ -227,9 +227,9 @@ test_configs() { test_configs_debian() { set -e echo -n '::: Testing DNSmasq config: ' - dnsmasq --test -7 /etc/dnsmasq.d + dnsmasq --test -7 /etc/dnsmasq.d || exit 1 echo -n '::: Testing lighttpd config: ' - lighttpd -t -f /etc/lighttpd/lighttpd.conf + lighttpd -t -f /etc/lighttpd/lighttpd.conf || exit 1 set +e echo "::: All config checks passed, starting ..." } From 4ab2a96552b623b338ae9e2d55c44eec5c4ab28a Mon Sep 17 00:00:00 2001 From: diginc Date: Thu, 25 Jan 2018 12:46:52 -0600 Subject: [PATCH 08/20] remove 127.0.0.1 dns as that is supposed to no longer be an issue I think --- test/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/conftest.py b/test/conftest.py index f122a65f3..fd559ef0c 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -8,7 +8,7 @@ def DockerGeneric(request, args, image, cmd): assert 'docker' in check_output('id'), "Are you in the docker group?" if 'pi-hole' in image: - args += " --dns 127.0.0.1 -v /dev/null:/etc/pihole/adlists.default -e PYTEST=\"True\"" + args += " -v /dev/null:/etc/pihole/adlists.default -e PYTEST=\"True\"" docker_run = "docker run -d {} {} {}".format(args, image, cmd) print docker_run docker_id = check_output(docker_run) From 75fc2771d10ab9c6b64c62e87febbb691e86cdfc Mon Sep 17 00:00:00 2001 From: Gavin Mogan Date: Fri, 26 Jan 2018 13:45:15 -0800 Subject: [PATCH 09/20] Switch base images to debian stretch --- Dockerfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile.py b/Dockerfile.py index 37a3f5c5a..ea56ccc66 100755 --- a/Dockerfile.py +++ b/Dockerfile.py @@ -40,15 +40,15 @@ images = { 'debian': [ { - 'base': 'debian:jessie', + 'base': 'debian:stretch', 'arch': 'amd64' }, { - 'base': 'multiarch/debian-debootstrap:armhf-jessie-slim', + 'base': 'multiarch/debian-debootstrap:armhf-stretch-slim', 'arch': 'armhf' }, { - 'base': 'multiarch/debian-debootstrap:arm64-jessie-slim', + 'base': 'multiarch/debian-debootstrap:arm64-stretch-slim', 'arch': 'aarch64' } ] From 47a7419d1375bd634caae5420f355e60fd435575 Mon Sep 17 00:00:00 2001 From: Gavin Mogan Date: Fri, 26 Jan 2018 13:46:17 -0800 Subject: [PATCH 10/20] Force non interactive, and only attempt to move systemctl and apt if exist --- Dockerfile.template | 1 + install.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile.template b/Dockerfile.template index bb39063bf..5f57f14e3 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -4,6 +4,7 @@ LABEL image="{{ pihole.name }}:{{ pihole.os }}_{{ pihole.arch }}" LABEL maintainer="{{ pihole.maintainer }}" LABEL url="https://www.github.com/diginc/docker-pi-hole" +ARG DEBIAN_FRONTED=noninteractive ENV TAG {{ pihole.os }} ENV ARCH {{ pihole.arch }} ENV PATH /opt/pihole:${PATH} diff --git a/install.sh b/install.sh index b7187b2e6..f6ae4ee5d 100755 --- a/install.sh +++ b/install.sh @@ -8,9 +8,9 @@ export USE_DEVELOPMENT_BRANCHES=false # Make pihole scripts fail searching for `systemctl`, # which fails pretty miserably in docker compared to `service` # For more info see docker/docker issue #7459 -mv "$(which systemctl)" /bin/no_systemctl && \ +which systemctl && mv "$(which systemctl)" /bin/no_systemctl # debconf-apt-progress seems to hang so get rid of it too -mv "$(which debconf-apt-progress)" /bin/no_debconf-apt-progress +which which debconf-apt-progress && mv "$(which debconf-apt-progress)" /bin/no_debconf-apt-progress # Get the install functions wget -O "$PIHOLE_INSTALL" https://raw.githubusercontent.com/pi-hole/pi-hole/${CORE_TAG}/automated%20install/basic-install.sh From 7664a1252ffe336d9bc936650de51e254b080c62 Mon Sep 17 00:00:00 2001 From: Gavin Mogan Date: Fri, 26 Jan 2018 13:46:48 -0800 Subject: [PATCH 11/20] install procps so pgrep/pkill/etc still exists --- Dockerfile.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.template b/Dockerfile.template index 5f57f14e3..cfdff6fef 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -15,7 +15,7 @@ ENV PIHOLE_INSTALL /tmp/ph_install.sh ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/{{ pihole.s6_version }}/s6-overlay-{{ pihole.arch }}.tar.gz RUN apt-get update && \ - apt-get install -y wget curl net-tools cron && \ + apt-get install -y wget curl net-tools cron procps && \ curl -L -s $S6OVERLAY_RELEASE \ | tar xvzf - -C / && \ docker-install.sh && \ From b517ecfe6ca078de338f3da8cf6e8177aaeb08c3 Mon Sep 17 00:00:00 2001 From: Gavin Mogan Date: Fri, 26 Jan 2018 13:47:20 -0800 Subject: [PATCH 12/20] Updated template releases --- Dockerfile_debian_aarch64 | 5 +++-- Dockerfile_debian_amd64 | 5 +++-- Dockerfile_debian_armhf | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Dockerfile_debian_aarch64 b/Dockerfile_debian_aarch64 index d0a148140..c22ec6400 100644 --- a/Dockerfile_debian_aarch64 +++ b/Dockerfile_debian_aarch64 @@ -1,9 +1,10 @@ -FROM multiarch/debian-debootstrap:arm64-jessie-slim +FROM multiarch/debian-debootstrap:arm64-stretch-slim LABEL image="diginc/pi-hole:debian_aarch64" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/diginc/docker-pi-hole" +ARG DEBIAN_FRONTED=noninteractive ENV TAG debian ENV ARCH aarch64 ENV PATH /opt/pihole:${PATH} @@ -14,7 +15,7 @@ ENV PIHOLE_INSTALL /tmp/ph_install.sh ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.2/s6-overlay-aarch64.tar.gz RUN apt-get update && \ - apt-get install -y wget curl net-tools cron && \ + apt-get install -y wget curl net-tools cron procps && \ curl -L -s $S6OVERLAY_RELEASE \ | tar xvzf - -C / && \ docker-install.sh && \ diff --git a/Dockerfile_debian_amd64 b/Dockerfile_debian_amd64 index 79177387c..e5ffef9b3 100644 --- a/Dockerfile_debian_amd64 +++ b/Dockerfile_debian_amd64 @@ -1,9 +1,10 @@ -FROM debian:jessie +FROM debian:stretch LABEL image="diginc/pi-hole:debian_amd64" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/diginc/docker-pi-hole" +ARG DEBIAN_FRONTED=noninteractive ENV TAG debian ENV ARCH amd64 ENV PATH /opt/pihole:${PATH} @@ -14,7 +15,7 @@ ENV PIHOLE_INSTALL /tmp/ph_install.sh ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.2/s6-overlay-amd64.tar.gz RUN apt-get update && \ - apt-get install -y wget curl net-tools cron && \ + apt-get install -y wget curl net-tools cron procps && \ curl -L -s $S6OVERLAY_RELEASE \ | tar xvzf - -C / && \ docker-install.sh && \ diff --git a/Dockerfile_debian_armhf b/Dockerfile_debian_armhf index 507e0d049..4102ec985 100644 --- a/Dockerfile_debian_armhf +++ b/Dockerfile_debian_armhf @@ -1,9 +1,10 @@ -FROM multiarch/debian-debootstrap:armhf-jessie-slim +FROM multiarch/debian-debootstrap:armhf-stretch-slim LABEL image="diginc/pi-hole:debian_armhf" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/diginc/docker-pi-hole" +ARG DEBIAN_FRONTED=noninteractive ENV TAG debian ENV ARCH armhf ENV PATH /opt/pihole:${PATH} @@ -14,7 +15,7 @@ ENV PIHOLE_INSTALL /tmp/ph_install.sh ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.2/s6-overlay-armhf.tar.gz RUN apt-get update && \ - apt-get install -y wget curl net-tools cron && \ + apt-get install -y wget curl net-tools cron procps && \ curl -L -s $S6OVERLAY_RELEASE \ | tar xvzf - -C / && \ docker-install.sh && \ From 9b7e3998d61e6eea87c4f9a51ccf7d453f9e8b10 Mon Sep 17 00:00:00 2001 From: diginc Date: Fri, 26 Jan 2018 18:26:46 -0600 Subject: [PATCH 13/20] Fix ServerIP v4 validation - error can also be about DNS not being up yet --- bash_functions.sh | 2 +- install.sh | 2 +- s6/debian-root/etc/cont-init.d/20-start.sh | 7 +++++-- start.sh | 1 + test/conftest.py | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bash_functions.sh b/bash_functions.sh index 56d0a24b5..dd8460011 100644 --- a/bash_functions.sh +++ b/bash_functions.sh @@ -19,7 +19,7 @@ validate_env() { nc_error='Name or service not known' # Required ServerIP is a valid IP - if nc -w1 -z "$ServerIP" 53 2>&1 | grep -q "$nc_error" ; then + if [[ "$(nc -4 -w1 -z "$ServerIP" 53 2>&1)" != "" ]]; then echo "ERROR: ServerIP Environment variable ($ServerIP) doesn't appear to be a valid IPv4 address" exit 1 fi diff --git a/install.sh b/install.sh index dde8c40f3..3c2b66751 100755 --- a/install.sh +++ b/install.sh @@ -60,7 +60,7 @@ sed -i $'s/helpFunc() {/unsupportedFunc() {\\\n echo "Function not supported in # Replace references to `updatePiholeFunc` with new `unsupportedFunc` sed -i $'s/updatePiholeFunc;;/unsupportedFunc;;/g' /usr/local/bin/pihole -mv "${tmpLog}" "${instalLogLoc}" +mv "${tmpLog}" / touch /.piholeFirstBoot # Fix dnsmasq in docker diff --git a/s6/debian-root/etc/cont-init.d/20-start.sh b/s6/debian-root/etc/cont-init.d/20-start.sh index 3f85e7e07..22a709260 100644 --- a/s6/debian-root/etc/cont-init.d/20-start.sh +++ b/s6/debian-root/etc/cont-init.d/20-start.sh @@ -7,8 +7,11 @@ if [ "${PH_VERBOSE:-0}" -gt 0 ] ; then bashCmd='bash -e -x' fi -$bashCmd /start.sh - +# Start dnsmasq for validate_env and gravity.sh dnsmasq -7 /etc/dnsmasq.d + +$bashCmd /start.sh gravity.sh + +# Kill dnsmasq because s6 won't like it if it's running when s6 services start kill -9 $(pgrep dnsmasq) || true diff --git a/start.sh b/start.sh index 89b9ad6c6..fcb106957 100755 --- a/start.sh +++ b/start.sh @@ -18,6 +18,7 @@ export WEB_PORT . /bash_functions.sh echo " ::: Starting docker specific setup for docker diginc/pi-hole" +set -e validate_env || exit 1 prepare_setup_vars change_setting "IPV4_ADDRESS" "$ServerIP" diff --git a/test/conftest.py b/test/conftest.py index fd559ef0c..f122a65f3 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -8,7 +8,7 @@ def DockerGeneric(request, args, image, cmd): assert 'docker' in check_output('id'), "Are you in the docker group?" if 'pi-hole' in image: - args += " -v /dev/null:/etc/pihole/adlists.default -e PYTEST=\"True\"" + args += " --dns 127.0.0.1 -v /dev/null:/etc/pihole/adlists.default -e PYTEST=\"True\"" docker_run = "docker run -d {} {} {}".format(args, image, cmd) print docker_run docker_id = check_output(docker_run) From c9165850c39d99ee05013a1878e1288b95e7ee8d Mon Sep 17 00:00:00 2001 From: diginc Date: Fri, 26 Jan 2018 19:00:06 -0600 Subject: [PATCH 14/20] move init to a different name to fix s6-overlay issue #158 --- Dockerfile.template | 5 +++-- bash_functions.sh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile.template b/Dockerfile.template index cfdff6fef..f59dc8340 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -19,9 +19,10 @@ RUN apt-get update && \ curl -L -s $S6OVERLAY_RELEASE \ | tar xvzf - -C / && \ docker-install.sh && \ - rm -rf /var/cache/apt/archives /var/lib/apt/lists/* + rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && + mv /init /s6-init -ENTRYPOINT [ "/init" ] +ENTRYPOINT [ "/s6-init" ] ADD s6/{{ pihole.os }}-root / COPY s6/service /usr/local/bin/service diff --git a/bash_functions.sh b/bash_functions.sh index dd8460011..eedd3b8b1 100644 --- a/bash_functions.sh +++ b/bash_functions.sh @@ -31,7 +31,7 @@ validate_env() { unset ServerIPv6 exit 1 fi - if nc -w 1 -z "$ServerIPv6" 53 2>&1 | grep -q "$nc_error" || ! ip route get "$ServerIPv6" > /dev/null ; then + if nc -6 -w 1 -z "$ServerIPv6" 53 2>&1 | grep -q "$nc_error" || ! ip route get "$ServerIPv6" > /dev/null ; then echo "ERROR: ServerIPv6 Environment variable ($ServerIPv6) doesn't appear to be a valid IPv6 address" echo " TIP: If your server is not IPv6 enabled just remove '-e ServerIPv6' from your docker container" exit 1 From e430d5a5e5011454aa0c3c39cbaf16034bd47f02 Mon Sep 17 00:00:00 2001 From: diginc Date: Fri, 26 Jan 2018 21:07:25 -0600 Subject: [PATCH 15/20] switch back to original build --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a672b686f..4623f2450 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,8 +17,7 @@ script: # prepare qemu - docker run --rm --privileged multiarch/qemu-user-static:register --reset # generate and build dockerfile - - ./Dockerfile.py --os=${OS} --arch=${ARCH} -v --no-build - - docker build --pull --cache-from="diginc/pi-hole:debian_${ARCH},pi-hole:debian_${ARCH}" -f Dockerfile_debian_${ARCH} -t pi-hole:debian_${ARCH} . + - ./Dockerfile.py --os=${OS} --arch=${ARCH} -v - docker images # run docker build & tests - py.test -vv -n auto -k "${OS}-${ARCH}" ./test/ From 91a483614ba35ceb0a21cec8682a1831320f7db1 Mon Sep 17 00:00:00 2001 From: diginc Date: Fri, 26 Jan 2018 21:10:56 -0600 Subject: [PATCH 16/20] updates from PR comments --- Dockerfile.template | 3 +-- Dockerfile_debian_aarch64 | 6 +++--- Dockerfile_debian_amd64 | 6 +++--- Dockerfile_debian_armhf | 6 +++--- install.sh | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Dockerfile.template b/Dockerfile.template index f59dc8340..13fe45394 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -4,7 +4,6 @@ LABEL image="{{ pihole.name }}:{{ pihole.os }}_{{ pihole.arch }}" LABEL maintainer="{{ pihole.maintainer }}" LABEL url="https://www.github.com/diginc/docker-pi-hole" -ARG DEBIAN_FRONTED=noninteractive ENV TAG {{ pihole.os }} ENV ARCH {{ pihole.arch }} ENV PATH /opt/pihole:${PATH} @@ -19,7 +18,7 @@ RUN apt-get update && \ curl -L -s $S6OVERLAY_RELEASE \ | tar xvzf - -C / && \ docker-install.sh && \ - rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && + rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && \ mv /init /s6-init ENTRYPOINT [ "/s6-init" ] diff --git a/Dockerfile_debian_aarch64 b/Dockerfile_debian_aarch64 index c22ec6400..ab5ba21bc 100644 --- a/Dockerfile_debian_aarch64 +++ b/Dockerfile_debian_aarch64 @@ -4,7 +4,6 @@ LABEL image="diginc/pi-hole:debian_aarch64" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/diginc/docker-pi-hole" -ARG DEBIAN_FRONTED=noninteractive ENV TAG debian ENV ARCH aarch64 ENV PATH /opt/pihole:${PATH} @@ -19,9 +18,10 @@ RUN apt-get update && \ curl -L -s $S6OVERLAY_RELEASE \ | tar xvzf - -C / && \ docker-install.sh && \ - rm -rf /var/cache/apt/archives /var/lib/apt/lists/* + rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && \ + mv /init /s6-init -ENTRYPOINT [ "/init" ] +ENTRYPOINT [ "/s6-init" ] ADD s6/debian-root / COPY s6/service /usr/local/bin/service diff --git a/Dockerfile_debian_amd64 b/Dockerfile_debian_amd64 index e5ffef9b3..0118d5f96 100644 --- a/Dockerfile_debian_amd64 +++ b/Dockerfile_debian_amd64 @@ -4,7 +4,6 @@ LABEL image="diginc/pi-hole:debian_amd64" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/diginc/docker-pi-hole" -ARG DEBIAN_FRONTED=noninteractive ENV TAG debian ENV ARCH amd64 ENV PATH /opt/pihole:${PATH} @@ -19,9 +18,10 @@ RUN apt-get update && \ curl -L -s $S6OVERLAY_RELEASE \ | tar xvzf - -C / && \ docker-install.sh && \ - rm -rf /var/cache/apt/archives /var/lib/apt/lists/* + rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && \ + mv /init /s6-init -ENTRYPOINT [ "/init" ] +ENTRYPOINT [ "/s6-init" ] ADD s6/debian-root / COPY s6/service /usr/local/bin/service diff --git a/Dockerfile_debian_armhf b/Dockerfile_debian_armhf index 4102ec985..cc92bc8d2 100644 --- a/Dockerfile_debian_armhf +++ b/Dockerfile_debian_armhf @@ -4,7 +4,6 @@ LABEL image="diginc/pi-hole:debian_armhf" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/diginc/docker-pi-hole" -ARG DEBIAN_FRONTED=noninteractive ENV TAG debian ENV ARCH armhf ENV PATH /opt/pihole:${PATH} @@ -19,9 +18,10 @@ RUN apt-get update && \ curl -L -s $S6OVERLAY_RELEASE \ | tar xvzf - -C / && \ docker-install.sh && \ - rm -rf /var/cache/apt/archives /var/lib/apt/lists/* + rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && \ + mv /init /s6-init -ENTRYPOINT [ "/init" ] +ENTRYPOINT [ "/s6-init" ] ADD s6/debian-root / COPY s6/service /usr/local/bin/service diff --git a/install.sh b/install.sh index 3c2b66751..d74791d9e 100755 --- a/install.sh +++ b/install.sh @@ -10,7 +10,7 @@ export USE_DEVELOPMENT_BRANCHES=true # For more info see docker/docker issue #7459 which systemctl && mv "$(which systemctl)" /bin/no_systemctl # debconf-apt-progress seems to hang so get rid of it too -which which debconf-apt-progress && mv "$(which debconf-apt-progress)" /bin/no_debconf-apt-progress +which debconf-apt-progress && mv "$(which debconf-apt-progress)" /bin/no_debconf-apt-progress # Get the install functions CUSTOM_INSTALL='development' From 795560f1aff5c4287e06f1447c0859b6156eff65 Mon Sep 17 00:00:00 2001 From: diginc Date: Fri, 26 Jan 2018 21:14:30 -0600 Subject: [PATCH 17/20] remove CUSTOM_INSTALL --- install.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 3ff308503..2262ddba4 100755 --- a/install.sh +++ b/install.sh @@ -5,6 +5,11 @@ export WEB_TAG='v3.2.1' export FTL_TAG='v2.13.2' export USE_DEVELOPMENT_BRANCHES=false +if [[ $USE_DEVELOPMENT_BRANCHES == true ]] ; then + # install from custom hash or branch + CORE_TAG='development' +fi + # Make pihole scripts fail searching for `systemctl`, # which fails pretty miserably in docker compared to `service` # For more info see docker/docker issue #7459 @@ -13,8 +18,7 @@ which systemctl && mv "$(which systemctl)" /bin/no_systemctl which debconf-apt-progress && mv "$(which debconf-apt-progress)" /bin/no_debconf-apt-progress # Get the install functions -CUSTOM_INSTALL='development' -wget -O "$PIHOLE_INSTALL" https://raw.githubusercontent.com/pi-hole/pi-hole/${CUSTOM_INSTALL:-$CORE_TAG}/automated%20install/basic-install.sh +wget -O "$PIHOLE_INSTALL" https://raw.githubusercontent.com/pi-hole/pi-hole/${CORE_TAG}/automated%20install/basic-install.sh PH_TEST=true . "${PIHOLE_INSTALL}" # Run only what we need from installer From 94f76397fd0fd6df7430306f99280d4f6071c216 Mon Sep 17 00:00:00 2001 From: diginc Date: Fri, 26 Jan 2018 21:25:12 -0600 Subject: [PATCH 18/20] remove redundant set -e --- Dockerfile_debian_aarch64 | 2 ++ Dockerfile_debian_amd64 | 2 ++ Dockerfile_debian_armhf | 2 ++ start.sh | 1 - 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile_debian_aarch64 b/Dockerfile_debian_aarch64 index ab5ba21bc..0a347328e 100644 --- a/Dockerfile_debian_aarch64 +++ b/Dockerfile_debian_aarch64 @@ -42,4 +42,6 @@ ENV S6_LOGGING 0 ENV S6_KEEP_ENV 1 ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2 +HEALTHCHECK CMD dig @127.0.0.1 pi.hole || exit 1 + SHELL ["/bin/bash", "-c"] \ No newline at end of file diff --git a/Dockerfile_debian_amd64 b/Dockerfile_debian_amd64 index 0118d5f96..fc22746d2 100644 --- a/Dockerfile_debian_amd64 +++ b/Dockerfile_debian_amd64 @@ -42,4 +42,6 @@ ENV S6_LOGGING 0 ENV S6_KEEP_ENV 1 ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2 +HEALTHCHECK CMD dig @127.0.0.1 pi.hole || exit 1 + SHELL ["/bin/bash", "-c"] \ No newline at end of file diff --git a/Dockerfile_debian_armhf b/Dockerfile_debian_armhf index cc92bc8d2..667f7048c 100644 --- a/Dockerfile_debian_armhf +++ b/Dockerfile_debian_armhf @@ -42,4 +42,6 @@ ENV S6_LOGGING 0 ENV S6_KEEP_ENV 1 ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2 +HEALTHCHECK CMD dig @127.0.0.1 pi.hole || exit 1 + SHELL ["/bin/bash", "-c"] \ No newline at end of file diff --git a/start.sh b/start.sh index fcb106957..89b9ad6c6 100755 --- a/start.sh +++ b/start.sh @@ -18,7 +18,6 @@ export WEB_PORT . /bash_functions.sh echo " ::: Starting docker specific setup for docker diginc/pi-hole" -set -e validate_env || exit 1 prepare_setup_vars change_setting "IPV4_ADDRESS" "$ServerIP" From a9b41c7099805bb287fa0e9ba39b2ddccc07d8f9 Mon Sep 17 00:00:00 2001 From: diginc Date: Fri, 26 Jan 2018 21:32:39 -0600 Subject: [PATCH 19/20] make the valid IP checks consistent between IPv4 and IPv6 --- bash_functions.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bash_functions.sh b/bash_functions.sh index 41b679683..a645d2d22 100644 --- a/bash_functions.sh +++ b/bash_functions.sh @@ -15,11 +15,10 @@ validate_env() { exit 1 fi; - # Debian - nc_error='Name or service not known' - # Required ServerIP is a valid IP - if [[ "$(nc -4 -w1 -z "$ServerIP" 53 2>&1)" != "" ]]; then + # nc won't throw any text based errors when it times out connecting to a valid IP, otherwise it complains about the DNS name being garbage + # if nc doesn't behave as we expect on a valid IP the routing table should be able to look it up and return a 0 retcode + if [[ "$(nc -4 -w1 -z "$ServerIP" 53 2>&1)" != "" ]] || ! ip route get "$ServerIP" > /dev/null ; then echo "ERROR: ServerIP Environment variable ($ServerIP) doesn't appear to be a valid IPv4 address" exit 1 fi @@ -31,7 +30,7 @@ validate_env() { unset ServerIPv6 exit 1 fi - if nc -6 -w 1 -z "$ServerIPv6" 53 2>&1 | grep -q "$nc_error" || ! ip route get "$ServerIPv6" > /dev/null ; then + if [[ "$(nc -6 -w1 -z "$ServerIPv6" 53 2>&1)" != "" ]] || ! ip route get "$ServerIPv6" > /dev/null ; then echo "ERROR: ServerIPv6 Environment variable ($ServerIPv6) doesn't appear to be a valid IPv6 address" echo " TIP: If your server is not IPv6 enabled just remove '-e ServerIPv6' from your docker container" exit 1 From 45f491ff7b2521e918ea266454bfb2de37f53670 Mon Sep 17 00:00:00 2001 From: diginc Date: Fri, 26 Jan 2018 23:58:47 -0600 Subject: [PATCH 20/20] use dev branches --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 2262ddba4..5d70acd23 100755 --- a/install.sh +++ b/install.sh @@ -3,7 +3,7 @@ mkdir -p /etc/pihole/ export CORE_TAG='v3.2.1' export WEB_TAG='v3.2.1' export FTL_TAG='v2.13.2' -export USE_DEVELOPMENT_BRANCHES=false +export USE_DEVELOPMENT_BRANCHES=true if [[ $USE_DEVELOPMENT_BRANCHES == true ]] ; then # install from custom hash or branch