#!/bin/bash # # PowerDNS DNS Service PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin config_pdns() { echo -ne "\n* Configuring /federated/apps/pdns container.." spin & SPINPID=$! if [ ! -d "/federated/apps/pdns" ]; then mkdir -p /federated/apps/pdns/data/root fi cat > /federated/apps/pdns/docker-compose.yml < /federated/apps/pdns/.env < /federated/apps/pdns/data/root/createrecords.sh < /dev/null echo -ne "done." } start_pdns() { # Grab the container IP from docker-compose above SERVICE_IP=`grep ipv4_address /federated/apps/pdns/docker-compose.yml | awk '{ print $2 }'` # Start service with command to make sure it's up before proceeding start_service "pdns" "nc -z ${SERVICE_IP} 8081 &> /dev/null" # Run createrecords.sh inside baserow container docker exec -it pdns /root/createrecords.sh &> /dev/null [ $? -ne 0 ] && fail "Couldn't run createrecords.sh in /federated/apps/pdns container" kill -9 $SPINPID &> /dev/null echo -ne "done." }