First partial working docker setup

add initial version of docker setup

add configuration via environment variables

remove override file

support docker-compose.override.yml

add up2date pdns container
This commit is contained in:
Philipp Böhm 2016-12-25 23:09:05 +01:00
parent 6af394aa2f
commit e82621e153
8 changed files with 92 additions and 4 deletions

5
.gitignore vendored
View File

@ -1,5 +1,4 @@
*.swp
pdns.conf
pdns_backend.py
ddns
/docker/docker-compose.override.yml
/ddns
dump.rdb

3
docker/ddns/Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM golang:1.7-onbuild
CMD ["/bin/true"]

43
docker/docker-compose.yml Normal file
View File

@ -0,0 +1,43 @@
version: '2'
volumes:
ddns:
services:
ddns:
restart: unless-stopped
build:
context: ..
dockerfile: docker/ddns/Dockerfile
volumes:
- ddns:/go/bin/
ddns-web:
restart: unless-stopped
build:
context: web/
dockerfile: Dockerfile
depends_on:
- redis
volumes_from:
- ddns
environment:
DDNS_DOMAIN: d.example.net
ddns-powerdns:
restart: unless-stopped
build:
context: powerdns/
dockerfile: Dockerfile
depends_on:
- redis
volumes_from:
- ddns
environment:
DDNS_DOMAIN: d.example.net
DDNS_SOA_DOMAIN: soa.example.net
DDNS_VERBOSE: --verbose
redis:
restart: unless-stopped
image: redis:latest

View File

@ -0,0 +1,20 @@
FROM buildpack-deps:jessie-scm
MAINTAINER Philipp Böhm <philipp@pboehm.org>
# the setup procedure according to https://repo.powerdns.com/ (Debian 8 Jessie)
RUN echo "deb http://repo.powerdns.com/debian jessie-auth-40 main" > /etc/apt/sources.list.d/pdns.list \
&& echo "Package: pdns-*\nPin: origin repo.powerdns.com\nPin-Priority: 600\n" >> /etc/apt/preferences.d/pdns \
&& curl https://repo.powerdns.com/FD380FBB-pub.asc | apt-key add - \
&& apt-get -y update \
&& apt-get install -y pdns-server pdns-backend-pipe \
&& rm -rf /var/lib/apt/lists/*
COPY pdns.conf /etc/powerdns/pdns.conf
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 53
CMD ["pdns_server", "--daemon=no"]

View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
CONFIG_FILE=/etc/powerdns/pdns.conf
sed -i 's/{{DDNS_DOMAIN}}/'"${DDNS_DOMAIN}"'/g' ${CONFIG_FILE}
sed -i 's/{{DDNS_SOA_DOMAIN}}/'"${DDNS_SOA_DOMAIN}"'/g' ${CONFIG_FILE}
sed -i 's/{{DDNS_VERBOSE}}/'"${DDNS_VERBOSE}"'/g' ${CONFIG_FILE}
exec "$@"

View File

@ -0,0 +1,8 @@
disable-tcp=yes
cache-ttl=0
loglevel=7
log-dns-details=yes
disable-axfr=yes
launch=pipe
pipe-command=/go/bin/app --domain={{DDNS_DOMAIN}} --soa_fqdn={{DDNS_SOA_DOMAIN}} --redis=redis:6379 {{DDNS_VERBOSE}} backend

6
docker/web/Dockerfile Normal file
View File

@ -0,0 +1,6 @@
FROM buildpack-deps:jessie-scm
MAINTAINER Philipp Böhm <philipp@pboehm.org>
ENV GIN_MODE release
CMD /go/bin/app --domain=${DDNS_DOMAIN} --redis=redis:6379 web

View File

@ -4,7 +4,7 @@ import (
"../config"
"../hosts"
"fmt"
"github.com/gin-gonic/gin"
"gopkg.in/gin-gonic/gin.v1"
"html/template"
"log"
"net"