pdns/docker-compose-traefik.yml aktualisiert
This commit is contained in:
@@ -25,24 +25,10 @@ services:
|
||||
set -eu
|
||||
mkdir -p /etc/powerdns/pdns.d
|
||||
|
||||
# Pfad zum Binary finden
|
||||
PDNS_BIN=$$(which pdns_server || echo "/usr/local/sbin/pdns_server")
|
||||
DB_FILE="$${PDNS_GSQLITE3_DATABASE}"
|
||||
|
||||
# 1. Vorbereitung als Root
|
||||
if [ ! -f "$$DB_FILE" ]; then
|
||||
echo "Initialisiere SQLite als root..."
|
||||
touch "$$DB_FILE"
|
||||
# Wir finden heraus, welcher User pdns normalerweise gehört (meist pdns)
|
||||
# und geben ihm die Datei. Falls der User nicht existiert, nutzen wir 666.
|
||||
chmod 666 "$$DB_FILE"
|
||||
|
||||
SCHEMA=$$(find /usr -name schema.sqlite3.sql | head -n 1)
|
||||
if [ -n "$$SCHEMA" ]; then
|
||||
sqlite3 "$$DB_FILE" < "$$SCHEMA"
|
||||
fi
|
||||
fi
|
||||
|
||||
# 2. Config schreiben
|
||||
|
||||
# 1. API-Konfiguration schreiben
|
||||
cat > /etc/powerdns/pdns.d/99-env.conf <<EOF
|
||||
api=yes
|
||||
webserver=yes
|
||||
@@ -50,15 +36,22 @@ services:
|
||||
webserver-port=8081
|
||||
api-key=$${PDNS_API_KEY}
|
||||
webserver-allow-from=$${PDNS_API_ALLOW_FROM}
|
||||
loglevel=$${PDNS_LOG_LEVEL}
|
||||
launch=gsqlite3
|
||||
gsqlite3-database=$$DB_FILE
|
||||
# Diese Zeilen sagen PowerDNS, zu wem es wechseln soll:
|
||||
setuid=pdns
|
||||
setgid=pdns
|
||||
gsqlite3-database=/data/pdns.sqlite3
|
||||
EOF
|
||||
|
||||
echo "Startserver: $$PDNS_BIN"
|
||||
# Wir starten als root, aber PDNS wechselt intern sofort den User
|
||||
# 2. Datenbank-Schema initialisieren, falls Datei leer oder fehlt
|
||||
if [ ! -s "/data/pdns.sqlite3" ]; then
|
||||
echo "Initialisiere SQLite Datenbank..."
|
||||
SCHEMA=$$(find /usr -name schema.sqlite3.sql | head -n 1)
|
||||
if [ -n "$$SCHEMA" ]; then
|
||||
sqlite3 /data/pdns.sqlite3 < "$$SCHEMA"
|
||||
echo "Schema erfolgreich importiert."
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Starte PowerDNS über $$PDNS_BIN..."
|
||||
exec $$PDNS_BIN --daemon=no --guardian=no --control-console
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user