From 6e38238dc1ce761f5331d69ce0c59a6fc864cfc4 Mon Sep 17 00:00:00 2001 From: Warren Fisher <40742485+warren-fisher@users.noreply.github.com> Date: Fri, 15 Nov 2019 12:11:49 -0400 Subject: [PATCH 01/19] Add to Ubuntu install section Add info about restarting systemd-resolved Signed-off-by: Warren Fisher Add to Ubuntu install section Signed-off-by: Warren Fisher --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1b1b8a4..12490e7 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,7 @@ The stub resolver should be disabled with: `sudo sed -r -i.orig 's/#?DNSStubList This will not change the nameserver settings, which point to the stub resolver thus preventing DNS resolution. Change the `/etc/resolv.conf` symlink to point to `/run/systemd/resolve/resolv.conf`, which is automatically updated to follow the system's [`netplan`](https://netplan.io/): `sudo sh -c 'rm /etc/resolv.conf && ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf'` +After making these changes, you should restart systemd-resolved using `systemctl restart systemd-resolved` Once pi-hole is installed, you'll want to configure your clients to use it ([see here](https://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245)). If you used the symlink above, your docker host will either use whatever is served by DHCP, or whatever static setting you've configured. If you want to explicitly set your docker host's nameservers you can edit the netplan(s) found at `/etc/netplan`, then run `sudo netplan apply`. Example netplan: From c88f12a35147c5e525a702c646398c102fd91d77 Mon Sep 17 00:00:00 2001 From: Warren Fisher Date: Sun, 17 Nov 2019 16:21:38 -0400 Subject: [PATCH 02/19] Update pytest for travisCI Signed-off-by: Warren Fisher --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ca0d8ca..5b1d681 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ docker-compose jinja2 -pytest>=3.6.0 +pytest>=4.4.0 pytest-cov pytest-xdist testinfra==1.5.1 From e92dfcfa387a456a57394f35de00f75e492a26d8 Mon Sep 17 00:00:00 2001 From: Warren Fisher Date: Sun, 17 Nov 2019 16:30:34 -0400 Subject: [PATCH 03/19] Revert "Update pytest for travisCI" This reverts commit fcbe538aa932f7070b655b6ae901670a4216bdef. Signed-off-by: Warren Fisher --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5b1d681..ca0d8ca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ docker-compose jinja2 -pytest>=4.4.0 +pytest>=3.6.0 pytest-cov pytest-xdist testinfra==1.5.1 From fe545c6bb23e7f73e6bbf109d3d22e8ee443e689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B0=D0=B7=D0=B0=D1=80=20=D0=AF=D1=80=D0=BE=D1=81?= =?UTF-8?q?=D0=BB=D0=B0=D0=B2=D0=BE=D0=B2=D0=B8=D1=87=20=D0=9A=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=B5=D1=86=D1=8C=D0=BA=D0=B8=D0=B9?= Date: Tue, 4 Feb 2020 21:41:44 +0200 Subject: [PATCH 04/19] add missing env variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix issue #553 now you can access your pi-hole server externaly Signed-off-by: Назар Ярославович Костецький --- docker_run.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker_run.sh b/docker_run.sh index 071f83d..e14d33d 100755 --- a/docker_run.sh +++ b/docker_run.sh @@ -12,6 +12,10 @@ docker run -d \ -v "$(pwd)/etc-dnsmasq.d/:/etc/dnsmasq.d/" \ --dns=127.0.0.1 --dns=1.1.1.1 \ --restart=unless-stopped \ + --hostname pi.hole \ + -e VIRTUAL_HOST="pi.hole" \ + -e PROXY_LOCATION="pi.hole" \ + -e ServerIP="127.0.0.1" \ # should be replaced with your external ip pihole/pihole:latest printf 'Starting up pihole container ' From 1add81a1ceafec9a26416d9f3c224cfbb06c823d Mon Sep 17 00:00:00 2001 From: losuler Date: Sun, 9 Feb 2020 17:21:02 +1100 Subject: [PATCH 05/19] Fix minor spelling mistake Signed-off-by: losuler --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b4bfdc2..d326515 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ A [Docker](https://www.docker.com/what-docker) project to make a lightweight x86 This container uses 2 popular ports, port 53 and port 80, so **may conflict with existing applications ports**. If you have no other services or docker containers using port 53/80 (if you do, keep reading below for a reverse proxy example), the minimum arguments required to run this container are in the script [docker_run.sh](https://github.com/pi-hole/docker-pi-hole/blob/master/docker_run.sh) -If you're using a Red Hat based distrubution with an SELinux Enforcing policy add `:z` to line with volumes like so: +If you're using a Red Hat based distribution with an SELinux Enforcing policy add `:z` to line with volumes like so: ``` -v "$(pwd)/etc-pihole/:/etc/pihole/:z" \ From bf0a9190c82946b9d6be6815993b281989205432 Mon Sep 17 00:00:00 2001 From: Scott Kirkpatrick Date: Sun, 9 Feb 2020 11:19:04 -0500 Subject: [PATCH 06/19] Minor spelling mistake in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b1b8a4..9838395 100644 --- a/README.md +++ b/README.md @@ -177,7 +177,7 @@ The primary docker tags / versions are explained in the following table. [Click | tag | architecture | description | Dockerfile | | --- | ------------ | ----------- | ---------- | | `latest` | auto detect | x86, arm, or arm64 container, docker auto detects your architecture. | [Dockerfile](https://github.com/pi-hole/docker-pi-hole/blob/master/Dockerfile_amd64) | -| `v4.0.0-1` | auto detect | Versioned tags, if you want to pin against a specific version, use one of thesse | | +| `v4.0.0-1` | auto detect | Versioned tags, if you want to pin against a specific version, use one of these | | | `v4.0.0-1_` | based on tag | Specific architectures tags | | | `dev` | auto detect | like latest tag, but for the development branch (pushed occasionally) | | From c024dcd8d9e00687e7efc7a874476b5758e17d65 Mon Sep 17 00:00:00 2001 From: Adam Hill Date: Sun, 23 Feb 2020 22:33:36 -0600 Subject: [PATCH 07/19] Upgrade v4.3.3 Also remove ipv6 from tests, validation fails and breaks tests Signed-off-by: Adam Hill --- Dockerfile_amd64 | 4 ++-- Dockerfile_arm64 | 4 ++-- Dockerfile_armel | 4 ++-- VERSION | 2 +- test/conftest.py | 4 ++-- tox.ini | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Dockerfile_amd64 b/Dockerfile_amd64 index ef4aee0..a3a3883 100644 --- a/Dockerfile_amd64 +++ b/Dockerfile_amd64 @@ -37,10 +37,10 @@ ENV ServerIP 0.0.0.0 ENV FTL_CMD no-daemon ENV DNSMASQ_USER root -ENV VERSION v4.3.2 +ENV VERSION v4.3.3 ENV PATH /opt/pihole:${PATH} -LABEL image="pihole/pihole:v4.3.2_amd64" +LABEL image="pihole/pihole:v4.3.3_amd64" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/pi-hole/docker-pi-hole" diff --git a/Dockerfile_arm64 b/Dockerfile_arm64 index 54c9cb3..cede65c 100644 --- a/Dockerfile_arm64 +++ b/Dockerfile_arm64 @@ -37,10 +37,10 @@ ENV ServerIP 0.0.0.0 ENV FTL_CMD no-daemon ENV DNSMASQ_USER root -ENV VERSION v4.3.2 +ENV VERSION v4.3.3 ENV PATH /opt/pihole:${PATH} -LABEL image="pihole/pihole:v4.3.2_arm64" +LABEL image="pihole/pihole:v4.3.3_arm64" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/pi-hole/docker-pi-hole" diff --git a/Dockerfile_armel b/Dockerfile_armel index 7b0c034..8c97983 100644 --- a/Dockerfile_armel +++ b/Dockerfile_armel @@ -37,10 +37,10 @@ ENV ServerIP 0.0.0.0 ENV FTL_CMD no-daemon ENV DNSMASQ_USER root -ENV VERSION v4.3.2 +ENV VERSION v4.3.3 ENV PATH /opt/pihole:${PATH} -LABEL image="pihole/pihole:v4.3.2_armel" +LABEL image="pihole/pihole:v4.3.3_armel" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/pi-hole/docker-pi-hole" diff --git a/VERSION b/VERSION index db6ecdd..5d3e685 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v4.3.2 +v4.3.3 diff --git a/test/conftest.py b/test/conftest.py index bbe0a3c..546fde6 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -24,7 +24,7 @@ def args_volumes(): @pytest.fixture() def args_env(): - return '-e ServerIP="127.0.0.1" -e ServerIPv6="::1"' + return '-e ServerIP="127.0.0.1"' @pytest.fixture() def args(args_dns, args_volumes, args_env): @@ -120,7 +120,7 @@ def persist_args_volumes(): @pytest.fixture(scope='module') def persist_args_env(): - return '-e ServerIP="127.0.0.1" -e ServerIPv6="::1"' + return '-e ServerIP="127.0.0.1"' @pytest.fixture(scope='module') def persist_args(persist_args_dns, persist_args_volumes, persist_args_env): diff --git a/tox.ini b/tox.ini index d1f48a7..7ab2c20 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py37 +envlist = py38 [testenv] whitelist_externals = docker From 6bf15d65774503cd4d241761373e28291154b736 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 24 Feb 2020 18:05:02 +0000 Subject: [PATCH 08/19] update for core 4.3.4 Signed-off-by: Adam Warner --- Dockerfile_amd64 | 4 ++-- Dockerfile_arm64 | 4 ++-- Dockerfile_armel | 4 ++-- Dockerfile_armhf | 4 ++-- VERSION | 2 +- install.sh | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Dockerfile_amd64 b/Dockerfile_amd64 index a3a3883..fc7882c 100644 --- a/Dockerfile_amd64 +++ b/Dockerfile_amd64 @@ -37,10 +37,10 @@ ENV ServerIP 0.0.0.0 ENV FTL_CMD no-daemon ENV DNSMASQ_USER root -ENV VERSION v4.3.3 +ENV VERSION v4.3.4 ENV PATH /opt/pihole:${PATH} -LABEL image="pihole/pihole:v4.3.3_amd64" +LABEL image="pihole/pihole:v4.3.4_amd64" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/pi-hole/docker-pi-hole" diff --git a/Dockerfile_arm64 b/Dockerfile_arm64 index cede65c..a3347be 100644 --- a/Dockerfile_arm64 +++ b/Dockerfile_arm64 @@ -37,10 +37,10 @@ ENV ServerIP 0.0.0.0 ENV FTL_CMD no-daemon ENV DNSMASQ_USER root -ENV VERSION v4.3.3 +ENV VERSION v4.3.4 ENV PATH /opt/pihole:${PATH} -LABEL image="pihole/pihole:v4.3.3_arm64" +LABEL image="pihole/pihole:v4.3.4_arm64" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/pi-hole/docker-pi-hole" diff --git a/Dockerfile_armel b/Dockerfile_armel index 8c97983..3ffd82b 100644 --- a/Dockerfile_armel +++ b/Dockerfile_armel @@ -37,10 +37,10 @@ ENV ServerIP 0.0.0.0 ENV FTL_CMD no-daemon ENV DNSMASQ_USER root -ENV VERSION v4.3.3 +ENV VERSION v4.3.4 ENV PATH /opt/pihole:${PATH} -LABEL image="pihole/pihole:v4.3.3_armel" +LABEL image="pihole/pihole:v4.3.4_armel" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/pi-hole/docker-pi-hole" diff --git a/Dockerfile_armhf b/Dockerfile_armhf index 611e6c0..807746a 100644 --- a/Dockerfile_armhf +++ b/Dockerfile_armhf @@ -37,10 +37,10 @@ ENV ServerIP 0.0.0.0 ENV FTL_CMD no-daemon ENV DNSMASQ_USER root -ENV VERSION v4.3.2 +ENV VERSION v4.3.4 ENV PATH /opt/pihole:${PATH} -LABEL image="pihole/pihole:v4.3.2_armhf" +LABEL image="pihole/pihole:v4.3.4_armhf" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/pi-hole/docker-pi-hole" diff --git a/VERSION b/VERSION index 5d3e685..e9dc90d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v4.3.3 +v4.3.4 diff --git a/install.sh b/install.sh index 2126319..9748e3d 100755 --- a/install.sh +++ b/install.sh @@ -4,7 +4,7 @@ mkdir -p /etc/pihole/ mkdir -p /var/run/pihole # Production tags with valid web footers export CORE_VERSION="$(cat /etc/docker-pi-hole-version)" -export WEB_VERSION="$(cat /etc/docker-pi-hole-version)" +export WEB_VERSION="v4.3.3" # Only use for pre-production / testing export CHECKOUT_BRANCHES=false From c0c72219a9f37e1d8fe0b5f8cd1f8ab7d177a016 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Mon, 24 Feb 2020 20:18:27 +0000 Subject: [PATCH 09/19] Did I say 4.3.4? I spoke too soon Signed-off-by: Adam Warner --- Dockerfile_amd64 | 4 ++-- Dockerfile_arm64 | 4 ++-- Dockerfile_armel | 4 ++-- Dockerfile_armhf | 4 ++-- VERSION | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Dockerfile_amd64 b/Dockerfile_amd64 index fc7882c..96e5b4a 100644 --- a/Dockerfile_amd64 +++ b/Dockerfile_amd64 @@ -37,10 +37,10 @@ ENV ServerIP 0.0.0.0 ENV FTL_CMD no-daemon ENV DNSMASQ_USER root -ENV VERSION v4.3.4 +ENV VERSION v4.3.5 ENV PATH /opt/pihole:${PATH} -LABEL image="pihole/pihole:v4.3.4_amd64" +LABEL image="pihole/pihole:v4.3.5_amd64" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/pi-hole/docker-pi-hole" diff --git a/Dockerfile_arm64 b/Dockerfile_arm64 index a3347be..7d89c44 100644 --- a/Dockerfile_arm64 +++ b/Dockerfile_arm64 @@ -37,10 +37,10 @@ ENV ServerIP 0.0.0.0 ENV FTL_CMD no-daemon ENV DNSMASQ_USER root -ENV VERSION v4.3.4 +ENV VERSION v4.3.5 ENV PATH /opt/pihole:${PATH} -LABEL image="pihole/pihole:v4.3.4_arm64" +LABEL image="pihole/pihole:v4.3.5_arm64" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/pi-hole/docker-pi-hole" diff --git a/Dockerfile_armel b/Dockerfile_armel index 3ffd82b..c775de0 100644 --- a/Dockerfile_armel +++ b/Dockerfile_armel @@ -37,10 +37,10 @@ ENV ServerIP 0.0.0.0 ENV FTL_CMD no-daemon ENV DNSMASQ_USER root -ENV VERSION v4.3.4 +ENV VERSION v4.3.5 ENV PATH /opt/pihole:${PATH} -LABEL image="pihole/pihole:v4.3.4_armel" +LABEL image="pihole/pihole:v4.3.5_armel" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/pi-hole/docker-pi-hole" diff --git a/Dockerfile_armhf b/Dockerfile_armhf index 807746a..a76e287 100644 --- a/Dockerfile_armhf +++ b/Dockerfile_armhf @@ -37,10 +37,10 @@ ENV ServerIP 0.0.0.0 ENV FTL_CMD no-daemon ENV DNSMASQ_USER root -ENV VERSION v4.3.4 +ENV VERSION v4.3.5 ENV PATH /opt/pihole:${PATH} -LABEL image="pihole/pihole:v4.3.4_armhf" +LABEL image="pihole/pihole:v4.3.5_armhf" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/pi-hole/docker-pi-hole" diff --git a/VERSION b/VERSION index e9dc90d..5343eea 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v4.3.4 +v4.3.5 From cf6d74a2be829bcbfde3799bad0a824a83b4b49a Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 24 Feb 2020 22:39:24 -0500 Subject: [PATCH 10/19] Improve healthcheck responsiveness. By default, dig will retry 2 times (for a total of 3 attempts) to get a response back. Each attempt defaults to 5 seconds. Before this change, a single docker healtcheck failure would really mean three failures and would take a total of 15 seconds before failing. By default, docker healthchecks will retry 3 times before considering a service unhealhy (with a 30 second interval). Combined with dig retries, this means it would take a total of 9 failed DNS responses before it considers the pihole to be unhealthy. Combining the retry between dig and docker, dig considers it a success if even 1/3 responses are recieved - and docker considers it a success if only 1/3 of those successes are successful. I'm not great at math - and order does make a difference - but I think that means as long as 1/9th of DNS queries are being answered - then docker thinks its healthy. Anyways, long story sort, dig doesn't need to have its own retry logic since docker already has a configuarable retry. I also disable recurse since the goal is to test this specific instance. Also removed duplicate import statement. Signed-off-by: Daniel --- Dockerfile.py | 1 - Dockerfile.template | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile.py b/Dockerfile.py index 91f808a..c0c2717 100755 --- a/Dockerfile.py +++ b/Dockerfile.py @@ -17,7 +17,6 @@ Examples: """ -from docopt import docopt from jinja2 import Environment, FileSystemLoader from docopt import docopt import os diff --git a/Dockerfile.template b/Dockerfile.template index c492092..cce6af4 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -44,6 +44,6 @@ LABEL image="{{ pihole.name }}:{{ pihole.version }}_{{ pihole.arch }}" LABEL maintainer="{{ pihole.maintainer }}" LABEL url="https://www.github.com/pi-hole/docker-pi-hole" -HEALTHCHECK CMD dig @127.0.0.1 pi.hole || exit 1 +HEALTHCHECK CMD dig +norecurse +retry=0 @127.0.0.1 pi.hole || exit 1 SHELL ["/bin/bash", "-c"] From de7e563ad24b9ab4216e472890ba02a6469cd3b9 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 25 Feb 2020 20:57:20 +0000 Subject: [PATCH 11/19] target core version 4.4 Signed-off-by: Adam Warner --- Dockerfile_amd64 | 4 ++-- Dockerfile_arm64 | 4 ++-- Dockerfile_armel | 4 ++-- Dockerfile_armhf | 4 ++-- VERSION | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Dockerfile_amd64 b/Dockerfile_amd64 index 96e5b4a..0a18b63 100644 --- a/Dockerfile_amd64 +++ b/Dockerfile_amd64 @@ -37,10 +37,10 @@ ENV ServerIP 0.0.0.0 ENV FTL_CMD no-daemon ENV DNSMASQ_USER root -ENV VERSION v4.3.5 +ENV VERSION v4.4 ENV PATH /opt/pihole:${PATH} -LABEL image="pihole/pihole:v4.3.5_amd64" +LABEL image="pihole/pihole:v4.4_amd64" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/pi-hole/docker-pi-hole" diff --git a/Dockerfile_arm64 b/Dockerfile_arm64 index 7d89c44..c1968a9 100644 --- a/Dockerfile_arm64 +++ b/Dockerfile_arm64 @@ -37,10 +37,10 @@ ENV ServerIP 0.0.0.0 ENV FTL_CMD no-daemon ENV DNSMASQ_USER root -ENV VERSION v4.3.5 +ENV VERSION v4.4 ENV PATH /opt/pihole:${PATH} -LABEL image="pihole/pihole:v4.3.5_arm64" +LABEL image="pihole/pihole:v4.4_arm64" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/pi-hole/docker-pi-hole" diff --git a/Dockerfile_armel b/Dockerfile_armel index c775de0..b680e89 100644 --- a/Dockerfile_armel +++ b/Dockerfile_armel @@ -37,10 +37,10 @@ ENV ServerIP 0.0.0.0 ENV FTL_CMD no-daemon ENV DNSMASQ_USER root -ENV VERSION v4.3.5 +ENV VERSION v4.4 ENV PATH /opt/pihole:${PATH} -LABEL image="pihole/pihole:v4.3.5_armel" +LABEL image="pihole/pihole:v4.4_armel" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/pi-hole/docker-pi-hole" diff --git a/Dockerfile_armhf b/Dockerfile_armhf index a76e287..ca311ba 100644 --- a/Dockerfile_armhf +++ b/Dockerfile_armhf @@ -37,10 +37,10 @@ ENV ServerIP 0.0.0.0 ENV FTL_CMD no-daemon ENV DNSMASQ_USER root -ENV VERSION v4.3.5 +ENV VERSION v4.4 ENV PATH /opt/pihole:${PATH} -LABEL image="pihole/pihole:v4.3.5_armhf" +LABEL image="pihole/pihole:v4.4_armhf" LABEL maintainer="adam@diginc.us" LABEL url="https://www.github.com/pi-hole/docker-pi-hole" diff --git a/VERSION b/VERSION index 5343eea..a7021c5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v4.3.5 +v4.4 From ca9bf8ce5c9bd9befd1ac49d9020108be3a49c5f Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 25 Feb 2020 22:50:38 +0000 Subject: [PATCH 12/19] This should fix the tests Signed-off-by: Adam Warner --- test/test_bash_functions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_bash_functions.py b/test/test_bash_functions.py index acc79a9..90f8c61 100644 --- a/test/test_bash_functions.py +++ b/test/test_bash_functions.py @@ -40,7 +40,7 @@ def test_overrides_default_WEB_PORT(Docker, Slow, test_args): # grep fails to find any of the old address w/o port #assert Docker.run('grep -r "://127.0.0.1/" /var/www/html/').stdout == '' #assert Docker.run('grep -r "://pi.hole/" /var/www/html/').stdout == '' - ## Find at least one instance of our changes + ## Find at least one instance of our changes ## upstream repos determines how many and I don't want to keep updating this test #assert int(Docker.run('grep -rl "://127.0.0.1:999/" /var/www/html/ | wc -l').stdout) >= 1 #assert int(Docker.run('grep -rl "://pi.hole:999/" /var/www/html/ | wc -l').stdout) >= 1 @@ -72,7 +72,7 @@ def test_override_default_servers_with_DNS_EnvVars(Docker, Slow, args_env, expec function = Docker.run('. /bash_functions.sh ; eval `grep "^setup_dnsmasq " /start.sh`') assert expected_stdout in function.stdout expected_servers = 'server={}\n'.format(dns1) if dns2 == None else 'server={}\nserver={}\n'.format(dns1, dns2) - Slow(lambda: expected_servers == Docker.run('grep "^server=" /etc/dnsmasq.d/01-pihole.conf').stdout) + Slow(lambda: expected_servers == Docker.run('grep "^server=[^/]" /etc/dnsmasq.d/01-pihole.conf').stdout) @pytest.mark.skipif(os.environ.get('TRAVIS') == 'true', @@ -112,7 +112,7 @@ def test_DNS_Envs_are_secondary_to_setupvars(Docker, Slow, args_env, expected_st expected_servers = ['server={}'.format(dns1)] if dns2: expected_servers.append('server={}'.format(dns2)) - Slow(lambda: Docker.run('grep "^server=" /etc/dnsmasq.d/01-pihole.conf').stdout.strip().split('\n') == \ + Slow(lambda: Docker.run('grep "^server=[^/]" /etc/dnsmasq.d/01-pihole.conf').stdout.strip().split('\n') == \ expected_servers) From 730ee6952aa46b89c156c2ac9beadf56597fa6df Mon Sep 17 00:00:00 2001 From: Adam Hill Date: Tue, 25 Feb 2020 21:39:39 -0600 Subject: [PATCH 13/19] Try to deploy latest if the circle build matches latest tag Signed-off-by: Adam Hill --- circle-deploy.sh | 18 ++++++++++-------- circle-vars.sh | 9 +++++++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/circle-deploy.sh b/circle-deploy.sh index c194590..410f1eb 100755 --- a/circle-deploy.sh +++ b/circle-deploy.sh @@ -37,13 +37,15 @@ if [[ "$CIRCLE_PR_NUMBER" == "" ]]; then images+=($arch_image) done - docker manifest create $MULTIARCH_IMAGE ${images[*]} - for arch in *; do - arch_image=$(cat $arch) - docker pull $arch_image - annotate "$MULTIARCH_IMAGE" "$arch_image" "$arch" - done + for docker_tag in $MULTIARCH_IMAGE $LATEST_IMAGE; do + docker manifest create $docker_tag ${images[*]} + for arch in *; do + arch_image=$(cat $arch) + docker pull $arch_image + annotate "$docker_tag" "$arch_image" "$arch" + done - docker manifest inspect "$MULTIARCH_IMAGE" - docker manifest push "$MULTIARCH_IMAGE" + docker manifest inspect "$docker_tag" + docker manifest push "$docker_tag" + done; fi diff --git a/circle-vars.sh b/circle-vars.sh index 119f334..8483174 100755 --- a/circle-vars.sh +++ b/circle-vars.sh @@ -32,6 +32,15 @@ if [[ -n "$DOCKER_TAG" ]]; then # latest- sometimes has a trailing slash, remove it ARCH_IMAGE="${ARCH_IMAGE/%-/}" fi + +if ! latesttag=$(curl -sI https://github.com/pi-hole/docker-pi-hole/releases/latest | grep --color=never -i Location | awk -F / '{print $NF}' | tr -d '[:cntrl:]'); then + print " Failed to retrieve latest docker-pi-hole release metadata" "${CROSS}" +else + if [[ "$DOCKER_TAG" == "$latest_tag" ]] ; then + LATEST_IMAGE="$BASE_IMAGE:latest" + fi +fi + MULTIARCH_IMAGE="$BASE_IMAGE:$DOCKER_TAG" set +a From 3fb82b0fdede5003638f3cc3bfe81fa20db302a4 Mon Sep 17 00:00:00 2001 From: Adam Hill Date: Tue, 25 Feb 2020 21:43:54 -0600 Subject: [PATCH 14/19] typo Signed-off-by: Adam Hill --- circle-vars.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/circle-vars.sh b/circle-vars.sh index 8483174..e2913e7 100755 --- a/circle-vars.sh +++ b/circle-vars.sh @@ -33,8 +33,9 @@ if [[ -n "$DOCKER_TAG" ]]; then ARCH_IMAGE="${ARCH_IMAGE/%-/}" fi -if ! latesttag=$(curl -sI https://github.com/pi-hole/docker-pi-hole/releases/latest | grep --color=never -i Location | awk -F / '{print $NF}' | tr -d '[:cntrl:]'); then - print " Failed to retrieve latest docker-pi-hole release metadata" "${CROSS}" +local latest_tag +if ! latest_tag=$(curl -sI https://github.com/pi-hole/docker-pi-hole/releases/latest | grep --color=never -i Location | awk -F / '{print $NF}' | tr -d '[:cntrl:]'); then + print "Failed to retrieve latest docker-pi-hole release metadata" else if [[ "$DOCKER_TAG" == "$latest_tag" ]] ; then LATEST_IMAGE="$BASE_IMAGE:latest" From 91ab080476763824d16fc42dcd4d8c5e66972e92 Mon Sep 17 00:00:00 2001 From: Adam Hill Date: Tue, 25 Feb 2020 21:56:31 -0600 Subject: [PATCH 15/19] skip local scope coding, not needed Signed-off-by: Adam Hill --- circle-vars.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle-vars.sh b/circle-vars.sh index e2913e7..9b46480 100755 --- a/circle-vars.sh +++ b/circle-vars.sh @@ -33,7 +33,7 @@ if [[ -n "$DOCKER_TAG" ]]; then ARCH_IMAGE="${ARCH_IMAGE/%-/}" fi -local latest_tag +latest_tag='' if ! latest_tag=$(curl -sI https://github.com/pi-hole/docker-pi-hole/releases/latest | grep --color=never -i Location | awk -F / '{print $NF}' | tr -d '[:cntrl:]'); then print "Failed to retrieve latest docker-pi-hole release metadata" else From d20bde221bad0b4fa703815267de5b066aad4166 Mon Sep 17 00:00:00 2001 From: Adam Hill Date: Wed, 26 Feb 2020 08:57:38 -0600 Subject: [PATCH 16/19] Comment + test latest hub tag Signed-off-by: Adam Hill --- circle-vars.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/circle-vars.sh b/circle-vars.sh index 9b46480..23a4f95 100755 --- a/circle-vars.sh +++ b/circle-vars.sh @@ -33,12 +33,14 @@ if [[ -n "$DOCKER_TAG" ]]; then ARCH_IMAGE="${ARCH_IMAGE/%-/}" fi +# To get latest released, cut a release on https://github.com/pi-hole/docker-pi-hole/releases (manually gated for quality control) latest_tag='' if ! latest_tag=$(curl -sI https://github.com/pi-hole/docker-pi-hole/releases/latest | grep --color=never -i Location | awk -F / '{print $NF}' | tr -d '[:cntrl:]'); then print "Failed to retrieve latest docker-pi-hole release metadata" else if [[ "$DOCKER_TAG" == "$latest_tag" ]] ; then - LATEST_IMAGE="$BASE_IMAGE:latest" + #LATEST_IMAGE="$BASE_IMAGE:latest" + LATEST_IMAGE="$BASE_IMAGE:testing_latest_deleteme" fi fi From db919a22cc7f6eda085cccbbef6e5372524cebdd Mon Sep 17 00:00:00 2001 From: Adam Hill Date: Wed, 26 Feb 2020 10:30:03 -0600 Subject: [PATCH 17/19] Back to latest tag Signed-off-by: Adam Hill --- circle-vars.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/circle-vars.sh b/circle-vars.sh index 23a4f95..fbe4db1 100755 --- a/circle-vars.sh +++ b/circle-vars.sh @@ -39,8 +39,7 @@ if ! latest_tag=$(curl -sI https://github.com/pi-hole/docker-pi-hole/releases/la print "Failed to retrieve latest docker-pi-hole release metadata" else if [[ "$DOCKER_TAG" == "$latest_tag" ]] ; then - #LATEST_IMAGE="$BASE_IMAGE:latest" - LATEST_IMAGE="$BASE_IMAGE:testing_latest_deleteme" + LATEST_IMAGE="$BASE_IMAGE:latest" fi fi From 64892423b670f4631303234a137fb32abd067a09 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 26 Feb 2020 12:27:42 -0500 Subject: [PATCH 18/19] Added 'WEBPASSWORD_FILE' environment variable to enable support for Docker Secrets. If 'WEBPASSWORD' is set, 'WEBPASSWORD_FILE' is ignored. If 'WEBPASSWORD' is empty, and 'WEBPASSWORD_FILE' is set to a valid readable file, then 'WEBPASSWORD' will be set to the contents of 'WEBPASSWORD_FILE'. Signed-off-by: Daniel --- bash_functions.sh | 8 ++++++++ start.sh | 1 + 2 files changed, 9 insertions(+) diff --git a/bash_functions.sh b/bash_functions.sh index 89de84a..f09db8e 100644 --- a/bash_functions.sh +++ b/bash_functions.sh @@ -290,6 +290,14 @@ setup_web_port() { } +load_web_password_secret() { + # If WEBPASSWORD is not set at all, attempt to read password from WEBPASSWORD_FILE, + # allowing secrets to be passed via docker secrets + if [ -z "${WEBPASSWORD+x}" ] && [ -n "${WEBPASSWORD_FILE}" ] && [ -r "${WEBPASSWORD_FILE}" ]; then + WEBPASSWORD=$(<"${WEBPASSWORD_FILE}") + fi; +} + generate_password() { if [ -z "${WEBPASSWORD+x}" ] ; then # Not set at all, give the user a random pass diff --git a/start.sh b/start.sh index 9802985..815da70 100755 --- a/start.sh +++ b/start.sh @@ -42,6 +42,7 @@ docker_checks #fi fix_capabilities +load_web_password_secret generate_password validate_env || exit 1 prepare_configs From e0e6b491c978ba9e64b951e16a5f90e0bb24ccf7 Mon Sep 17 00:00:00 2001 From: Adam Hill Date: Mon, 16 Mar 2020 17:57:21 -0500 Subject: [PATCH 19/19] Update circle-deploy.sh --- circle-deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle-deploy.sh b/circle-deploy.sh index 410f1eb..884383a 100755 --- a/circle-deploy.sh +++ b/circle-deploy.sh @@ -46,6 +46,6 @@ if [[ "$CIRCLE_PR_NUMBER" == "" ]]; then done docker manifest inspect "$docker_tag" - docker manifest push "$docker_tag" + docker manifest push --purge "$docker_tag" done; fi