From 615af98eaba6aca6b4b203fd3a4cdfed5b7bda57 Mon Sep 17 00:00:00 2001 From: diginc Date: Wed, 3 Jan 2018 20:09:47 -0600 Subject: [PATCH] delete all the alpine --- Dockerfile.py | 21 +----- Dockerfile.template | 37 ---------- Dockerfile_alpine_aarch64 | 64 ------------------ Dockerfile_alpine_amd64 | 67 ------------------- Dockerfile_alpine_armhf | 67 ------------------- Dockerfile_debian_aarch64 | 2 - Dockerfile_debian_amd64 | 2 - Dockerfile_debian_armhf | 2 - README.md | 22 ++---- TESTING.md | 4 +- bash_functions.sh | 43 ------------ docker_dev.sh | 18 ----- docker_run.sh | 2 +- doco-alpine.yml | 17 ----- doco-example.yml | 2 +- install.sh | 37 ---------- jwilder-proxy-example-doco.yml | 2 +- make_symlinks.sh | 11 --- s6/alpine-root/etc/cont-init.d/20-start.sh | 15 ----- .../etc/fix-attrs.d/01-resolver-resolv | 1 - s6/alpine-root/etc/nginx/nginx.conf | 45 ------------- s6/alpine-root/etc/services.d/cron/run | 5 -- s6/alpine-root/etc/services.d/dnsmasq/finish | 3 - s6/alpine-root/etc/services.d/dnsmasq/run | 5 -- s6/alpine-root/etc/services.d/nginx/run | 6 -- s6/alpine-root/etc/services.d/php-fpm/run | 5 -- s6/alpine-root/etc/services.d/pihole-FTL/run | 4 -- s6/alpine-root/usr/bin/host-ip | 10 --- s6/alpine-root/usr/bin/set-contenv | 12 ---- test/conftest.py | 6 +- test/test_bash_functions.py | 13 ++-- test/test_start.py | 2 +- 32 files changed, 19 insertions(+), 533 deletions(-) delete mode 100644 Dockerfile_alpine_aarch64 delete mode 100644 Dockerfile_alpine_amd64 delete mode 100644 Dockerfile_alpine_armhf delete mode 100755 docker_dev.sh delete mode 100644 doco-alpine.yml delete mode 100755 make_symlinks.sh delete mode 100644 s6/alpine-root/etc/cont-init.d/20-start.sh delete mode 100644 s6/alpine-root/etc/fix-attrs.d/01-resolver-resolv delete mode 100644 s6/alpine-root/etc/nginx/nginx.conf delete mode 100644 s6/alpine-root/etc/services.d/cron/run delete mode 100644 s6/alpine-root/etc/services.d/dnsmasq/finish delete mode 100644 s6/alpine-root/etc/services.d/dnsmasq/run delete mode 100644 s6/alpine-root/etc/services.d/nginx/run delete mode 100644 s6/alpine-root/etc/services.d/php-fpm/run delete mode 100644 s6/alpine-root/etc/services.d/pihole-FTL/run delete mode 100755 s6/alpine-root/usr/bin/host-ip delete mode 100755 s6/alpine-root/usr/bin/set-contenv diff --git a/Dockerfile.py b/Dockerfile.py index bfaa48b..60d1d14 100755 --- a/Dockerfile.py +++ b/Dockerfile.py @@ -9,7 +9,7 @@ Options: --no-build Skip building the docker images --no-cache Build without using any cache data --no-generate Skip generating Dockerfiles from template - --os= What OS(s) to build [default: alpine debian] + --os= What OS(s) to build [default: debian] --arch= What Architecture(s) to build [default: amd64 armhf aarch64] -v Print docker's command output [default: False] @@ -35,10 +35,6 @@ os_base_vars = { 'php_env_config': '/etc/lighttpd/conf-enabled/15-fastcgi-php.conf', 'php_error_log': '/var/log/lighttpd/error.log' }, - 'alpine': { - 'php_env_config': '/etc/php5/fpm.d/envs.conf', - 'php_error_log': '/var/log/nginx/error.log' - } } images = { @@ -55,21 +51,6 @@ images = { 'base': 'multiarch/debian-debootstrap:arm64-jessie-slim', 'arch': 'aarch64' } - ], - 'alpine': [ - { - 'base': 'alpine:edge', - 'arch': 'amd64' - }, - { - 'base': 'multiarch/alpine:armhf-edge', - 'arch': 'armhf' - }, - # Impossible combo :( - # { - # 'base': 'multiarch/alpine:aarch64-edge', - # 'arch': 'aarch64' - # } ] } diff --git a/Dockerfile.template b/Dockerfile.template index 2e3b69f..bb39063 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -13,52 +13,18 @@ ENV setupVars /etc/pihole/setupVars.conf 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 -{% if pihole.os == 'alpine' %} -# TODO Re-enable upgrade after php5 packages use the latest greatest libressl packages, conflicts are breaking build 2017-11-14 -#RUN apk update && \ -RUN apk upgrade --update && \ - apk add bind-tools wget curl bash libcap ncurses shadow && \ - usermod -s bash root && \ -{% else %} RUN apt-get update && \ apt-get install -y wget curl net-tools cron && \ -{% endif %} curl -L -s $S6OVERLAY_RELEASE \ | tar xvzf - -C / && \ docker-install.sh && \ -{% if pihole.os == 'alpine' %} - rm -rf /var/cache/apk/* -{% else %} rm -rf /var/cache/apt/archives /var/lib/apt/lists/* -{% endif %} ENTRYPOINT [ "/init" ] ADD s6/{{ pihole.os }}-root / COPY s6/service /usr/local/bin/service -{% if pihole.os == 'alpine' %} -# Things installer did and fix alpine+nginx differences -ENV WEBLOGDIR /var/log/nginx -ENV PHP_CONFIG '/etc/php5/php-fpm.conf' -RUN mkdir -p /etc/pihole/ && \ - mkdir -p /var/www/html/pihole && \ - mkdir -p /var/www/html/admin/ && \ - chown nginx:nginx /var/www/html && \ - touch ${WEBLOGDIR}/access.log ${WEBLOGDIR}/error.log && \ - chown -R nginx:nginx ${WEBLOGDIR} && \ - sed -i 's|^user\s*=.*$|user = nginx|' $PHP_CONFIG && \ - sed -i '/^;pid/ s|^;||' $PHP_CONFIG && \ - chmod 775 /var/www/html && \ - touch /var/log/pihole.log && \ - chmod 644 /var/log/pihole.log && \ - chown dnsmasq:root /var/log/pihole.log && \ - sed -i "s/@INT@/eth0/" /etc/dnsmasq.d/01-pihole.conf && \ - setcap CAP_NET_BIND_SERVICE=+eip `which dnsmasq` && \ - echo 'Done!' -COPY s6/timeout /usr/local/bin/timeout -{% endif %} - # php config start passes special ENVs into ENV PHP_ENV_CONFIG '{{ pihole.php_env_config }}' ENV PHP_ERROR_LOG '{{ pihole.php_error_log }}' @@ -66,9 +32,6 @@ COPY ./start.sh / COPY ./bash_functions.sh / # IPv6 disable flag for networks/devices that do not support it -{% if pihole.os == 'debian' %} -# not fully supported in debian yet -{% endif %} ENV IPv6 True EXPOSE 53 53/udp diff --git a/Dockerfile_alpine_aarch64 b/Dockerfile_alpine_aarch64 deleted file mode 100644 index fec9dbb..0000000 --- a/Dockerfile_alpine_aarch64 +++ /dev/null @@ -1,64 +0,0 @@ -FROM multiarch/alpine:aarch64-edge - -LABEL image="diginc/pi-hole:alpine_aarch64" -LABEL maintainer="adam@diginc.us" -LABEL url="https://www.github.com/diginc/docker-pi-hole" - -ENV TAG alpine -ENV ARCH aarch64 -ENV PATH /opt/pihole:${PATH} - -COPY install.sh /usr/local/bin/docker-install.sh -ENV setupVars /etc/pihole/setupVars.conf -ENV PIHOLE_INSTALL /tmp/ph_install.sh -ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.20.0.0/s6-overlay-aarch64.tar.gz - -RUN apk upgrade --update && \ - apk add bind-tools wget curl bash libcap && \ - curl -L -s $S6OVERLAY_RELEASE \ - | tar xvzf - -C / && \ - docker-install.sh && \ - rm -rf /var/cache/apk/* - -ENTRYPOINT [ "/init" ] - -ADD s6/alpine-root / -COPY s6/service /usr/local/bin/service - -# Things installer did and fix alpine+nginx differences -ENV WEBLOGDIR /var/log/nginx -ENV PHP_CONFIG '/etc/php5/php-fpm.conf' -RUN mkdir -p /etc/pihole/ && \ - mkdir -p /var/www/html/pihole && \ - mkdir -p /var/www/html/admin/ && \ - chown nginx:nginx /var/www/html && \ - touch ${WEBLOGDIR}/access.log ${WEBLOGDIR}/error.log && \ - chown -R nginx:nginx ${WEBLOGDIR} && \ - sed -i 's|^user\s*=.*$|user = nginx|' $PHP_CONFIG && \ - sed -i '/^;pid/ s|^;||' $PHP_CONFIG && \ - chmod 775 /var/www/html && \ - touch /var/log/pihole.log && \ - chmod 644 /var/log/pihole.log && \ - chown dnsmasq:root /var/log/pihole.log && \ - sed -i "s/@INT@/eth0/" /etc/dnsmasq.d/01-pihole.conf && \ - setcap CAP_NET_BIND_SERVICE=+eip `which dnsmasq` && \ - cp -f /usr/bin/list.sh /opt/pihole/list.sh && \ - echo 'Done!' - -# php config start passes special ENVs into -ENV PHP_ENV_CONFIG '/etc/php5/fpm.d/envs.conf' -ENV PHP_ERROR_LOG '/var/log/nginx/error.log' -COPY ./start.sh / -COPY ./bash_functions.sh / - -# IPv6 disable flag for networks/devices that do not support it -ENV IPv6 True - -EXPOSE 53 53/udp -EXPOSE 80 - -ENV S6_LOGGING 0 -ENV S6_KEEP_ENV 1 -ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2 - -SHELL ["/bin/bash", "-c"] \ No newline at end of file diff --git a/Dockerfile_alpine_amd64 b/Dockerfile_alpine_amd64 deleted file mode 100644 index 99e4ad3..0000000 --- a/Dockerfile_alpine_amd64 +++ /dev/null @@ -1,67 +0,0 @@ -FROM alpine:edge - -LABEL image="diginc/pi-hole:alpine_amd64" -LABEL maintainer="adam@diginc.us" -LABEL url="https://www.github.com/diginc/docker-pi-hole" - -ENV TAG alpine -ENV ARCH amd64 -ENV PATH /opt/pihole:${PATH} - -COPY install.sh /usr/local/bin/docker-install.sh -ENV setupVars /etc/pihole/setupVars.conf -ENV PIHOLE_INSTALL /tmp/ph_install.sh -ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.1/s6-overlay-amd64.tar.gz - -# TODO Re-enable upgrade after php5 packages use the latest greatest libressl packages, conflicts are breaking build 2017-11-14 -#RUN apk update && \ -RUN apk upgrade --update && \ - apk add bind-tools wget curl bash libcap ncurses shadow && \ - usermod -s bash root && \ - curl -L -s $S6OVERLAY_RELEASE \ - | tar xvzf - -C / && \ - docker-install.sh && \ - rm -rf /var/cache/apk/* - -ENTRYPOINT [ "/init" ] - -ADD s6/alpine-root / -COPY s6/service /usr/local/bin/service - -# Things installer did and fix alpine+nginx differences -ENV WEBLOGDIR /var/log/nginx -ENV PHP_CONFIG '/etc/php5/php-fpm.conf' -RUN mkdir -p /etc/pihole/ && \ - mkdir -p /var/www/html/pihole && \ - mkdir -p /var/www/html/admin/ && \ - chown nginx:nginx /var/www/html && \ - touch ${WEBLOGDIR}/access.log ${WEBLOGDIR}/error.log && \ - chown -R nginx:nginx ${WEBLOGDIR} && \ - sed -i 's|^user\s*=.*$|user = nginx|' $PHP_CONFIG && \ - sed -i '/^;pid/ s|^;||' $PHP_CONFIG && \ - chmod 775 /var/www/html && \ - touch /var/log/pihole.log && \ - chmod 644 /var/log/pihole.log && \ - chown dnsmasq:root /var/log/pihole.log && \ - sed -i "s/@INT@/eth0/" /etc/dnsmasq.d/01-pihole.conf && \ - setcap CAP_NET_BIND_SERVICE=+eip `which dnsmasq` && \ - echo 'Done!' -COPY s6/timeout /usr/local/bin/timeout - -# php config start passes special ENVs into -ENV PHP_ENV_CONFIG '/etc/php5/fpm.d/envs.conf' -ENV PHP_ERROR_LOG '/var/log/nginx/error.log' -COPY ./start.sh / -COPY ./bash_functions.sh / - -# IPv6 disable flag for networks/devices that do not support it -ENV IPv6 True - -EXPOSE 53 53/udp -EXPOSE 80 - -ENV S6_LOGGING 0 -ENV S6_KEEP_ENV 1 -ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2 - -SHELL ["/bin/bash", "-c"] \ No newline at end of file diff --git a/Dockerfile_alpine_armhf b/Dockerfile_alpine_armhf deleted file mode 100644 index 24449bf..0000000 --- a/Dockerfile_alpine_armhf +++ /dev/null @@ -1,67 +0,0 @@ -FROM multiarch/alpine:armhf-edge - -LABEL image="diginc/pi-hole:alpine_armhf" -LABEL maintainer="adam@diginc.us" -LABEL url="https://www.github.com/diginc/docker-pi-hole" - -ENV TAG alpine -ENV ARCH armhf -ENV PATH /opt/pihole:${PATH} - -COPY install.sh /usr/local/bin/docker-install.sh -ENV setupVars /etc/pihole/setupVars.conf -ENV PIHOLE_INSTALL /tmp/ph_install.sh -ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.1/s6-overlay-armhf.tar.gz - -# TODO Re-enable upgrade after php5 packages use the latest greatest libressl packages, conflicts are breaking build 2017-11-14 -#RUN apk update && \ -RUN apk upgrade --update && \ - apk add bind-tools wget curl bash libcap ncurses shadow && \ - usermod -s bash root && \ - curl -L -s $S6OVERLAY_RELEASE \ - | tar xvzf - -C / && \ - docker-install.sh && \ - rm -rf /var/cache/apk/* - -ENTRYPOINT [ "/init" ] - -ADD s6/alpine-root / -COPY s6/service /usr/local/bin/service - -# Things installer did and fix alpine+nginx differences -ENV WEBLOGDIR /var/log/nginx -ENV PHP_CONFIG '/etc/php5/php-fpm.conf' -RUN mkdir -p /etc/pihole/ && \ - mkdir -p /var/www/html/pihole && \ - mkdir -p /var/www/html/admin/ && \ - chown nginx:nginx /var/www/html && \ - touch ${WEBLOGDIR}/access.log ${WEBLOGDIR}/error.log && \ - chown -R nginx:nginx ${WEBLOGDIR} && \ - sed -i 's|^user\s*=.*$|user = nginx|' $PHP_CONFIG && \ - sed -i '/^;pid/ s|^;||' $PHP_CONFIG && \ - chmod 775 /var/www/html && \ - touch /var/log/pihole.log && \ - chmod 644 /var/log/pihole.log && \ - chown dnsmasq:root /var/log/pihole.log && \ - sed -i "s/@INT@/eth0/" /etc/dnsmasq.d/01-pihole.conf && \ - setcap CAP_NET_BIND_SERVICE=+eip `which dnsmasq` && \ - echo 'Done!' -COPY s6/timeout /usr/local/bin/timeout - -# php config start passes special ENVs into -ENV PHP_ENV_CONFIG '/etc/php5/fpm.d/envs.conf' -ENV PHP_ERROR_LOG '/var/log/nginx/error.log' -COPY ./start.sh / -COPY ./bash_functions.sh / - -# IPv6 disable flag for networks/devices that do not support it -ENV IPv6 True - -EXPOSE 53 53/udp -EXPOSE 80 - -ENV S6_LOGGING 0 -ENV S6_KEEP_ENV 1 -ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2 - -SHELL ["/bin/bash", "-c"] \ No newline at end of file diff --git a/Dockerfile_debian_aarch64 b/Dockerfile_debian_aarch64 index f8643e3..a37cd6d 100644 --- a/Dockerfile_debian_aarch64 +++ b/Dockerfile_debian_aarch64 @@ -25,7 +25,6 @@ ENTRYPOINT [ "/init" ] ADD s6/debian-root / COPY s6/service /usr/local/bin/service - # php config start passes special ENVs into ENV PHP_ENV_CONFIG '/etc/lighttpd/conf-enabled/15-fastcgi-php.conf' ENV PHP_ERROR_LOG '/var/log/lighttpd/error.log' @@ -33,7 +32,6 @@ COPY ./start.sh / COPY ./bash_functions.sh / # IPv6 disable flag for networks/devices that do not support it -# not fully supported in debian yet ENV IPv6 True EXPOSE 53 53/udp diff --git a/Dockerfile_debian_amd64 b/Dockerfile_debian_amd64 index a4b744a..18fc956 100644 --- a/Dockerfile_debian_amd64 +++ b/Dockerfile_debian_amd64 @@ -25,7 +25,6 @@ ENTRYPOINT [ "/init" ] ADD s6/debian-root / COPY s6/service /usr/local/bin/service - # php config start passes special ENVs into ENV PHP_ENV_CONFIG '/etc/lighttpd/conf-enabled/15-fastcgi-php.conf' ENV PHP_ERROR_LOG '/var/log/lighttpd/error.log' @@ -33,7 +32,6 @@ COPY ./start.sh / COPY ./bash_functions.sh / # IPv6 disable flag for networks/devices that do not support it -# not fully supported in debian yet ENV IPv6 True EXPOSE 53 53/udp diff --git a/Dockerfile_debian_armhf b/Dockerfile_debian_armhf index c74acbe..55d2640 100644 --- a/Dockerfile_debian_armhf +++ b/Dockerfile_debian_armhf @@ -25,7 +25,6 @@ ENTRYPOINT [ "/init" ] ADD s6/debian-root / COPY s6/service /usr/local/bin/service - # php config start passes special ENVs into ENV PHP_ENV_CONFIG '/etc/lighttpd/conf-enabled/15-fastcgi-php.conf' ENV PHP_ERROR_LOG '/var/log/lighttpd/error.log' @@ -33,7 +32,6 @@ COPY ./start.sh / COPY ./bash_functions.sh / # IPv6 disable flag for networks/devices that do not support it -# not fully supported in debian yet ENV IPv6 True EXPOSE 53 53/udp diff --git a/README.md b/README.md index 428b95b..de51639 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ docker run -d \ -e ServerIP="${IP}" \ -e ServerIPv6="${IPv6}" \ --restart=always \ - diginc/pi-hole:alpine + diginc/pi-hole:latest ``` **This is just an example and might need changing.** Volumes are stored in the directory $DOCKER_CONFIGS and aren't required but are recommended for persisting data across docker re-creations for updating images. As mentioned on line 2, the auto IP_LOOKUP variable may not work for VPN tunnel interfaces. @@ -87,23 +87,15 @@ The primary docker tags / versions are explained in the following table. [Click | tag | architecture | description | Dockerfile | | --- | ------------ | ----------- | ---------- | -| `alpine` / `latest` | x86 | Alpine x86 image, small size container running nginx and dnsmasq | [Dockerfile](https://github.com/diginc/docker-pi-hole/blob/master/alpine.docker) | -| `debian` | x86 | Debian x86 image, container running lighttpd and dnsmasq | [Dockerfile](https://github.com/diginc/docker-pi-hole/blob/master/debian.docker) | -| `arm` | ARM | Debian ARM image, container running lighttpd and dnsmasq built for ARM | [Dockerfile](https://github.com/diginc/docker-pi-hole/blob/master/debian-armhf.docker) | - -### `diginc/pi-hole:alpine` [![](https://images.microbadger.com/badges/image/diginc/pi-hole:alpine.svg)](https://microbadger.com/images/diginc/pi-hole "Get your own image badge on microbadger.com") [![](https://images.microbadger.com/badges/version/diginc/pi-hole:alpine.svg)](https://microbadger.com/images/diginc/pi-hole "Get your own version badge on microbadger.com") [![](https://images.microbadger.com/badges/version/diginc/pi-hole:latest.svg)](https://microbadger.com/images/diginc/pi-hole "Get your own version badge on microbadger.com") - -Alpine is also the default, aka `latest` tag. If you don't specify a tag you will get this version. This is only an x86 version and will not work on Raspberry Pi's ARM architecture. Use this if you like a small image. +| `debian` / `latest` | x86 | Debian x86 image, container running lighttpd and dnsmasq | [Dockerfile](https://github.com/diginc/docker-pi-hole/blob/master/debian.docker) | ### `diginc/pi-hole:debian` [![](https://images.microbadger.com/badges/image/diginc/pi-hole:debian.svg)](https://microbadger.com/images/diginc/pi-hole "Get your own image badge on microbadger.com") [![](https://images.microbadger.com/badges/version/diginc/pi-hole:debian.svg)](https://microbadger.com/images/diginc/pi-hole "Get your own version badge on microbadger.com") This version of the docker aims to be as close to a standard pi-hole installation by using the same base OS and the exact configs and scripts (minimally modified to get them working). This serves as a stable baseline for merging and testing upstream repository pi-hole changes. Use this if you don't care about image size and want as stable of a product as possible. -### `diginc/pi-hole:arm` [![](https://images.microbadger.com/badges/image/diginc/pi-hole:arm.svg)](https://microbadger.com/images/diginc/pi-hole "Get your own image badge on microbadger.com") [![](https://images.microbadger.com/badges/version/diginc/pi-hole:arm.svg)](https://microbadger.com/images/diginc/pi-hole "Get your own version badge on microbadger.com") +### `diginc/pi-hole:alpine` [![](https://images.microbadger.com/badges/image/diginc/pi-hole:alpine.svg)](https://microbadger.com/images/diginc/pi-hole "Get your own image badge on microbadger.com") [![](https://images.microbadger.com/badges/version/diginc/pi-hole:alpine.svg)](https://microbadger.com/images/diginc/pi-hole "Get your own version badge on microbadger.com") [![](https://images.microbadger.com/badges/version/diginc/pi-hole:latest.svg)](https://microbadger.com/images/diginc/pi-hole "Get your own version badge on microbadger.com") -Same as the debian image, but cross compiled for ARM architecture hardware through [resin.io's awesome Qemu wrapper](https://resin.io/blog/building-arm-containers-on-any-x86-machine-even-dockerhub/). - -Alpine doesn't have an arm cross compilable image at this time. +**DEPRECATED** - no longer supported ## Upgrading, Persistence, and Customizations @@ -111,7 +103,7 @@ The standard pi-hole customization abilities apply to this docker, but with dock ### Upgrading -**If you try to use pihole's built in updater it is not guaranteed to work**; it almost assuredly won't work for alpine but debian may. The preferred 'docker way' to upgrade is: +`pihole -up` is disabled. Upgrad ethe docker way instead please. Long living docker containers are an not the docker way. 1. Download the latest version of the image: `docker pull diginc/pi-hole` 2. Throw away your container: `docker rm -f pihole` @@ -136,7 +128,7 @@ We install all pihole utilities so the the built in [pihole commands](https://di The webserver and DNS service inside the container can be customized if necessary. Any configuration files you volume mount into `/etc/dnsmasq.d/` will be loaded by dnsmasq when the container starts or restarts or if you need to modify the pi-hole config it is located at `/etc/dnsmasq.d/01-pihole.conf`. The docker start scripts runs a config test prior to starting so it will tell you about any errors in the docker log. -Similarly for the webserver you can customize configs in /etc/nginx (*:alpine* tag) and /etc/lighttpd (*:debian* tag). +Similarly for the webserver you can customize configs in /etc/lighttpd (*:debian* tag). ### Systemd init script @@ -150,9 +142,7 @@ NOTE: After initial run you may need to manually stop the docker container with | tag | architecture | description | Dockerfile | | --- | ------------ | ----------- | ---------- | -| `alpine_dev` | x86 | Alpine x86 image, small size container running nginx and dnsmasq | [Dockerfile](https://github.com/diginc/docker-pi-hole/blob/dev/alpine.docker) | | `debian_dev` | x86 | Debian x86 image, container running lighttpd and dnsmasq | [Dockerfile](https://github.com/diginc/docker-pi-hole/blob/dev/debian.docker) | -| `arm_dev` | ARM | Debian ARM image, container running lighttpd and dnsmasq built for ARM | [Dockerfile](https://github.com/diginc/docker-pi-hole/blob/dev/debian-armhf.docker) | # User Feedback diff --git a/TESTING.md b/TESTING.md index 26f398b..e0be1c4 100644 --- a/TESTING.md +++ b/TESTING.md @@ -14,8 +14,8 @@ To run the Dockerfile templating, image build, and tests all in one command just Docker images built by `tox` or `python Dockerfile.py` are named the same but stripped of the `diginc/` docker repository namespace. -e.g. `pi-hole:debian_amd64` or `pi-hole-multiarch:alpine_aarch64` +e.g. `pi-hole:debian_amd64` or `pi-hole-multiarch:debian_aarch64` -You can run the multiarch images on an amd64 development system if you [enable binfmt-support as described in the multiarch image docs](https://hub.docker.com/r/multiarch/alpine/) +You can run the multiarch images on an amd64 development system if you [enable binfmt-support as described in the multiarch image docs](https://hub.docker.com/r/multiarch/multiarch/debian-debootstrap/) `docker run --rm --privileged multiarch/qemu-user-static:register --reset` diff --git a/bash_functions.sh b/bash_functions.sh index e299122..cdc52eb 100644 --- a/bash_functions.sh +++ b/bash_functions.sh @@ -17,9 +17,6 @@ validate_env() { # Debian nc_error='Name or service not known' - if [[ "$TAG" == 'alpine' ]] ; then - nc_error='bad address' - fi; # Required ServerIP is a valid IP if nc -w1 -z "$ServerIP" 53 2>&1 | grep -q "$nc_error" ; then @@ -147,7 +144,6 @@ setup_lighttpd_bind() { setup_php_env() { case $TAG in "debian") setup_php_env_debian ;; - "alpine") setup_php_env_alpine ;; esac } @@ -171,24 +167,6 @@ setup_php_env_debian() { grep -E '(VIRTUAL_HOST|ServerIP|PHP_ERROR_LOG)' "$PHP_ENV_CONFIG" } -setup_php_env_alpine() { - # Intentionally tabs, required by HEREDOC de-indentation (<<-) - cat <<-EOF > "$PHP_ENV_CONFIG" - [www] - env[PATH] = ${PATH} - env[PHP_ERROR_LOG] = ${PHP_ERROR_LOG} - env[ServerIP] = ${ServerIP} - EOF - - if [ -z "$VIRTUAL_HOST" ] ; then - VIRTUAL_HOST="$ServerIP" - fi; - echo "env[VIRTUAL_HOST] = ${VIRTUAL_HOST}" >> "$PHP_ENV_CONFIG"; - - echo "Added ENV to php:" - cat "$PHP_ENV_CONFIG" -} - setup_web_port() { local warning="WARNING: Custom WEB_PORT not used" # Quietly exit early for empty or default @@ -209,9 +187,6 @@ setup_web_port() { case $TAG in "debian") sed -i '/server.port\s*=\s*80\s*$/ s/80/'$WEB_PORT'/g' /etc/lighttpd/lighttpd.conf ;; - "alpine") - sed -i '/^\s*listen \[::\]:80 default_server/ s/80/'$WEB_PORT'/g' /etc/nginx/nginx.conf - sed -i '/^\s*listen 80 default_server/ s/80/'$WEB_PORT'/g' /etc/nginx/nginx.conf ;; esac } @@ -237,7 +212,6 @@ setup_ipv4_ipv6() { ip_versions="IPv4" case $TAG in "debian") sed -i '/use-ipv6.pl/ d' /etc/lighttpd/lighttpd.conf ;; - "alpine") sed -i '/listen \[::\]:80/ d' /etc/nginx/nginx.conf ;; esac fi; echo "Using $ip_versions" @@ -246,7 +220,6 @@ setup_ipv4_ipv6() { test_configs() { case $TAG in "debian") test_configs_debian ;; - "alpine") test_configs_alpine ;; esac } @@ -260,18 +233,6 @@ test_configs_debian() { echo "::: All config checks passed, starting ..." } -test_configs_alpine() { - set -e - echo -n '::: Testing DNSmasq config: ' - dnsmasq --test -7 /etc/dnsmasq.d - echo -n '::: Testing PHP-FPM config: ' - php-fpm5 -t - echo -n '::: Testing NGINX config: ' - nginx -t - set +e - echo "::: All config checks passed, starting ..." -} - test_framework_stubbing() { if [ -n "$PYTEST" ] ; then echo ":::::: Tests are being ran - stub out ad list fetching and add a fake ad block" @@ -288,10 +249,6 @@ docker_main() { TAG="$1" case $TAG in # Setup webserver - "alpine") - php-fpm5 - nginx - ;; "debian") service lighttpd start ;; diff --git a/docker_dev.sh b/docker_dev.sh deleted file mode 100755 index 2d3b4a5..0000000 --- a/docker_dev.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -e -docker build -f alpine.docker -t diginc/pi-hole:alpine . -docker tag diginc/pi-hole:alpine diginc/pi-hole:latest -docker build -f debian.docker -t diginc/pi-hole:debian . - -IP_LOOKUP="$(ip route get 8.8.8.8 | awk '{ print $NF; exit }')" # May not work for VPN / tun0 -IP="${IP:-$IP_LOOKUP}" # use $IP, if set, otherwise IP_LOOKUP - -# Alternative ports to not conflict with my real instance -# shellcheck disable=SC2068 -docker run -it --rm --cap-add=NET_ADMIN \ - -p 5053:53/tcp \ - -p 5053:53/udp \ - -p 5080:80 \ - -e ServerIP="$IP" \ - -e VIRTUAL_HOST='pihole.diginc.lan:5080' \ - $@ \ - diginc/pi-hole:"${image:-alpine}" diff --git a/docker_run.sh b/docker_run.sh index a81cdd9..7d545b8 100755 --- a/docker_run.sh +++ b/docker_run.sh @@ -16,6 +16,6 @@ docker run -d \ -e ServerIP="${IP:-$(ip route get 8.8.8.8 | awk '{ print $NF; exit }')}" \ -e ServerIPv6="${IPv6:-$(ip -6 route get 2001:4860:4860::8888 | awk '{ print $10; exit }')}" \ --restart=always \ - diginc/pi-hole:alpine + diginc/pi-hole:latest docker logs pihole 2> /dev/null | grep 'password:' diff --git a/doco-alpine.yml b/doco-alpine.yml deleted file mode 100644 index 015bcbf..0000000 --- a/doco-alpine.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: "3" -services: - pihole: - image: diginc/pi-hole:alpine - environment: - # enter your docker host IP here - ServerIP: - # IPv6 Address if your network supports it - #ServerIPv6: 192.168.1.55 - volumes: - - "./pihole/:/etc/pihole/" - - "./dnsmasq.d/:/etc/dnsmasq.d/" - ports: - - "53:53/tcp" - - "53:53/udp" - - "80:80/tcp" - restart: always diff --git a/doco-example.yml b/doco-example.yml index a5b0c36..debf6ea 100644 --- a/doco-example.yml +++ b/doco-example.yml @@ -1,7 +1,7 @@ version: "3" services: pihole: - image: diginc/pi-hole:alpine + image: diginc/pi-hole:latest ports: - "53:53/tcp" - "53:53/udp" diff --git a/install.sh b/install.sh index 205db88..3e4e52a 100755 --- a/install.sh +++ b/install.sh @@ -14,25 +14,6 @@ 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 -if [[ "$TAG" == 'alpine' ]] ; then - sed -i '/OS distribution not supported/ i\ echo "Hi Alpine"' "$PIHOLE_INSTALL" - sed -i '/OS distribution not supported/,+1d' "$PIHOLE_INSTALL" - sed -i 's#nologin pihole#nologin pihole 2>/dev/null || adduser -S -s /sbin/nologin pihole#g' "$PIHOLE_INSTALL" - # shellcheck disable=SC2016 - sed -i '/usermod -a -G/ s#$# 2> /dev/null || addgroup pihole ${LIGHTTPD_GROUP}#g' "$PIHOLE_INSTALL" - sed -i 's/www-data/nginx/g' "$PIHOLE_INSTALL" - sed -i '/LIGHTTPD_CFG/d' "${PIHOLE_INSTALL}" - sed -i '/etc\/cron.d\//d' "${PIHOLE_INSTALL}" - # For new FTL install lines - sed -i 's/sha1sum --status --quiet/sha1sum -s/g' "${PIHOLE_INSTALL}" - sed -i 's/install -T/install /g' "${PIHOLE_INSTALL}" - # shellcheck disable=SC2016 - sed -i '/FTLinstall/ s/${binary}/pihole-FTL-musl-linux-x86_64/g' "${PIHOLE_INSTALL}" - LIGHTTPD_USER="nginx" # shellcheck disable=SC2034 - LIGHTTPD_GROUP="nginx" # shellcheck disable=SC2034 - LIGHTTPD_CFG="lighttpd.conf.debian" # shellcheck disable=SC2034 - DNSMASQ_USER="dnsmasq" # shellcheck disable=SC2034 -fi PH_TEST=true . "${PIHOLE_INSTALL}" # Run only what we need from installer @@ -45,15 +26,6 @@ if [[ "$TAG" == 'debian' ]] ; then sed -i "/sleep 2/ d" /etc/init.d/dnsmasq # SLOW # IPv6 support for nc openbsd better than traditional apt-get install -y --force-yes netcat-openbsd -elif [[ "$TAG" == 'alpine' ]] ; then - apk add -U \ - dnsmasq \ - nginx \ - ca-certificates \ - php5-fpm php5-json php5-openssl php5-zip php5-sockets libxml2 \ - bc bash curl perl sudo git - # S6 service like to be blocking/foreground - sed -i 's|^;daemonize = yes|daemonize = no|' /etc/php5/php-fpm.conf fi piholeGitUrl="${piholeGitUrl}" @@ -84,15 +56,6 @@ tmpLog="/tmp/pihole-install.log" installLogLoc="${installLogLoc}" installPihole | tee "${tmpLog}" sed -i 's/readonly //g' /opt/pihole/webpage.sh -if [[ "$TAG" == 'alpine' ]] ; then - cp /etc/.pihole/advanced/pihole.cron /etc/crontabs/pihole - - # More chewing gum patching, post installPihole dnsmasq replacement seems to work probably due to dnsmasq uid missing - apk del dnsmasq && apk add dnsmasq-dnssec - - # Fix hostname bug on block page - sed -i "s/\$_SERVER\['SERVER_NAME'\]/\$_SERVER\['HTTP_HOST'\]/" /var/www/html/pihole/index.php -fi mv "${tmpLog}" "${instalLogLoc}" touch /.piholeFirstBoot diff --git a/jwilder-proxy-example-doco.yml b/jwilder-proxy-example-doco.yml index e44b882..0866703 100644 --- a/jwilder-proxy-example-doco.yml +++ b/jwilder-proxy-example-doco.yml @@ -9,7 +9,7 @@ applist: restart: always pihole: - image: diginc/pi-hole:alpine + image: diginc/pi-hole:latest ports: - '53:53/tcp' - '53:53/udp' diff --git a/make_symlinks.sh b/make_symlinks.sh deleted file mode 100755 index cf4f913..0000000 --- a/make_symlinks.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -e -supportedTags='^(alpine|debian)$' -if ! (echo "$1" | grep -Pq "$supportedTags") ; then - echo "$1 is not a supported tag"; exit 1; -fi - -unlink docker-compose.yml -unlink Dockerfile - -ln -s "doco-${1}.yml" docker-compose.yml -ln -s "${1}.docker" Dockerfile diff --git a/s6/alpine-root/etc/cont-init.d/20-start.sh b/s6/alpine-root/etc/cont-init.d/20-start.sh deleted file mode 100644 index 204ff33..0000000 --- a/s6/alpine-root/etc/cont-init.d/20-start.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/with-contenv bash -bashCmd='bash' -if [ "${PH_VERBOSE:-0}" -gt 0 ] ; then - set -x ; - bashCmd='bash -x' -fi - -# Early DNS Startup for the gravity list process to use -dnsmasq -7 /etc/dnsmasq.d - -$bashCmd /start.sh -$bashCmd gravity.sh - -# Done with DNS, let s6 services start up properly configured dns now -killall -9 dnsmasq diff --git a/s6/alpine-root/etc/fix-attrs.d/01-resolver-resolv b/s6/alpine-root/etc/fix-attrs.d/01-resolver-resolv deleted file mode 100644 index 84e9986..0000000 --- a/s6/alpine-root/etc/fix-attrs.d/01-resolver-resolv +++ /dev/null @@ -1 +0,0 @@ -/etc/resolv.conf false doesntexist,0:1000 0664 0664 \ No newline at end of file diff --git a/s6/alpine-root/etc/nginx/nginx.conf b/s6/alpine-root/etc/nginx/nginx.conf deleted file mode 100644 index 5cfa13e..0000000 --- a/s6/alpine-root/etc/nginx/nginx.conf +++ /dev/null @@ -1,45 +0,0 @@ -worker_processes 1; -pid /var/run/nginx.pid; - -events { - worker_connections 1024; -} - -http { - include mime.types; - default_type application/octet-stream; - sendfile on; - keepalive_timeout 65; - - server { - # PHP SERVER_NAME is empty unless set, which can bug out ipv6less setups - server_name _; - listen 80 default_server; - listen [::]:80 default_server; - root /var/www/html; - index pihole/index.php index.php; - error_page 404 =200 /pihole/index.php; - - location ~ .php$ { - fastcgi_pass 127.0.0.1:9000; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include fastcgi_params; - } - - location /*.js { - index pihole/index.js - error_page 404 =200 /pihole/index.js; - } - - location ~ ^/admin/ { - add_header X-Pi-hole "The Pi-hole Web interface is working!"; - } - - location / { - add_header X-Pi-hole "A black hole for Internet advertisements." always; - } - } - -} diff --git a/s6/alpine-root/etc/services.d/cron/run b/s6/alpine-root/etc/services.d/cron/run deleted file mode 100644 index 9c1c4b6..0000000 --- a/s6/alpine-root/etc/services.d/cron/run +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/with-contenv bash -s6-echo "Starting crond" - -exec -c -fdmove -c 2 1 /usr/sbin/crond -f -L /var/log/cron -l 0 -c /etc/crontabs diff --git a/s6/alpine-root/etc/services.d/dnsmasq/finish b/s6/alpine-root/etc/services.d/dnsmasq/finish deleted file mode 100644 index 77aec95..0000000 --- a/s6/alpine-root/etc/services.d/dnsmasq/finish +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/with-contenv bash - -kill -9 $(pgrep dnsmasq) diff --git a/s6/alpine-root/etc/services.d/dnsmasq/run b/s6/alpine-root/etc/services.d/dnsmasq/run deleted file mode 100644 index 7a19a39..0000000 --- a/s6/alpine-root/etc/services.d/dnsmasq/run +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/with-contenv bash - -s6-echo "Starting dnsmasq" - -s6-setuidgid root dnsmasq -7 /etc/dnsmasq.d --no-daemon diff --git a/s6/alpine-root/etc/services.d/nginx/run b/s6/alpine-root/etc/services.d/nginx/run deleted file mode 100644 index 1a07812..0000000 --- a/s6/alpine-root/etc/services.d/nginx/run +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/with-contenv bash - -s6-svwait -u -t 5000 /var/run/s6/services/php-fpm -s6-echo "Starting nginx" - -nginx -g "daemon off;" diff --git a/s6/alpine-root/etc/services.d/php-fpm/run b/s6/alpine-root/etc/services.d/php-fpm/run deleted file mode 100644 index 06a154f..0000000 --- a/s6/alpine-root/etc/services.d/php-fpm/run +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/with-contenv bash - -s6-echo "Starting php-fpm" - -php-fpm5 -d daemonize=no diff --git a/s6/alpine-root/etc/services.d/pihole-FTL/run b/s6/alpine-root/etc/services.d/pihole-FTL/run deleted file mode 100644 index f059a23..0000000 --- a/s6/alpine-root/etc/services.d/pihole-FTL/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/with-contenv bash - -s6-echo "Starting pihole-FTL" -pihole-FTL no-daemon diff --git a/s6/alpine-root/usr/bin/host-ip b/s6/alpine-root/usr/bin/host-ip deleted file mode 100755 index ff2f67b..0000000 --- a/s6/alpine-root/usr/bin/host-ip +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/with-contenv sh - -# -# This script will determine the network IP of the container. -# -# Return format should be a single IP address. -# - -# Default to using the value of the $HOSTNAME ENV variable. -getent hosts ${1:-$HOSTNAME} | awk '{print $1}' diff --git a/s6/alpine-root/usr/bin/set-contenv b/s6/alpine-root/usr/bin/set-contenv deleted file mode 100755 index 7cb86c9..0000000 --- a/s6/alpine-root/usr/bin/set-contenv +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/execlineb -S0 - -if { s6-test $# -eq 2 } - -backtick -in FILENAME { - pipeline { s6-echo "${1}" } - tr "a-z" "A-Z" -} -import -u FILENAME - -redirfd -w 1 /var/run/s6/container_environment/${FILENAME} -s6-echo -n -- ${2} diff --git a/test/conftest.py b/test/conftest.py index 613aecc..f122a65 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -58,12 +58,11 @@ def args(request): def arch(request): return request.param -@pytest.fixture(params=['debian', 'alpine']) +@pytest.fixture(params=['debian']) def os(request): return request.param @pytest.fixture() -@pytest.mark.skipif((os == 'alpine' and arch == 'aarch64'), 'musl does not have aarch64 yet') def tag(request, os, arch): return '{}_{}'.format(os, arch) @@ -90,7 +89,7 @@ def persist_arch(request): '''amd64 only, dnsmasq will not start under qemu-user-static :(''' return request.param -@pytest.fixture(scope='module', params=['debian', 'alpine']) +@pytest.fixture(scope='module', params=['debian']) def persist_os(request): return request.param @@ -98,7 +97,6 @@ def persist_os(request): def persist_args(request): return '-e ServerIP="127.0.0.1" -e ServerIPv6="::1"' -@pytest.mark.skipif((persist_os == 'alpine' and persist_arch == 'aarch64'), 'musl does not have aarch64 yet') @pytest.fixture(scope='module') def persist_tag(request, persist_os, persist_arch): return '{}_{}'.format(persist_os, persist_arch) diff --git a/test/test_bash_functions.py b/test/test_bash_functions.py index 3f85823..bc68adc 100644 --- a/test/test_bash_functions.py +++ b/test/test_bash_functions.py @@ -11,10 +11,8 @@ DEFAULTARGS = '-e ServerIP="127.0.0.1" ' ]) def test_IPv6_not_True_removes_ipv6(Docker, os, args, expected_ipv6, expected_stdout): ''' When a user overrides IPv6=True they only get IPv4 listening webservers ''' - IPV6_LINE = { 'alpine': 'listen [::]:80 default_server', - 'debian': 'use-ipv6.pl' } - WEB_CONFIG = { 'alpine': '/etc/nginx/nginx.conf', - 'debian': '/etc/lighttpd/lighttpd.conf' } + IPV6_LINE = { 'debian': 'use-ipv6.pl' } + WEB_CONFIG = { 'debian': '/etc/lighttpd/lighttpd.conf' } function = Docker.run('. /bash_functions.sh ; setup_ipv4_ipv6') assert "Using {}".format(expected_stdout) in function.stdout @@ -24,11 +22,8 @@ def test_IPv6_not_True_removes_ipv6(Docker, os, args, expected_ipv6, expected_st @pytest.mark.parametrize('args', [DEFAULTARGS + '-e "WEB_PORT=999"']) def test_overrides_default_WEB_PORT(Docker, os, args): ''' When a --net=host user sets WEB_PORT to avoid synology's 80 default IPv4 and or IPv6 ports are updated''' - CONFIG_LINES = { 'alpine': ['listen 999 default_server', - 'listen\s*\[::\]:999\s*default_server;'], - 'debian': ['server.port\s*=\s*999'] } - WEB_CONFIG = { 'alpine': '/etc/nginx/nginx.conf', - 'debian': '/etc/lighttpd/lighttpd.conf' } + CONFIG_LINES = { 'debian': ['server.port\s*=\s*999'] } + WEB_CONFIG = { 'debian': '/etc/lighttpd/lighttpd.conf' } function = Docker.run('. /bash_functions.sh ; eval `grep setup_web_port /start.sh`') assert "Custom WEB_PORT set to 999" in function.stdout diff --git a/test/test_start.py b/test/test_start.py index 55f8332..5db645b 100644 --- a/test/test_start.py +++ b/test/test_start.py @@ -2,7 +2,7 @@ import pytest import time ''' conftest.py provides the defaults through fixtures ''' ''' Note, testinfra builtins don't seem fully compatible with - docker containers (esp. alpine) stripped down nature ''' + docker containers (esp. musl based OSs) stripped down nature ''' def test_pihole_default_run_command(Docker, tag): expected_proc = '/sbin/tini -- /start.sh'