Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 4.1 #370

Merged
merged 23 commits into from
Dec 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7515c10
Implemented missing support for DNSMASQ_LISTENING environment variable
dhutchison Sep 29, 2018
cb87448
Long awaited synology audit error fix ;)
diginc Oct 21, 2018
e995ed2
Merge pull request #349 from pi-hole/audit_error_fix
diginc Oct 21, 2018
d25aefb
Refactor Dockerfile for smaller and less layer image
PeterDaveHello Oct 24, 2018
3870154
Merge pull request #334 from dhutchison/development
diginc Oct 27, 2018
b931633
Merge pull request #334 from dhutchison/development
diginc Oct 27, 2018
88229a5
Merge branch 'development' of github.com:diginc/docker-pi-hole into d…
diginc Oct 27, 2018
e87b2ff
Merge pull request #350 from PeterDaveHelloKitchen/improve-Dockerfile
diginc Oct 27, 2018
0c2ba8f
Merge branch 'development' of github.com:diginc/docker-pi-hole into d…
diginc Oct 27, 2018
88bec87
fixing synology pam
diginc Oct 30, 2018
bceef5e
Merge branch 'master' of github.com:diginc/docker-pi-hole into synology
diginc Oct 30, 2018
a47f278
cleanup uncessary build dep stuff
diginc Oct 31, 2018
10c44c9
switch to using pihole/debian-base for pam fix
diginc Nov 1, 2018
61f701b
Merge pull request #358 from pi-hole/synology
diginc Nov 1, 2018
c45bf4c
Merge branch 'master' of github.com:diginc/docker-pi-hole into dev
diginc Nov 13, 2018
d2651d8
Version 4.1
diginc Dec 11, 2018
d7a125a
Version 4.1
diginc Dec 11, 2018
62c1fb4
Merge branch 'dev' of github.com:diginc/docker-pi-hole into dev
diginc Dec 13, 2018
b39a2ad
arm version complained/crashed on no TTY
diginc Dec 14, 2018
b3beb91
update deploy version to 4.1 and fix broken server test
diginc Dec 14, 2018
e8b23bc
Work around docker manifests not properly deleting/updating by removi…
diginc Dec 14, 2018
93bc8e3
newer version of pytest for travis
diginc Dec 14, 2018
1d379d0
fix hardcoded s6 arch :( woops
diginc Dec 16, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions Dockerfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
""" Dockerfile.py - generates and build dockerfiles

Usage:
Dockerfile.py [--arch=<arch> ...] [--skip=<arch> ...] [-v] [--no-build | --no-generate] [--no-cache]
Dockerfile.py [--arch=<arch> ...] [--skip=<arch> ...] [-v] [-t] [--no-build | --no-generate] [--no-cache]

Options:
--no-build Skip building the docker images
Expand All @@ -12,6 +12,7 @@
--arch=<arch> What Architecture(s) to build [default: amd64 armel armhf aarch64]
--skip=<arch> What Architectures(s) to skip [default: None]
-v Print docker's command output [default: False]
-t Print docker's build time [default: False]

Examples:
"""
Expand All @@ -27,7 +28,7 @@
base_vars = {
'name': 'pihole/pihole',
'maintainer' : 'adam@diginc.us',
's6_version' : 'v1.21.4.0',
's6_version' : 'v1.21.7.0',
}

os_base_vars = {
Expand All @@ -36,9 +37,9 @@
}

images = {
'v4.0': [
'v4.1': [
{
'base': 'debian:stretch-slim',
'base': 'pihole/debian-base:latest',
'arch': 'amd64'
},
{
Expand Down Expand Up @@ -91,7 +92,10 @@ def build_dockerfiles(args):

for arch in args['--arch']:
# TODO: include from external .py that can be shared with Dockerfile.py / Tests / deploy scripts '''
build('pihole', 'v4.0', arch, args)
if arch == 'armel':
print "Skipping armel, incompatible upstream binaries/broken"
continue
build('pihole', 'v4.1', arch, args)


def build(docker_repo, version, arch, args):
Expand All @@ -102,11 +106,14 @@ def build(docker_repo, version, arch, args):
dockerfile = 'Dockerfile_{}'.format(arch)
repo_tag = '{}:{}_{}'.format(docker_repo, version, arch)
cached_image = '{}/{}'.format('pihole', repo_tag)
time=''
if args['-t']:
time='time '
no_cache = ''
if args['--no-cache']:
no_cache = '--no-cache'
build_command = 'docker build {no_cache} --pull --cache-from="{cache},{create_tag}" -f {dockerfile} -t {create_tag} .'\
.format(no_cache=no_cache, cache=cached_image, dockerfile=dockerfile, create_tag=repo_tag)
build_command = '{time}docker build {no_cache} --pull --cache-from="{cache},{create_tag}" -f {dockerfile} -t {create_tag} .'\
.format(time=time, no_cache=no_cache, cache=cached_image, dockerfile=dockerfile, create_tag=repo_tag)
print " ::: Building {} into {}".format(dockerfile, repo_tag)
if args['-v']:
print build_command, '\n'
Expand Down
15 changes: 5 additions & 10 deletions Dockerfile.template
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
FROM {{ pihole.base }}

COPY install.sh /usr/local/bin/docker-install.sh
ENV PIHOLE_INSTALL /root/ph_install.sh
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
ENV PIHOLE_INSTALL /root/ph_install.sh

RUN apt-get update && \
apt-get install -y curl procps && \
curl -L -s $S6OVERLAY_RELEASE | tar xvzf - -C / && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && \
mv /init /s6-init

RUN apt-get update && bash -ex docker-install.sh 2>&1
RUN bash -ex install.sh 2>&1 && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*

ENTRYPOINT [ "/s6-init" ]

Expand All @@ -34,7 +29,7 @@ EXPOSE 443
ENV S6_LOGGING 0
ENV S6_KEEP_ENV 1
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
ENV FTL_CMD no-daemon
ENV FTL_CMD debug
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pi-hole/api-approvers FYI no-daemon wasn't staying in the foreground for me in my hasty update last night, so I changed it to debug as a workaround to get things running (s6-service requires a foregrounded process)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I found the issue: pi-hole/FTL#430

Copy link
Member

@DL6ER DL6ER Dec 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried to run it as pihole-FTL no-daemon and - as @Mcat12 commented in his PR - observed that Ctrl+C, etc. are not caught anymore, however, pihole-FTL indeed stays in foreground and works as expected. We should continue this here: pi-hole/FTL#432


ENV VERSION {{ pihole.version }}
ENV ARCH {{ pihole.arch }}
Expand Down
19 changes: 7 additions & 12 deletions Dockerfile_aarch64
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
FROM multiarch/debian-debootstrap:arm64-stretch-slim

COPY install.sh /usr/local/bin/docker-install.sh
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
ENV PIHOLE_INSTALL /root/ph_install.sh
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.4.0/s6-overlay-aarch64.tar.gz

RUN apt-get update && \
apt-get install -y curl procps && \
curl -L -s $S6OVERLAY_RELEASE | tar xvzf - -C / && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && \
mv /init /s6-init

RUN apt-get update && bash -ex docker-install.sh 2>&1
RUN bash -ex install.sh 2>&1 && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*

ENTRYPOINT [ "/s6-init" ]

Expand All @@ -34,13 +29,13 @@ EXPOSE 443
ENV S6_LOGGING 0
ENV S6_KEEP_ENV 1
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
ENV FTL_CMD no-daemon
ENV FTL_CMD debug

ENV VERSION v4.0
ENV VERSION v4.1
ENV ARCH aarch64
ENV PATH /opt/pihole:${PATH}

LABEL image="pihole/pihole:v4.0_aarch64"
LABEL image="pihole/pihole:v4.1_aarch64"
LABEL maintainer="adam@diginc.us"
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"

Expand Down
21 changes: 8 additions & 13 deletions Dockerfile_amd64
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
FROM debian:stretch-slim
FROM pihole/debian-base:latest

COPY install.sh /usr/local/bin/docker-install.sh
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
ENV PIHOLE_INSTALL /root/ph_install.sh
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.4.0/s6-overlay-amd64.tar.gz

RUN apt-get update && \
apt-get install -y curl procps && \
curl -L -s $S6OVERLAY_RELEASE | tar xvzf - -C / && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && \
mv /init /s6-init

RUN apt-get update && bash -ex docker-install.sh 2>&1
RUN bash -ex install.sh 2>&1 && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*

ENTRYPOINT [ "/s6-init" ]

Expand All @@ -34,13 +29,13 @@ EXPOSE 443
ENV S6_LOGGING 0
ENV S6_KEEP_ENV 1
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
ENV FTL_CMD no-daemon
ENV FTL_CMD debug

ENV VERSION v4.0
ENV VERSION v4.1
ENV ARCH amd64
ENV PATH /opt/pihole:${PATH}

LABEL image="pihole/pihole:v4.0_amd64"
LABEL image="pihole/pihole:v4.1_amd64"
LABEL maintainer="adam@diginc.us"
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"

Expand Down
19 changes: 7 additions & 12 deletions Dockerfile_armel
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
FROM multiarch/debian-debootstrap:armel-stretch-slim

COPY install.sh /usr/local/bin/docker-install.sh
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
ENV PIHOLE_INSTALL /root/ph_install.sh
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.4.0/s6-overlay-arm.tar.gz

RUN apt-get update && \
apt-get install -y curl procps && \
curl -L -s $S6OVERLAY_RELEASE | tar xvzf - -C / && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && \
mv /init /s6-init

RUN apt-get update && bash -ex docker-install.sh 2>&1
RUN bash -ex install.sh 2>&1 && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*

ENTRYPOINT [ "/s6-init" ]

Expand All @@ -34,13 +29,13 @@ EXPOSE 443
ENV S6_LOGGING 0
ENV S6_KEEP_ENV 1
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
ENV FTL_CMD no-daemon
ENV FTL_CMD debug

ENV VERSION v4.0
ENV VERSION v4.1
ENV ARCH armel
ENV PATH /opt/pihole:${PATH}

LABEL image="pihole/pihole:v4.0_armel"
LABEL image="pihole/pihole:v4.1_armel"
LABEL maintainer="adam@diginc.us"
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"

Expand Down
19 changes: 7 additions & 12 deletions Dockerfile_armhf
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
FROM multiarch/debian-debootstrap:armhf-stretch-slim

COPY install.sh /usr/local/bin/docker-install.sh
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
ENV PIHOLE_INSTALL /root/ph_install.sh
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.4.0/s6-overlay-armhf.tar.gz

RUN apt-get update && \
apt-get install -y curl procps && \
curl -L -s $S6OVERLAY_RELEASE | tar xvzf - -C / && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && \
mv /init /s6-init

RUN apt-get update && bash -ex docker-install.sh 2>&1
RUN bash -ex install.sh 2>&1 && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*

ENTRYPOINT [ "/s6-init" ]

Expand All @@ -34,13 +29,13 @@ EXPOSE 443
ENV S6_LOGGING 0
ENV S6_KEEP_ENV 1
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
ENV FTL_CMD no-daemon
ENV FTL_CMD debug

ENV VERSION v4.0
ENV VERSION v4.1
ENV ARCH armhf
ENV PATH /opt/pihole:${PATH}

LABEL image="pihole/pihole:v4.0_armhf"
LABEL image="pihole/pihole:v4.1_armhf"
LABEL maintainer="adam@diginc.us"
LABEL url="https://www.github.com/pi-hole/docker-pi-hole"

Expand Down
10 changes: 10 additions & 0 deletions bash_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ setup_dnsmasq_interface() {
[ -n "$interface" ] && change_setting "PIHOLE_INTERFACE" "${interface}"
}

setup_dnsmasq_listening_behaviour() {
local dnsmasq_listening_behaviour="${1}"

if [ -n "$dnsmasq_listening_behaviour" ]; then
change_setting "DNSMASQ_LISTENING" "${dnsmasq_listening_behaviour}"
fi;
}

setup_dnsmasq_config_if_missing() {
# When fresh empty directory volumes are used we miss this file
if [ ! -f /etc/dnsmasq.d/01-pihole.conf ] ; then
Expand All @@ -131,10 +139,12 @@ setup_dnsmasq() {
local dns1="$1"
local dns2="$2"
local interface="$3"
local dnsmasq_listening_behaviour="$4"
# Coordinates
setup_dnsmasq_config_if_missing
setup_dnsmasq_dns "$dns1" "$dns2"
setup_dnsmasq_interface "$interface"
setup_dnsmasq_listening_behaviour "$dnsmasq_listening_behaviour"
ProcessDNSSettings
}

Expand Down
9 changes: 7 additions & 2 deletions deploy_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,17 @@ echo "branch: $branch"
[[ -n "$dry" ]] && echo "DRY RUN: $dry"
echo "Example tagging: docker tag ${localimg}:armhf ${remoteimg}:${version}_amd64"

$dry ./Dockerfile.py --arch=amd64 --arch=armhf --arch=aarch64
if [[ -z "$dry" ]] ; then
echo "Deleting all manifest data to work around cached old copies preventing updates"
rm -rf ~/.docker/manifests/*
fi

$dry tox

images=()
for tag in ${!arch_map[@]}; do
# Verison specific tags for ongoing history
$dry docker tag $localimg:v4.0_$tag $remoteimg:${version}_${tag}
$dry docker tag $localimg:v4.1_$tag $remoteimg:${version}_${tag}
$dry docker push pihole/pihole:${version}_${tag}
images+=(pihole/pihole:${version}_${tag})
done
Expand Down
30 changes: 18 additions & 12 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
#!/bin/bash -ex
#!/bin/bash -ex /
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait where did this / come from.......


mkdir -p /etc/pihole/
mkdir -p /var/run/pihole
# Production tags with valid web footers
export CORE_TAG='v4.0'
export WEB_TAG='v4.0'
export CORE_TAG='v4.1'
export WEB_TAG='v4.1'
# Only use for pre-production / testing
export USE_CUSTOM_BRANCHES=false

apt-get update
apt-get install -y curl procps
curl -L -s $S6OVERLAY_RELEASE | tar xvzf - -C /
mv /init /s6-init

if [[ $USE_CUSTOM_BRANCHES == true ]] ; then
CORE_TAG='development'
CORE_TAG='release/v4.1'
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
which systemctl && mv "$(which systemctl)" /bin/no_systemctl
# debconf-apt-progress seems to hang so get rid of it too
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
curl https://raw.githubusercontent.com/pi-hole/pi-hole/${CORE_TAG}/automated%20install/basic-install.sh > "$PIHOLE_INSTALL"
Expand All @@ -40,7 +43,8 @@ export USER=pihole
distro_check

# fix permission denied to resolvconf post-inst /etc/resolv.conf moby/moby issue #1297
apt-get -y install debconf-utils && echo resolvconf resolvconf/linkify-resolvconf boolean false | debconf-set-selections
apt-get -y install debconf-utils
echo resolvconf resolvconf/linkify-resolvconf boolean false | debconf-set-selections

# Tried this - unattended causes starting services during a build, should probably PR a flag to shut that off and switch to that
#bash -ex "./${PIHOLE_INSTALL}" --unattended
Expand All @@ -63,10 +67,12 @@ mv "${tmpLog}" /

if [[ $USE_CUSTOM_BRANCHES == true ]] ; then
ln -s /bin/true /usr/local/bin/service
echo "$CORE_TAG" | tee /etc/pihole/ftlbranch
ln -s /bin/true /usr/local/bin/update-rc.d
echo y | bash -x pihole checkout core $CORE_TAG
echo y | bash -x pihole checkout web $CORE_TAG
echo y | bash -x pihole checkout ftl ${CORE_TAG/v/}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New way to checkout dev copies of FTL added as I was pre-release testing. Noticed no 'v' was in this tag where as the others weren't so I'm search/replacing it in this bash variable.

unlink /usr/local/bin/service
unlink /usr/local/bin/update-rc.d
else
# Reset to our tags so version numbers get detected correctly
pushd "${PI_HOLE_LOCAL_REPO}"; git reset --hard "${CORE_TAG}"; popd;
Expand All @@ -82,5 +88,5 @@ sed -i $'s/updatePiholeFunc;;/unsupportedFunc;;/g' /usr/local/bin/pihole
touch /.piholeFirstBoot

# Fix dnsmasq in docker
grep -q '^user=root' || echo -e '\nuser=root' >> /etc/dnsmasq.conf
#grep -q '^user=root' || echo -e '\nuser=root' >> /etc/dnsmasq.conf
echo 'Docker install successful'
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
docker-compose
jinja2
pytest
pytest>=3.6.0
pytest-cov
pytest-xdist
testinfra==1.5.1
Expand Down
4 changes: 4 additions & 0 deletions s6/debian-root/etc/cont-init.d/20-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ fi
# used to start dnsmasq here for gravity to use...now that conflicts port 53

$bashCmd /start.sh
# Gotta go fast, no time for gravity
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not required, added before I added --dns 1.1.1.1 which actually solved my gravity issues (known issue that never manifested in tests before)

if [ -n "$PYTEST" ]; then
sed -i 's/^gravity_spinup$/#gravity_spinup # DISABLED FOR PYTEST/g' "$(which gravity.sh)"
fi
gravity.sh

# Kill dnsmasq because s6 won't like it if it's running when s6 services start
Expand Down
3 changes: 2 additions & 1 deletion start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export WEBLOGDIR
export DNS1
export DNS2
export INTERFACE
export DNSMASQ_LISTENING_BEHAVIOUR="$DNSMASQ_LISTENING"
export IPv6
export WEB_PORT

Expand All @@ -32,7 +33,7 @@ change_setting "IPV4_ADDRESS" "$ServerIP"
change_setting "IPV6_ADDRESS" "$ServerIPv6"
setup_web_port "$WEB_PORT"
setup_web_password "$WEBPASSWORD"
setup_dnsmasq "$DNS1" "$DNS2" "$INTERFACE"
setup_dnsmasq "$DNS1" "$DNS2" "$INTERFACE" "$DNSMASQ_LISTENING_BEHAVIOUR"
setup_php_env
setup_dnsmasq_hostnames "$ServerIP" "$ServerIPv6" "$HOSTNAME"
setup_ipv4_ipv6
Expand Down
Loading