pdns/docker-compose-traefik.yml aktualisiert
This commit is contained in:
@@ -5,60 +5,63 @@ services:
|
||||
image: ${PDNS_IMAGE:-powerdns/pdns:latest}
|
||||
container_name: ${PDNS_CONTAINER_NAME:-powerdns}
|
||||
restart: unless-stopped
|
||||
|
||||
|
||||
# Die Umgebungsvariablen dienen jetzt nur noch als Futter für das Script
|
||||
environment:
|
||||
# API & Webserver
|
||||
PDNS_API: "yes"
|
||||
PDNS_API_KEY: ${PDNS_API_KEY:-changeme}
|
||||
PDNS_WEBSERVER: yes
|
||||
PDNS_WEBSERVER_ADDRESS: 0.0.0.0
|
||||
PDNS_WEBSERVER_PORT: 8081
|
||||
PDNS_LOG_DNS_QUERIES: ${PDNS_LOG_QUERIES:-yes}
|
||||
PDNS_WEBSERVER_LOGGING: ${PDNS_LOG_WEB:-yes}
|
||||
PDNS_LOGLEVEL: ${PDNS_LOG_LEVEL:-6}
|
||||
|
||||
# Master/Slave
|
||||
PDNS_MASTER: ${PDNS_MASTER:-yes}
|
||||
PDNS_SLAVE: ${PDNS_SLAVE:-yes}
|
||||
PDNS_ALLOW_AXFR_IPS: ${PDNS_ALLOW_AXFR_IPS:-}
|
||||
PDNS_API_ALLOW_FROM: ${PDNS_API_ALLOW_FROM:-0.0.0.0/0,::/0}
|
||||
PDNS_WEBSERVER_ALLOW_FROM: ${PDNS_WEBSERVER_ALLOW_FROM:-0.0.0.0/0,::/0}
|
||||
########################################
|
||||
# DATABASE ENGINE (gsqlite3 ODER gpgsql)
|
||||
########################################
|
||||
PDNS_LAUNCH: ${PDNS_LAUNCH:-gsqlite3}
|
||||
|
||||
# SQLite
|
||||
PDNS_GSQLITE3_DATABASE: ${PDNS_GSQLITE3_DATABASE:-/data/pdns.sqlite3}
|
||||
|
||||
# PostgreSQL
|
||||
PDNS_GPGSQL_HOST: ${PDNS_GPGSQL_HOST:-}
|
||||
PDNS_GPGSQL_PORT: ${PDNS_GPGSQL_PORT:-5432}
|
||||
PDNS_GPGSQL_USER: ${PDNS_GPGSQL_USER:-}
|
||||
PDNS_GPGSQL_PASSWORD: ${PDNS_GPGSQL_PASSWORD:-}
|
||||
PDNS_GPGSQL_DBNAME: ${PDNS_GPGSQL_DBNAME:-}
|
||||
PDNS_LOG_LEVEL: ${PDNS_LOG_LEVEL:-6}
|
||||
|
||||
# IPv6 Binding in PowerDNS (optional)
|
||||
# leer = PowerDNS nutzt Default, z.B. nur IPv4
|
||||
PDNS_LOCAL_IPV6: ${PDNS_LOCAL_IPV6:-}
|
||||
entrypoint: ["/bin/sh","-lc"]
|
||||
command:
|
||||
- |
|
||||
set -eu
|
||||
mkdir -p /etc/powerdns/pdns.d
|
||||
|
||||
# Erzeuge die API & Webserver Konfiguration
|
||||
cat > /etc/powerdns/pdns.d/99-env.conf <<EOF
|
||||
api=yes
|
||||
webserver=yes
|
||||
webserver-address=0.0.0.0
|
||||
webserver-port=8081
|
||||
api-key=$${PDNS_API_KEY}
|
||||
webserver-allow-from=$${PDNS_API_ALLOW_FROM}
|
||||
loglevel=$${PDNS_LOG_LEVEL}
|
||||
launch=$${PDNS_LAUNCH}
|
||||
EOF
|
||||
|
||||
# Backend Spezifika
|
||||
if [ "$${PDNS_LAUNCH}" = "gsqlite3" ]; then
|
||||
echo "gsqlite3-database=$${PDNS_GSQLITE3_DATABASE}" >> /etc/powerdns/pdns.d/99-env.conf
|
||||
else
|
||||
cat >> /etc/powerdns/pdns.d/99-env.conf <<EOF
|
||||
gpgsql-host=$${PDNS_GPGSQL_HOST}
|
||||
gpgsql-port=$${PDNS_GPGSQL_PORT}
|
||||
gpgsql-dbname=$${PDNS_GPGSQL_DBNAME}
|
||||
gpgsql-user=$${PDNS_GPGSQL_USER}
|
||||
gpgsql-password=$${PDNS_GPGSQL_PASSWORD}
|
||||
EOF
|
||||
fi
|
||||
|
||||
echo "Generated config in /etc/powerdns/pdns.d/99-env.conf"
|
||||
exec pdns_server --daemon=no --guardian=no --control-console
|
||||
|
||||
volumes:
|
||||
- ${PDNS_DATA_PATH:-pdns-data}:/data
|
||||
|
||||
networks:
|
||||
- proxy # nur für Traefik / API
|
||||
- proxy
|
||||
|
||||
ports:
|
||||
########################################
|
||||
# IPv4 DNS – Public IP + Port parametrisiert
|
||||
########################################
|
||||
- "${PDNS_PUBLIC_IPV4:-0.0.0.0}:${PDNS_PUBLIC_PORT:-53}:53/tcp"
|
||||
- "${PDNS_PUBLIC_IPV4:-0.0.0.0}:${PDNS_PUBLIC_PORT:-53}:53/udp"
|
||||
|
||||
########################################
|
||||
# IPv6 DNS – Public IP + Port parametrisiert
|
||||
# Wenn du KEIN IPv6 willst: diese zwei Zeilen auskommentieren
|
||||
########################################
|
||||
- "[${PDNS_PUBLIC_IPV6:-::}]:${PDNS_PUBLIC_PORT6:-53}:53/tcp"
|
||||
- "[${PDNS_PUBLIC_IPV6:-::}]:${PDNS_PUBLIC_PORT6:-53}:53/udp"
|
||||
|
||||
@@ -69,9 +72,6 @@ services:
|
||||
- "traefik.http.routers.powerdns.tls=true"
|
||||
- "traefik.http.routers.powerdns.tls.certresolver=${PDNS_TRAEFIK_CERTRESOLVER:-letsencrypt}"
|
||||
- "traefik.http.services.powerdns.loadbalancer.server.port=8081"
|
||||
|
||||
|
||||
# HTTP → HTTPS Redirect
|
||||
- "traefik.http.routers.powerdns-insecure.rule=Host(`${PDNS_TRAEFIK_HOST:-dns.example.com}`)"
|
||||
- "traefik.http.routers.powerdns-insecure.entrypoints=web"
|
||||
- "traefik.http.routers.powerdns-insecure.middlewares=powerdns-redirect"
|
||||
@@ -82,4 +82,4 @@ volumes:
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
external: true
|
||||
external: true
|
||||
Reference in New Issue
Block a user