designate/doc/source/install/ubuntu-dev.rst
Eric Larson 9b8ab565fa Assume a new developer won't create a "designate" user in the dev guide
The getting started docs suggest checking the code out into `/var/lib`,
but this requires a later step of adding a `designate` user to the
sudoers list without adding a step of adding the `designate` user in the
first place.

This updates the docs and basic config example to simply check out the
code into `$HOME/openstack/designate/` and removes sudoers step.

Closes-Bug: 1423628
Change-Id: Ia30b5460532589417a7e8b1fad9c233ced954106
2015-02-20 15:14:58 -06:00

7.5 KiB
Raw Blame History

Development Environment on Ubuntu

Designate is comprised of four main components designate-api, designate-central, designate-mdns, and designate-pool-manager, supported by a few standard open source components. For more information see architecture.

There are many different options for customizing Designate, and two of these options have a major impact on the installation process:

  • The storage backend used (SQLite or MySQL)
  • The DNS backend used (PowerDNS or BIND9)

This guide will walk you through setting up a typical development environment for Designate, using BIND9 as the DNS backend and MySQL as the storage backend. 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 (14.04).

Development Environment

Installing Designate

double: install; designate

  1. Install system package dependencies (Ubuntu)
$ apt-get install python-pip python-virtualenv git
$ apt-get build-dep python-lxml
  1. Clone the Designate repo from GitHub
$ mkdir openstack
$ cd openstack
$ git clone https://github.com/openstack/designate.git
$ cd designate
  1. Setup a virtualenv

Note

This is an optional step, but will allow Designate's dependencies to be installed in a contained environment that can be easily deleted if you choose to start over or uninstall Designate.

$ virtualenv --no-site-packages .venv
$ . .venv/bin/activate
  1. Install Designate and its dependencies
$ pip install -r requirements.txt -r test-requirements.txt
$ python setup.py develop
  1. Change directories to the etc/designate folder.

Note

Everything from here on out should take place in or below your designate/etc folder

$ cd etc/designate
  1. Create Designate's config files by copying the sample config files
$ ls *.sample | while read f; do cp $f $(echo $f | sed "s/.sample$//g"); done
  1. Make the directory for Designates log files
$ mkdir -p ../../log
  1. Make the directory for Designates state files
$ mkdir -p ../../state

Configuring Designate

double: configure; designate

Open the designate.conf file for editing

$ editor designate.conf

Copy or mirror the configuration from this sample file here:

../examples/basic-config-sample.conf

Installing RabbitMQ

Note

Do the following commands as "root" or via sudo <command>

Install the RabbitMQ package

$ apt-get install rabbitmq-server

Create a user:

$ rabbitmqctl add_user designate designate

Give the user access to the / vhost:

$ sudo rabbitmqctl set_permissions -p "/" designate ".*" ".*" ".*"

Installing MySQL

double: install; mysql

Install the MySQL server package

$ apt-get install mysql-server-5.5

If you do not have MySQL previously installed, you will be prompted to change the root password. By default, the MySQL root password for Designate is "password". You can:

  • Change the root password to "password"
  • If you want your own password, edit the designate.conf file and change any instance of

    "mysql://root:password@127.0.0.1/designate" to "mysql://root:YOUR_PASSWORD@127.0.0.1/designate"

You can change your MySQL password anytime with the following command:

$ mysqladmin -u root -p password NEW_PASSWORD
Enter password <enter your old password>

Create the Designate tables

$ mysql -u root -p
Enter password: <enter your password here>

mysql> CREATE DATABASE `designate` CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> CREATE DATABASE `designate_pool_manager` CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> exit;

Install additional packages

$ apt-get install libmysqlclient-dev
$ pip install mysql-python

Installing BIND9

double: install; bind9

Install the DNS server, BIND9

$ apt-get install bind9

# Update the BIND9 Configuration
$ editor /etc/bind/named.conf.options

# Change the corresponding lines in the config file:
options {
  directory "/var/cache/bind";
  dnssec-validation auto;
  auth-nxdomain no; # conform to RFC1035
  listen-on-v6 { any; };
  allow-new-zones yes;
  request-ixfr no;
  recursion no;
};

# Disable AppArmor for BIND9
$ touch /etc/apparmor.d/disable/usr.sbin.named
$ service apparmor reload

# Restart BIND9:
$ service bind9 restart

Initialize & Start the Central Service

double: install; central

Sync the Designate database.

$ designate-manage database sync

Start the central service.

$ designate-central

You'll now be seeing the log from the central service.

Initialize & Start the API Service

double: install; api

Open up a new ssh window and log in to your server (or however youre communicating with your server).

$ cd openstack/designate

# Make sure your virtualenv is sourced
$ source .venv/bin/activate

# Start the API Service
$ designate-api

Youll now be seeing the log from the API service.

Initialize & Start the Pool Manager Service

double: install; pool-manager

Open up a new ssh window and log in to your server (or however youre communicating with your server).

# Sync the Pool Manager's cache:
$ designate-manage pool-manager-cache sync

# Start the pool manager service:
$ designate-pool-manager

You'll now be seeing the log from the Pool Manager service.

Initialize & Start the MiniDNS Service

double: install; minidns

Open up a new ssh window and log in to your server (or however youre communicating with your server).

# Start the minidns service:
$ designate-mdns

You'll now be seeing the log from the MiniDNS service.

Exercising the API

Note

If you have a firewall enabled, make sure to open port 53, as well as Designate's default port (9001).

Using a web browser, curl statement, or a REST client, calls can be made to the Designate API using the following format where "api_version" is either v1 or v2 and "command" is any of the commands listed under the corresponding version at rest

http://IP.Address:9001/api_version/command

You can find the IP Address of your server by running

curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'

A couple of notes on the API:

  • Before Domains are created, you must create a server (/v1/servers).