Commit 33b5c76 claimed to harden Pi-hole on both DNS nodes but only
modified markdown — the working docker-compose.yml, gravity-validate.sh,
healthcheck, and autoheal config were never written to the repo, leaving
the DNS hardening unreproducible from version control.
This commits the live, verified-working config from the boxes into
netinfra/pihole/:
- docker-compose.yml (shm_size 1024M root-cause fix, healthcheck, autoheal)
- gravity-validate.sh (pre-start SQLite header check, auto-quarantine corrupt DB)
- .env.example (web UI password templated; real .env gitignored)
Defends against the gravity.db / /dev/shm corruption production outage.
The live password is templated as ${PIHOLE_WEB_PASSWORD} so no secret
enters git.
[#376]
50 lines
1.4 KiB
YAML
50 lines
1.4 KiB
YAML
services:
|
|
pihole:
|
|
container_name: pihole
|
|
# Root cause of the 2026-08 gravity.db corruption: default /dev/shm (64M)
|
|
# was too small for FTL's shared-memory metrics. 1024M has been stable.
|
|
shm_size: '1024M'
|
|
image: pihole/pihole:latest
|
|
hostname: pihole
|
|
entrypoint: ["/usr/local/bin/gravity-validate.sh"]
|
|
ports:
|
|
- "53:53/tcp"
|
|
- "53:53/udp"
|
|
- "10002:80/tcp"
|
|
- "10003:443/tcp"
|
|
environment:
|
|
TZ: 'America/Chicago'
|
|
FTLCONF_webserver_api_password: '${PIHOLE_WEB_PASSWORD}'
|
|
FTLCONF_dns_listeningMode: 'all'
|
|
volumes:
|
|
- './etc-pihole:/etc/pihole'
|
|
- './etc-dnsmasq.d:/etc/dnsmasq.d'
|
|
- './gravity-validate.sh:/usr/local/bin/gravity-validate.sh:ro'
|
|
cap_add:
|
|
- SYS_NICE
|
|
restart: always
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "dig +short +norecurse @127.0.0.1 pi.hole >/dev/null 2>&1 && test -s /etc/pihole/gravity.db || exit 1"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 60s
|
|
labels:
|
|
autoheal: "true"
|
|
networks:
|
|
- default
|
|
- dnsnet
|
|
autoheal:
|
|
container_name: autoheal
|
|
image: willfarrell/autoheal:latest
|
|
environment:
|
|
AUTOHEAL_CONTAINER_LABEL: autoheal
|
|
AUTOHEAL_INTERVAL: 30
|
|
AUTOHEAL_START_PERIOD: 60
|
|
volumes:
|
|
- '/var/run/docker.sock:/var/run/docker.sock:ro'
|
|
restart: always
|
|
networks:
|
|
dnsnet:
|
|
external: true
|