Docker Setups

Peter Thomassen edited this page Feb 13, 2017 · 2 revisions

Table of Contents


Docker Slave (with MySQL replication)

deSEC develops and maintains an open-source docker-compose application at https://github.com/desec-io/desec-slave (MIT license).

The app contains a pdns and a MariaDB container (compatible to MySQL). Zones are retrieved from the database. The MariaDB container is configured to establish a TLS-secured replication connection to retrieve zone changes from another database. When starting up for the first time, the init scripts retrieve a database dump from the replication master, prepare the local database based on it, and start replication.

To set things up, various environment variables need to be configured in a .env file (replication master credentials, certificate paths etc., pdns statistics settings, log level, as well as IPv6 network settings). Further information can be found in the README file in the project repository.

For questions, bug reports etc., please open an issue directly with the desec-slave project.

Docker Development Environment

A script can be found here, which enables you to build and run powerdns with different backend configurations in a docker container managing all dependencies.

Usecase & Benefits

The script is designed to provide an easy setup for the powerdns development. You just clone the repository, run the setup and you immediately will be able to compile and run a server or the test cases.
The benefits of a docker development environment include:

  • You do not have to install any dependencies (except docker of course).
  • It's easy to use pdns with different backends without changing anything on your system
  • It is easy to reproduce problems other developers might face without having to worry that it's a configuration problem of the developers system

Example workflow

Setup

~$ git clone https://github.com/PowerDNS/pdns.git
~$ git clone https://github.com/benj-zen/pdns_docker_dev.git
~$ cd pdns_docker_dev
~/pdns_docker_dev$ ./pdns_dev init
Please enter the path to your pdns repository: /home/example/pdns_repo_location/

After cloning the PowerDNS and pdns_docker_dev repositories the base image will now be set up.

Selecting and configuring a backend

~/pdns_docker_dev$ ./pdns_dev configure server gmysql

Now building the backend image, installing dependencies for the server images and configuring the server build. Later perform this step if you want to do a clean build.

Compiling

~/pdns_docker_dev$ ./pdns_dev make server gmysql

The server will now compile. This step can be repeated for building updated code.

Running

~/pdns_docker_dev$ ./pdns_dev run server gmysql

The server will now run. When starting for the first time it can take some time for the backend to initialize.

Testing

Repeat the steps above replacing 'server' with 'test' to compile an image capable of running the api-tests.

~/pdns_docker_dev$ ./pdns_dev configure test
~/pdns_docker_dev$ ./pdns_dev make test
~/pdns_docker_dev$ ./pdns_dev run test