Skip to content

Commit

Permalink
Merge pull request #1074 from pi-hole/dev
Browse files Browse the repository at this point in the history
2022.04.3
  • Loading branch information
PromoFaux committed Apr 20, 2022
2 parents f3260fb + 93e7dad commit ebbbdae
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 13 deletions.
3 changes: 2 additions & 1 deletion Dockerfile_build
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ ARG packages
RUN apt-get update && \
apt-get install -y python3-dev curl gcc make \
libffi-dev libssl-dev ${packages} \
&& pip3 install -U pip pipenv
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --no-cache-dir -U pip pipenv

RUN curl -L https://github.com/docker/compose/releases/download/1.25.5/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose && \
chmod +x /usr/local/bin/docker-compose
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ There are other environment variables if you want to customize various things in
| Variable | Default | Value | Description |
| -------- | ------- | ----- | ---------- |
| `ADMIN_EMAIL` | unset | email address | Set an administrative contact address for the Block Page |
| `PIHOLE_DNS_` | `8.8.8.8;8.8.4.4` | IPs delimited by `;` | Upstream DNS server(s) for Pi-hole to forward queries to, seperated by a semicolon <br/> (supports non-standard ports with `#[port number]`) e.g `127.0.0.1#5053;8.8.8.8;8.8.4.4` <br/> (supports [Docker service names and links](https://docs.docker.com/compose/networking/) instead of IPs) e.g `upstream0;upstream1` where `upstream0` and `upstream1` are the service names of or links to docker services <br/> Note: The existence of this environment variable assumes this as the _sole_ management of upstream DNS. Upstream DNS added via the web interface will be overwritten on container restart/recreation |
| `PIHOLE_DNS_` | `8.8.8.8;8.8.4.4` | IPs delimited by `;` | Upstream DNS server(s) for Pi-hole to forward queries to, separated by a semicolon <br/> (supports non-standard ports with `#[port number]`) e.g `127.0.0.1#5053;8.8.8.8;8.8.4.4` <br/> (supports [Docker service names and links](https://docs.docker.com/compose/networking/) instead of IPs) e.g `upstream0;upstream1` where `upstream0` and `upstream1` are the service names of or links to docker services <br/> Note: The existence of this environment variable assumes this as the _sole_ management of upstream DNS. Upstream DNS added via the web interface will be overwritten on container restart/recreation |
| `DNSSEC` | `false` | `<"true"\|"false">` | Enable DNSSEC support |
| `DNS_BOGUS_PRIV` | `true` |`<"true"\|"false">`| Never forward reverse lookups for private ranges |
| `DNS_FQDN_REQUIRED` | `true` | `<"true"\|"false">`| Never forward non-FQDNs |
Expand Down Expand Up @@ -150,7 +150,7 @@ There are other environment variables if you want to customize various things in
| WEBLOGS_STDOUT | 0 | 0&vert;1 | 0 logs to defined files, 1 redirect access and error logs to stdout |

## Deprecated environment variables:
While these may still work, they are likely to be removed in a future version. Where applicible, alternative variable names are indicated. Please review the table above for usage of the alternative variables
While these may still work, they are likely to be removed in a future version. Where applicable, alternative variable names are indicated. Please review the table above for usage of the alternative variables

| Docker Environment Var. | Description | Replaced By |
| ----------------------- | ----------- | ----------- |
Expand Down
2 changes: 1 addition & 1 deletion bash_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ prepare_configs() {
installConfigs

if [ ! -f "${setupVars}" ]; then
touch "${setupVars}"
install -m 644 /dev/null "${setupVars}"
echo "Creating empty ${setupVars} file."
fi

Expand Down
7 changes: 7 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ esac
echo "https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.gz"
}

# Helps to have some additional tools in the dev image when debugging
if [[ "${PIHOLE_DOCKER_TAG}" = 'nightly' || "${PIHOLE_DOCKER_TAG}" = 'dev' ]]; then
apt-get update
apt-get install --no-install-recommends -y nano less
rm -rf /var/lib/apt/lists/*
fi

ln -s `which echo` /usr/local/bin/whiptail
curl -L -s "$(s6_download_url)" | tar xvzf - -C /
mv /init /s6-init
Expand Down
2 changes: 1 addition & 1 deletion s6/debian-root/etc/services.d/pihole-FTL/run
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ chown -f pihole:pihole /etc/pihole/pihole-FTL.db /etc/pihole/gravity.db /etc/pih
chmod -f 0664 /etc/pihole/pihole-FTL.db

# Call capsh with the detected capabilities
capsh --inh=${CAP_STR:1} --addamb=${CAP_STR:1} --user=$DNSMASQ_USER --keep=1 -- -c "/usr/bin/pihole-FTL $FTL_CMD"
capsh --inh=${CAP_STR:1} --addamb=${CAP_STR:1} --user=$DNSMASQ_USER --keep=1 -- -c "/usr/bin/pihole-FTL $FTL_CMD >/dev/null 2>&1"

# Notes on above:
# - DNSMASQ_USER default of pihole is in Dockerfile & can be overwritten by runtime container env
Expand Down
19 changes: 11 additions & 8 deletions s6/service
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash
# This script patches all service commands into the appropriate s6- commands
# pi-hole upstream scripts need a 'service' interface. why not systemd? docker said so.

start() {
s6-svc -wu -u -T2500 /var/run/s6/services/$service
restart
}

stop() {
Expand All @@ -12,16 +13,18 @@ stop() {
restart() {
local pid

# Get the PID of the service we are asking to restart
pid=$(pgrep $service)
# Get the PID(s) of the service we are asking to restart
mapfile -t pids < <(pgrep $service)

# Only attempt to stop the service if it is already running
if [ -n "$pid" ]; then
if [ "${#pids[@]}" -gt 0 ]; then
stop

# Loop until we are certain that the process has been stopped
while test -d /proc/$pid; do
sleep 0.2
for pid in "${pids[@]}"; do
# Loop until we are certain that the process has been stopped
while test -d /proc/$pid; do
sleep 0.2
done
done
fi

Expand All @@ -30,7 +33,7 @@ restart() {

# Only attempt to start the service if it is not already running
if [ -z "$pid" ]; then
start
s6-svc -wu -u -T2500 /var/run/s6/services/$service
fi

}
Expand Down

0 comments on commit ebbbdae

Please sign in to comment.