Designate is comprised of three designate components Designate API, Designate Central and Designate Sink, supported by a few standard open source components. For more information see Architecture.
This guide will walk you through setting up a development environment for Designate, using PowerDNS as the DNS backend, where possible the simplest options have been chosen for you. For a more complete discussion on installation & configuration options, please see Architecture and Production Architecture.
For this guide you will need access to an Ubuntu Server (12.04). Other platforms:
$ apt-get install python-pip python-virtualenv
$ apt-get install rabbitmq-server
$ apt-get build-dep python-lxml
$ git clone https://github.com/stackforge/designate.git
$ cd designate
Note
This is to not interfere with system packages etc.
$ virtualenv --no-site-packages .venv
$ . .venv/bin/activate
$ pip install -r requirements.txt -r test-requirements.txt
$ python setup.py develop
Note
Everything from here on out should take place in or below your designate/etc folder
$ cd etc/designate
$ ls *.sample | while read f; do cp $f $(echo $f | sed "s/.sample$//g"); done
$ DEBIAN_FRONTEND=noninteractive apt-get install pdns-server pdns-backend-sqlite3
#Update path to SQLite database to /root/designate/pdns.sqlite or wherever your top level designate directory resides
$ editor /etc/powerdns/pdns.d/pdns.local.gsqlite3
#Change the corresponding line in the config file to mirror:
gsqlite3-database=/root/designate/pdns.sqlite
#Restart PowerDNS:
$ service pdns restart
$ echo "designate ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/90-designate
$ sudo chmod 0440 /etc/sudoers.d/90-designate
$ mkdir /var/log/designate
$ editor designate.conf
Copy or mirror the configuration from this sample file here:
[DEFAULT]
########################
## General Configuration
########################
# Show more verbose log output (sets INFO log level output)
verbose = True
# Show debugging output in logs (sets DEBUG log level output)
debug = True
# Top-level directory for maintaining designate's state
state_path = /root/designate
# Log directory #Make sure and create this directory, or set it to some other directory that exists
logdir = /var/log/designate
# Driver used for issuing notifications
notification_driver = designate.openstack.common.notifier.rpc_notifier
# Use "sudo designate-rootwrap /etc/designate/rootwrap.conf" to use the real
# root filter facility.
# Change to "sudo" to skip the filtering and just run the comand directly
root_helper = sudo
########################
## Service Configuration
########################
#-----------------------
# Central Service
#-----------------------
[service:central]
# Driver used for backend communication (e.g. fake, rpc, bind9, powerdns)
backend_driver = powerdns
# Maximum domain name length
max_domain_name_len = 255
# Maximum record name length
max_record_name_len = 255
#-----------------------
# API Service
#-----------------------
[service:api]
# Address to bind the API server
api_host = 0.0.0.0
# Port the bind the API server to
api_port = 9001
# Authentication strategy to use - can be either "noauth" or "keystone"
auth_strategy = noauth
# Enabled API Version 1 extensions
enabled_extensions_v1 = diagnostics, quotas, reports, sync
########################
## Storage Configuration
########################
#-----------------------
# SQLAlchemy Storage
#-----------------------
[storage:sqlalchemy]
# Database connection string - to configure options for a given implementation
# like sqlalchemy or other see below
database_connection = sqlite:///$state_path/designate.sqlite
connection_debug = 100
connection_trace = True
sqlite_synchronous = True
idle_timeout = 3600
max_retries = 10
retry_interval = 10
########################
## Backend Configuration
########################
#-----------------------
# PowerDNS Backend
#-----------------------
[backend:powerdns]
database_connection = sqlite:///$state_path/pdns.sqlite
connection_debug = 100
connection_trace = True
sqlite_synchronous = True
idle_timeout = 3600
max_retries = 10
retry_interval = 10
#Initialize and sync the Designate database:
$ designate-manage database-init
$ designate-manage database-sync
#Initialize and sync the PowerDNS database:
$ designate-manage powerdns database-init
$ designate-manage powerdns database-sync
#Restart PowerDNS
$ service pdns restart
#Start the central service:
$ designate-central
Note
If you get an error of the form: ERROR [designate.openstack.common.rpc.common] AMQP server on localhost:5672 is unreachable: Socket closed
Run the following command:
$ rabbitmqctl change_password guest guest
#Then try starting the service again
$ designate-central
You’ll now be seeing the log from the central service.
Open up a new ssh window and log in to your server (or however you’re communicating with your server).
$ cd root/designate
#Make sure your virtualenv is sourced
$ . .venv/bin/activate
$ cd etc/designate
#Start the API Service
$ designate-api
#You may have to run root/designate/bin/designate-api
You’ll now be seeing the log from the API service.
Using a web browser, curl statement, or a REST client calls can be made to the Designate API using the following format where “command” is any of the commands listed in the REST API Documentation
http://IP.Address:9001/v1/command
You can find the IP Address of your server by running
wget http://ipecho.net/plain -O - -q ; echo
A couple of notes on the API:
Most of the above instructions under Installing Designate should work. There are a few differences when working with Fedora 19:
The basic Fedora packages are python-pip python-virtualenv python-pbr rabbitmq-server
$ yum install python-pip python-virtualenv python-pbr rabbitmq-server
Use /var/lib/designate as the root path for databases and other variable state files, not /root/designate
$ mkdir -p /var/lib/designate
The PowerDNS Fedora packages are pdns pdns-backend-sqlite
$ yum install pdns pdns-backend-sqlite
Fedora 19 does not use /etc/powerdns/pdns.d. Instead, edit /etc/pdns/pdns.conf - change the launch option, and add a gsqlite3-database option
...
setuid=pdns
setgid=pdns
launch=gsqlite3
gsqlite3-database=/var/lib/designate/pdns.sqlite
...
Fedora uses systemctl, not service
$ systemctl [start|restart|stop|status] pdns.service
$ systemctl [start|restart|stop|status] rabbitmq-server.service
The rabbitmq service must be running before doing
$ rabbitmqctl change_password guest guest
RabbitMQ may fail to start due to SELinux. Use journalctl -xn|cat to find the error. You will likely have to do something like this until it is added to the SELinux base policy
$ yum install /usr/bin/checkpolicy
$ grep beam /var/log/audit/audit.log|audit2allow -M mypol
$ semodule -i mypol.pp
$ systemctl start rabbitmq-server.service
The rabbitmq log files are in /var/log/rabbitmq