Self-hosting authoritative DNS server with PowerDNS & Docker
Master config
Host: Netcup Country: Germany
version: '3.3'
# copied from https://github.com/pschiffe/docker-pdns/blob/master/docker-compose.yml
# with little changes
services:
mariadb:
image: mariadb:10.11
restart: always
networks:
pdns:
aliases:
- db
- mysql
volumes:
- /etc/localtime:/etc/localtime:ro
- ./data/db:/var/lib/mysql:z
environment:
- MYSQL_ROOT_PASSWORD=CHANGEME
healthcheck:
test: ['CMD', 'mysqladmin', 'ping', '-h', 'localhost']
timeout: 10s
retries: 5
pdns-master:
image: pschiffe/pdns-mysql:alpine
hostname: ns1.protokolla.fi
restart: always
ports:
- '53:53/tcp'
- '53:53/udp'
- '8081:8081/tcp'
networks:
pdns:
ipv4_address: 172.6.0.20
aliases:
- pdns
pdns-api:
volumes:
- /etc/localtime:/etc/localtime:ro
environment:
PDNS_gmysql_password: CHANGEME
PDNS_gmysql_dnssec: "yes"
PDNS_master: "yes"
PDNS_api: "yes"
PDNS_api_key: 'CHANGEME'
PDNS_webserver: "yes"
PDNS_webserver_address: "0.0.0.0"
PDNS_webserver_allow_from: '0.0.0.0/0'
PDNS_version_string: "anonymous"
PDNS_default_ttl: "1500"
PDNS_allow_axfr_ips: "95.216.139.193"
PDNS_only_notify: "95.216.139.193"
depends_on:
- mariadb
pdns-admin-uwsgi:
image: pschiffe/pdns-admin-uwsgi
restart: always
networks:
pdns:
aliases:
- pdns-admin-uwsgi
volumes:
- /etc/localtime:/etc/localtime:ro
environment:
- PDNS_ADMIN_SQLA_DB_PASSWORD='CHANGEME'
- PDNS_VERSION=4.7
- PDNS_API_KEY='CHANGEME'
depends_on:
- mariadb
- pdns-master
pdns-admin-static:
image: pschiffe/pdns-admin-static
restart: always
networks:
- pdns
ports:
- '8040:80/tcp'
volumes:
- /etc/localtime:/etc/localtime:ro
depends_on:
- pdns-admin-uwsgi
networks:
pdns:
ipam:
config:
- subnet: 172.6.0.0/16
gateway: 172.6.0.1
pdns-api:
external: true
Slave config
Host: Hetzner Country: Finland
services:
mariadb:
image: mariadb:11-ubi
user: 0:0
networks:
pdns-mysql:
aliases:
- db
- mysql
volumes:
- /etc/localtime:/etc/localtime:ro
- ./mariadb:/var/lib/mysql:Z
environment:
- MYSQL_ROOT_PASSWORD=CHANGEME
healthcheck:
test: ['CMD', 'healthcheck.sh', '--su=mysql', '--connect', '--innodb_initialized']
timeout: 10s
retries: 5
pdns-mysql-slave:
image: pschiffe/pdns-mysql:${PDNS_MYSQL_TAG:-latest}
hostname: ns2.protokolla.fi
ports:
- '53:53/tcp'
- '53:53/udp'
networks:
pdns-mysql:
ipv4_address: 172.6.0.21
extra_hosts:
- 'ns1.protokolla.fi:5.45.100.150'
- 'ns2.protokolla.fi:95.216.139.193'
volumes:
- /etc/localtime:/etc/localtime:ro
environment:
- PDNS_gmysql_dbname=powerdnsslave
- PDNS_gmysql_password=CHANGEME
- PDNS_secondary=yes
- PDNS_autosecondary=yes
- PDNS_webserver=yes
- PDNS_webserver_address=0.0.0.0
- PDNS_webserver_allow_from=172.6.0.0/16
- PDNS_version_string=anonymous
- PDNS_disable_axfr=yes
- PDNS_allow_notify_from=5.45.100.150
- SUPERMASTER_IPS=5.45.100.150
# logging stuff
- PDNS_log_dns_queries=no
- PDNS_loglevel=3
- PDNS_log_timestamp=yes
depends_on:
- mariadb
networks:
pdns-mysql:
ipam:
config:
- subnet: 172.6.0.0/16
gateway: 172.6.0.1