-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.dcape
70 lines (51 loc) · 2.13 KB
/
Makefile.dcape
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# dcape-app-powerdns Makefile
# for use as part od dcape
SHELL = /bin/bash
#- ******************************************************************************
#- Powerdns: dcape core config
#- powerdns docker image
PDNS_IMAGE ?= $(PDNS_IMAGE0)
#- powerdns docker image version
PDNS_VER ?= $(PDNS_VER0)
#- Stats site host
PDNS_HOST ?= ns.$(DCAPE_DOMAIN)
#- Wildcard zone nameserver
#- NS value for $(DCAPE_DOMAIN) CNAME record
#- Used for zone SOA record & for internal access from traefik
ACME_NS ?= ns.$(DCAPE_DOMAIN)
#- Setup ACME zone for this domain
#- CNAME value for $(DCAPE_DOMAIN) record
ACME_DOMAIN ?= acme-$(DCAPE_DOMAIN)
#- Admin email for wildcard zone SOA recors
ACME_ADMIN_EMAIL ?= $(TRAEFIK_ACME_EMAIL)
#- ------------------------------------------------------------------------------
#- Powerdns: internal config
#- Database name and database user name
PDNS_DB_TAG ?= pdns
#- Database user password
PDNS_DB_PASS ?= $(shell openssl rand -hex 16; echo)
#- dcape root directory
DCAPE_ROOT ?= $(DCAPE_ROOT)
# DB tag and pass vars prefix
NAME ?= PDNS
# User who runs bootstrap code
DB_ADMIN_USER = $(PDNS_DB_TAG)
# for powerdns-load-sql
ZONE_SQL ?= zone.sql
# ------------------------------------------------------------------------------
include $(DCAPE_ROOT)/Makefile.dcape
init:
@if [[ "$$PDNS_VER0" != "$$PDNS_VER" ]] ; then \
echo "Warning: PDNS_VER in dcape ($$PDNS_VER0) differs from yours ($$PDNS_VER)" ; \
fi
@echo " Stats URL: $(DCAPE_SCHEME)://$(PDNS_HOST)"
@echo " Listen: $(PDNS_LISTEN)"
# create user, db and load sql
.setup-before-up: db-create db-load-acme
db-load-acme:
@echo "*** $@ ***" ; \
[[ "$$DNS" != "wild" ]] || cat setup.acme.sql | $(MAKE) -s compose CMD="exec -T db psql -U $$PDNS_DB_TAG -d $$PDNS_DB_TAG -vACME_DOMAIN=$$ACME_DOMAIN -vACME_NS=$$ACME_NS -vNS_ADMIN=$$ACME_ADMIN_EMAIL" || true
# load powerdns zone from $(ZONE_SQL)
# Example: make powerdns-load-sql ZONE_SQL=z.sql DCAPE_STACK=1
powerdns-load-sql: $(ZONE_SQL) docker-wait
cat $(ZONE_SQL) | $(MAKE) -s compose CMD="exec -T db psql -U $$PDNS_DB_TAG -d $$PDNS_DB_TAG"