From a7565e2b23b70357fb6fc47e0bd4d877435f292e Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 30 Jun 2024 21:14:45 +0100 Subject: [PATCH 1/3] Default upstream DNS to Google and remove the mention of the environment variable from the quickstart compose file. Signed-off-by: Adam Warner --- README.md | 4 +--- examples/docker-compose-caddy-proxy.yml | 4 +--- src/bash_functions.sh | 9 +++------ 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 2cd2b21..b1b6aa8 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,7 @@ services: # Set the appropriate timezone for your location (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones), e.g: TZ: 'Europe/London' # Set a password to access the web interface. Not setting one will result in a random password being assigned - FTLCONF_webserver_api_password: 'correct horse battery staple' - # Configure DNS upstream servers, e.g: - FTLCONF_dns_upstreams: '8.8.8.8;8.8.4.4' + FTLCONF_webserver_api_password: 'correct horse battery staple' # Volumes store your data between container upgrades volumes: # For persisting Pi-hole's databases and common configuration file diff --git a/examples/docker-compose-caddy-proxy.yml b/examples/docker-compose-caddy-proxy.yml index 49e6fde..28e7d11 100644 --- a/examples/docker-compose-caddy-proxy.yml +++ b/examples/docker-compose-caddy-proxy.yml @@ -35,9 +35,7 @@ services: # Set the appropriate timezone for your location (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones), e.g: TZ: 'Europe/London' # Set a password to access the web interface. Not setting one will result in a random password being assigned - FTLCONF_webserver_api_password: 'correct horse battery staple' - # Configure DNS upstream servers, e.g: - FTLCONF_dns_upstreams: '8.8.8.8;8.8.4.4' + FTLCONF_webserver_api_password: 'correct horse battery staple' # Volumes store your data between container upgrades volumes: # For persisting Pi-hole's databases and common configuration file diff --git a/src/bash_functions.sh b/src/bash_functions.sh index a455e1a..d732199 100644 --- a/src/bash_functions.sh +++ b/src/bash_functions.sh @@ -62,12 +62,9 @@ ensure_basic_configuration() { fi # If getFTLConfigValue "dns.upstreams" returns [], exit the container. We need upstream servers to function! - if [[ $(getFTLConfigValue "dns.upstreams") == "[]" ]]; then - echo "" - echo " [X] No DNS upstream servers are set!" - echo " [i] Recommended: Set the upstream DNS servers in the environment variable FTLCONF_dns_upstreams" - echo "" - exit 1 + if [[ $(getFTLConfigValue "dns.upstreams") == "[]" ]]; then + echo " [i] No DNS upstream set in environment or config file, defaulting to Google DNS" + setFTLConfigValue "dns.upstreams" "[\"8.8.8.8\", \"8.8.4.4\"]" fi setup_web_password From 99f459e30fe8a9fd8a8b40e99f3a41814d7a1078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Sun, 30 Jun 2024 23:30:22 +0200 Subject: [PATCH 2/3] Using grep instead of tailing FTL.log as func.stdout only captures a few lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- test/tests/test_general.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/tests/test_general.py b/test/tests/test_general.py index 78f1604..1da0579 100644 --- a/test/tests/test_general.py +++ b/test/tests/test_general.py @@ -14,14 +14,14 @@ def test_pihole_gid_env_var(docker): # Wait 5 seconds for startup, then kill the start.sh script -# Finally, tail the FTL log to see if it has been shut down cleanly +# Finally, grep the FTL log to see if it has been shut down cleanly def test_pihole_ftl_clean_shutdown(docker): func = docker.run( """ sleep 5 killall --signal 15 start.sh sleep 5 - tail -f /var/log/pihole-FTL.log + grep 'jmpret\|terminated' /var/log/pihole/FTL.log """ ) assert "INFO: Shutting down... // exit code 0 // jmpret 0" in func.stdout From 2922fbdc428c7e9b80190f7841c68d33b8c28d6d Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Tue, 2 Jul 2024 20:02:15 +0100 Subject: [PATCH 3/3] Update src/bash_functions.sh Co-authored-by: yubiuser Signed-off-by: Adam Warner --- src/bash_functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bash_functions.sh b/src/bash_functions.sh index d732199..cc4f1c8 100644 --- a/src/bash_functions.sh +++ b/src/bash_functions.sh @@ -61,7 +61,7 @@ ensure_basic_configuration() { chown pihole:pihole /macvendor.db fi - # If getFTLConfigValue "dns.upstreams" returns [], exit the container. We need upstream servers to function! + # If getFTLConfigValue "dns.upstreams" returns [], default to Google's DNS server if [[ $(getFTLConfigValue "dns.upstreams") == "[]" ]]; then echo " [i] No DNS upstream set in environment or config file, defaulting to Google DNS" setFTLConfigValue "dns.upstreams" "[\"8.8.8.8\", \"8.8.4.4\"]"