slapos-testing: add missing eggs.
[slapos.git] / software / powerdns / instance-powerdns.cfg
1 {% if slap_software_type in software_type -%}
2 {% set part_list =  [] %}
3
4 # Create all needed directories
5 [directory]
6 recipe = slapos.cookbook:mkdirectory
7
8 bin = $${buildout:directory}/bin/
9 etc = $${buildout:directory}/etc/
10 srv = $${buildout:directory}/srv/
11 var = $${buildout:directory}/var/
12 template = $${buildout:directory}/template/
13
14 backup = $${:srv}/backup
15 log = $${:var}/log
16 run = $${:var}/run
17 service = $${:etc}/service
18 etc-run = $${:etc}/run
19 promise = $${:etc}/promise
20
21 logrotate-backup = $${:backup}/logrotate
22 logrotate-entries = $${:etc}/logrotate.d
23
24 cron-entries = $${:etc}/cron.d
25 crontabs = $${:etc}/crontabs
26 cronstamps = $${:etc}/cronstamps
27 ca-dir = $${:srv}/ssl
28
29 # Instance parameters
30 [instance-parameter]
31 # Fetches parameters defined in SlapOS Master for this instance.
32 # Always the same.
33 recipe = slapos.cookbook:slapconfiguration.serialised
34 computer = $${slap-connection:computer-id}
35 partition = $${slap-connection:partition-id}
36 url = $${slap-connection:server-url}
37 key = $${slap-connection:key-file}
38 cert = $${slap-connection:cert-file}
39
40
41 # Generic jinja section to extend
42 [jinja2-template-base]
43 recipe = slapos.recipe.template:jinja2
44 rendered = $${buildout:directory}/$${:filename}
45 extra-context =
46 context =
47     import json_module json
48     key eggs_directory buildout:eggs-directory
49     key develop_eggs_directory buildout:develop-eggs-directory
50     key slap_software_type instance-parameter:slap-software-type
51     key slapparameter_dict instance-parameter:configuration
52     section directory directory
53     $${:extra-context}
54
55 ####################
56 # PowerDNS sections
57 #
58 [pdns]
59 configuration = $${pdns-directory:configuration}/pdns.conf
60 local-ipv4 = $${instance-parameter:ipv4-random}
61 ipv6 = $${instance-parameter:ipv6-random}
62 port = 5353
63 socket-directory = $${pdns-directory:socket}
64 webserver-port = 8088
65
66 [geo]
67 ip-map-zonefile = ${iso-list:location}/${iso-list:filename}
68 geo-maps = $${pdns-directory:geo-maps}
69
70 [pdns-directory]
71 recipe = slapos.cookbook:mkdirectory
72 configuration = $${directory:etc}/pdns
73 geo-maps = $${:configuration}/geo-maps
74 socket = $${directory:run}/pdns-socket
75
76 [pdns-configuration-template]
77 < = jinja2-template-base
78 template = ${template-pdns-configuration:target}
79 rendered = $${pdns:configuration}
80 extra-context =
81   section pdns pdns
82   section geo geo
83
84 # Executables
85 [pdns-server]
86 recipe = slapos.cookbook:wrapper
87 command-line = ${powerdns:location}/sbin/pdns_server --config-dir=$${pdns-directory:configuration}
88 wrapper-path = $${directory:service}/pdns
89
90 [pdns-reload]
91 recipe = slapos.cookbook:wrapper
92 command-line = ${powerdns:location}/bin/pdns_control reload --config-dir=$${pdns-directory:configuration}
93 wrapper-path = $${directory:etc-run}/pdns-reload
94
95 # Promises
96 [pdns-promise-listen-port]
97 recipe = slapos.cookbook:check_port_listening
98 path = $${directory:promise}/pdns-port-listening
99 hostname = $${pdns:local-ipv4}
100 port = $${pdns:port}
101
102 #####################
103 # Power DNS Slave configuration
104 #
105 {% set slave_instance_list = json_module.loads(slapparameter_dict.get('extra_slave_instance_list', '')) %}
106
107 # Iter through slave list to prepare configuration
108 {% for slave in slave_instance_list %}
109 {%   if 'record' in slave and 'origin' in slave and 'default' in slave %}
110 {%     set slave_reference = slave.get('slave_reference') %}
111 {%     set slave_section_name = 'map-configuration-%s' % slave_reference  %}
112 {%     do part_list.append(slave_section_name) %}
113 [{{ slave_section_name }}]
114 < = jinja2-template-base
115 template = ${template-cdn-conf:location}/${template-cdn-conf:filename}
116 rendered = $${geo:geo-maps}/{{ slave_reference }}
117 configuration = {{ json_module.dumps(slave) }}
118 extra-context =
119   key json_cdn :configuration
120 {%   endif %}
121 {% endfor %}
122
123 ####################
124 # Monitoring
125 [monitor-rewrite-rule]
126 powerdns = http://$${pdns:local-ipv4}:$${pdns:webserver-port}/
127
128 [buildout]
129 parts =
130   pdns-configuration-template
131   pdns-server
132   pdns-reload
133   pdns-promise-listen-port
134   publish-connection-informations
135 {% for part in part_list %}
136 {{ '  %s' % part }}
137 {% endfor %}
138 ## Monitoring part
139 ###Parts to add for monitoring
140   cron
141   certificate-authority
142   cron-entry-monitor
143   cron-entry-rss
144   deploy-index
145   deploy-settings-cgi
146   deploy-status-cgi
147   deploy-status-history-cgi
148   setup-static-files
149   certificate-authority
150   zero-parameters
151   public-symlink
152   cgi-httpd-wrapper
153   cgi-httpd-graceful-wrapper
154   monitor-promise
155   monitor-instance-log-access
156
157 extends = ${monitor-template:output}
158
159 eggs-directory = {{ eggs_directory }}
160 develop-eggs-directory = {{ develop_eggs_directory }}
161 offline = true
162 {% endif%}