#!/bin/bash # # PowerDNS Admin Service PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin config_pdnsadmin() { echo -ne "* Configuring pdnsadmin container.." if [ ! -d "/federated/apps/pdnsadmin" ]; then mkdir -p /federated/apps/pdnsadmin/data/etc fi cat > /federated/apps/pdnsadmin/docker-compose.yml < /federated/apps/pdnsadmin/.env < /federated/apps/pdnsadmin/data/etc/uwsgi.ini <<'EOF' [uwsgi] strict = true master = true die-on-term = true need-app = true plugins = python3 uid = uwsgi gid = uwsgi chdir = /opt/powerdns-admin pythonpath = /opt/powerdns-admin mount = /=run.py manage-script-name = true callable = app vacuum = true harakiri = 20 buffer-size = 32768 post-buffering = 8192 protocol = http http-socket = 0.0.0.0:9494 pidfile = /run/uwsgi/%n.pid enable-threads = true EOF echo -ne "done.\n" } start_pdnsadmin() { # Start service with command to make sure it's up before proceeding start_service "pdnsadmin" "nc -z 192.168.0.12 9494 &> /dev/null" "8" # Run MySQL command to create admin user for pdns admin interface # Allowed to fail because the user may already be there from a previous start. docker exec pdnsmysql bash -c "mariadb -updns -p$MYSQL_PASSWORD pdns -e '$PDNS_MYSQL_COMMAND;'" || : echo -ne "done.\n" }