Merge pull request #461 from pi-hole/dev

Dev image
This commit is contained in:
Adam Hill 2019-05-30 20:15:42 -05:00 committed by GitHub
commit 9cf80692d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 32 additions and 27 deletions

View File

@ -1,5 +1,6 @@
FROM {{ pihole.base }}
ENV CONFIG_DIR /etc/pihole
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/{{ pihole.s6_version }}/s6-overlay-{{ pihole.s6arch }}.tar.gz
COPY install.sh /usr/local/bin/install.sh
COPY VERSION /etc/docker-pi-hole-version
@ -44,5 +45,6 @@ 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
VOLUME $CONFIG_DIR
SHELL ["/bin/bash", "-c"]

View File

@ -1,5 +1,6 @@
FROM multiarch/debian-debootstrap:arm64-stretch-slim
ENV CONFIG_DIR /etc/pihole
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.7.0/s6-overlay-aarch64.tar.gz
COPY install.sh /usr/local/bin/install.sh
COPY VERSION /etc/docker-pi-hole-version
@ -44,5 +45,6 @@ LABEL maintainer="adam@diginc.us"
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"
HEALTHCHECK CMD dig @127.0.0.1 pi.hole || exit 1
VOLUME $CONFIG_DIR
SHELL ["/bin/bash", "-c"]

View File

@ -1,5 +1,6 @@
FROM pihole/debian-base:latest
ENV CONFIG_DIR /etc/pihole
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.7.0/s6-overlay-amd64.tar.gz
COPY install.sh /usr/local/bin/install.sh
COPY VERSION /etc/docker-pi-hole-version
@ -44,5 +45,6 @@ LABEL maintainer="adam@diginc.us"
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"
HEALTHCHECK CMD dig @127.0.0.1 pi.hole || exit 1
VOLUME $CONFIG_DIR
SHELL ["/bin/bash", "-c"]

View File

@ -1,5 +1,6 @@
FROM multiarch/debian-debootstrap:armel-stretch-slim
ENV CONFIG_DIR /etc/pihole
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.7.0/s6-overlay-arm.tar.gz
COPY install.sh /usr/local/bin/install.sh
COPY VERSION /etc/docker-pi-hole-version
@ -44,5 +45,6 @@ LABEL maintainer="adam@diginc.us"
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"
HEALTHCHECK CMD dig @127.0.0.1 pi.hole || exit 1
VOLUME $CONFIG_DIR
SHELL ["/bin/bash", "-c"]

View File

@ -1,5 +1,6 @@
FROM multiarch/debian-debootstrap:armhf-stretch-slim
ENV CONFIG_DIR /etc/pihole
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.7.0/s6-overlay-armhf.tar.gz
COPY install.sh /usr/local/bin/install.sh
COPY VERSION /etc/docker-pi-hole-version
@ -44,5 +45,6 @@ LABEL maintainer="adam@diginc.us"
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"
HEALTHCHECK CMD dig @127.0.0.1 pi.hole || exit 1
VOLUME $CONFIG_DIR
SHELL ["/bin/bash", "-c"]

View File

@ -54,7 +54,7 @@ prepare_configs() {
touch /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
chown pihole:pihole /var/run/pihole /var/log/pihole
test -f /var/run/pihole/FTL.sock && rm /var/run/pihole/FTL.sock
chown pihole:pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /etc/pihole /etc/pihole/dhcp.leases /var/log/pihole.log
chown pihole:pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port $CONFIG_DIR $CONFIG_DIR/dhcp.leases /var/log/pihole.log
chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
set -e
# Update version numbers
@ -116,8 +116,7 @@ setup_dnsmasq_dns() {
dnsType='custom'
fi;
# TODO With the addition of this to /start.sh this needs a refactor
if [ ! -f /.piholeFirstBoot ] ; then
if [ ! -f $CONFIG_DIR/.piholeFirstBoot ] ; then
local setupDNS1="$(grep 'PIHOLE_DNS_1' ${setupVars})"
local setupDNS2="$(grep 'PIHOLE_DNS_2' ${setupVars})"
setupDNS1="${setupDNS1/PIHOLE_DNS_1=/}"

View File

@ -15,11 +15,11 @@ Please note the following about this [traefik](https://traefik.io/) example for
version: '3'
services:
#
#
traefik:
container_name: traefik
domainname: homedomain.lan
image: traefik
restart: unless-stopped
# Note I opt to whitelist certain apps for exposure to traefik instead of auto discovery
@ -42,7 +42,7 @@ services:
pihole:
container_name: pihole
domainname: homedomain.lan
image: pihole/pihole:latest
dns:
- 127.0.0.1
@ -106,4 +106,3 @@ traefik | time="2018-03-07T18:57:42Z" level=info msg="Server configuration re
```
Also your port 8080 should list the Route/Rule for pihole and backend-pihole container.

View File

@ -1,6 +1,6 @@
#!/bin/bash -ex
mkdir -p /etc/pihole/
mkdir -p $CONFIG_DIR/
mkdir -p /var/run/pihole
# Production tags with valid web footers
export CORE_VERSION="$(cat /etc/docker-pi-hole-version)"
@ -14,7 +14,7 @@ if [[ "$CORE_VERSION" == *"release/"* ]] ; then
fi
apt-get update
apt-get install -y curl procps
apt-get install --no-install-recommends -y curl procps ca-certificates
curl -L -s $S6OVERLAY_RELEASE | tar xvzf - -C /
mv /init /s6-init
@ -23,7 +23,7 @@ which debconf-apt-progress
mv "$(which debconf-apt-progress)" /bin/no_debconf-apt-progress
# Get the install functions
curl https://raw.githubusercontent.com/pi-hole/pi-hole/${CORE_VERSION}/automated%20install/basic-install.sh > "$PIHOLE_INSTALL"
curl https://raw.githubusercontent.com/pi-hole/pi-hole/${CORE_VERSION}/automated%20install/basic-install.sh > "$PIHOLE_INSTALL"
PH_TEST=true . "${PIHOLE_INSTALL}"
# Preseed variables to assist with using --unattended install
@ -58,8 +58,8 @@ apt-get install -y --force-yes netcat-openbsd
piholeGitUrl="${piholeGitUrl}"
webInterfaceGitUrl="${webInterfaceGitUrl}"
webInterfaceDir="${webInterfaceDir}"
git clone "${piholeGitUrl}" "${PI_HOLE_LOCAL_REPO}"
git clone "${webInterfaceGitUrl}" "${webInterfaceDir}"
git clone --branch "${CORE_VERSION}" --depth 1 "${piholeGitUrl}" "${PI_HOLE_LOCAL_REPO}"
git clone --branch "${WEB_VERSION}" --depth 1 "${webInterfaceGitUrl}" "${webInterfaceDir}"
tmpLog="/tmp/pihole-install.log"
installLogLoc="${installLogLoc}"
@ -83,12 +83,12 @@ else
fi
sed -i 's/readonly //g' /opt/pihole/webpage.sh
sed -i '/^WEBPASSWORD/d' /etc/pihole/setupVars.conf
sed -i '/^WEBPASSWORD/d' $CONFIG_DIR/setupVars.conf
# Replace the call to `updatePiholeFunc` in arg parse with new `unsupportedFunc`
sed -i $'s/helpFunc() {/unsupportedFunc() {\\\n echo "Function not supported in Docker images"\\\n exit 0\\\n}\\\n\\\nhelpFunc() {/g' /usr/local/bin/pihole
sed -i $'s/)\s*updatePiholeFunc/) unsupportedFunc/g' /usr/local/bin/pihole
touch /.piholeFirstBoot
touch $CONFIG_DIR/.piholeFirstBoot
echo 'Docker install successful'

View File

@ -15,7 +15,7 @@ export DNSMASQ_LISTENING_BEHAVIOUR="$DNSMASQ_LISTENING"
export IPv6
export WEB_PORT
export adlistFile='/etc/pihole/adlists.list'
export adlistFile='$CONFIG_DIR/adlists.list'
# The below functions are all contained in bash_functions.sh
. /bash_functions.sh
@ -27,16 +27,12 @@ echo " ::: Starting docker specific checks & setup for docker pihole/pihole"
docker_checks
# TODO:
#if [ ! -f /.piholeFirstBoot ] ; then
# echo " ::: Not first container startup so not running docker's setup, re-create container to run setup again"
#else
# regular_setup_functions
#fi
fix_capabilities
generate_password
validate_env || exit 1
if [ -f $CONFIG_DIR/.piholeFirstBoot ] || [ -z "$(ls -A $CONFIG_DIR)" ] ; then
generate_password
prepare_configs
change_setting "IPV4_ADDRESS" "$ServerIP"
change_setting "IPV6_ADDRESS" "$ServerIPv6"
@ -48,8 +44,9 @@ setup_dnsmasq_hostnames "$ServerIP" "$ServerIPv6" "$HOSTNAME"
setup_ipv4_ipv6
setup_lighttpd_bind "$ServerIP"
setup_blocklists
fi
test_configs
[ -f /.piholeFirstBoot ] && rm /.piholeFirstBoot
[ -f $CONFIG_DIR/.piholeFirstBoot ] && rm $CONFIG_DIR/.piholeFirstBoot
echo " ::: Docker start setup complete"

View File

@ -21,7 +21,7 @@ def test_IPv6_not_True_removes_ipv6(Docker, Slow, test_args, expected_ipv6, expe
# On overlay2(?) docker sometimes writes to disk are slow enough to break some tests...
expected_ipv6_check = lambda: (\
IPV6_LINE in Docker.run('grep \'use-ipv6.pl\' {}'.format(WEB_CONFIG)).stdout
) == expected_ipv6
) == expected_ipv6
Slow(expected_ipv6_check)
@ -66,7 +66,7 @@ def test_bad_input_to_WEB_PORT(Docker, test_args, expected_error):
def test_override_default_servers_with_DNS_EnvVars(Docker, Slow, args_env, expected_stdout, dns1, dns2):
''' on first boot when DNS vars are NOT set explain default google DNS settings are used
or when DNS vars are set override the pihole DNS settings '''
assert Docker.run('test -f /.piholeFirstBoot').rc == 0
assert Docker.run('test -f $CONFIG_DIR/.piholeFirstBoot').rc == 0
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)
@ -90,7 +90,7 @@ def test_DNS_Envs_are_secondary_to_setupvars(Docker, Slow, args_env, expected_st
''' on second boot when DNS vars are set just use pihole DNS settings
or when DNS vars and FORCE_DNS var are set override the pihole DNS settings '''
# Given we are not booting for the first time
assert Docker.run('rm /.piholeFirstBoot').rc == 0
assert Docker.run('rm $CONFIG_DIR/.piholeFirstBoot').rc == 0
# and a user already has custom pihole dns variables in setup vars
dns_count = 1