diff --git a/.github/settings.yml b/.github/settings.yml index 1079651..52aa33c 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -1,7 +1,7 @@ # https://developer.github.com/v3/repos/#edit repository: name: docker-dns - description: "ISC BIND9 DNS server with built-in metrics for Prometheus." + description: "ISC BIND9 DNS server." homepage: https://homecentr.github.io/ private: false has_issues: true diff --git a/Dockerfile b/Dockerfile index 43c5bd9..59852ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,31 +1,14 @@ -FROM golang as metrics-build - -RUN go get github.com/digitalocean/bind_exporter && \ - cd "/go/src/github.com/digitalocean/bind_exporter" && \ - make - -RUN ls /go/src/github.com/digitalocean/bind_exporter - FROM alpine LABEL maintainer="Lukas Holota " RUN apk upgrade --no-cache && \ - apk add --no-cache bind supervisor && \ - apk add --virtual tmp_pip py-pip && \ - pip install supervisor-stdout && \ - apk del tmp_pip && \ + apk add --no-cache bind && \ mkdir /config-default -COPY ./scripts/exit-event-listener.py /usr/local/bin/exit-event-listener -COPY --from=metrics-build /go/src/github.com/digitalocean/bind_exporter/bind_exporter /usr/bin/bind_exporter - -COPY ./config/supervisord.conf /etc/supervisord.conf - COPY ./config/named.conf /config-default/ COPY ./config/healthcheck.conf /config-default/ COPY ./config/healthcheck.zone /config-default/ -COPY ./config/statistics.conf /config-default/ HEALTHCHECK --interval=10s --timeout=3s --start-period=10s --retries=3 CMD [ "nslookup", "ns1.bind9-healthcheck", "127.0.0.1" ] @@ -38,7 +21,7 @@ EXPOSE 53/tcp 53/udp # Dynamic updates from DHCP server EXPOSE 953/tcp -# Prometheus metrics -EXPOSE 9000 +# Default statistics port, not opened by default, must be configured +EXPOSE 8888/tcp -ENTRYPOINT ["supervisord", "-n", "--configuration", "/etc/supervisord.conf"] \ No newline at end of file +ENTRYPOINT ["/usr/sbin/named", "-f", "-g", "-4", "-c", "/config-default/named.conf"] \ No newline at end of file diff --git a/README.md b/README.md index 5584e1f..dba3aa8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # HomeCenter - DNS -This container contains the [BIND9 DNS server](https://www.isc.org/bind/) along with a metrics endpoint compatible with [Prometheus](https://prometheus.io/). +This container contains the [BIND9 DNS server](https://www.isc.org/bind/). ## Project status @@ -41,4 +41,4 @@ See the `example/named.conf` for a quickstart or [BIND9 documentation](https://k |------|-------------| | 53/tcp | DNS protocol over TCP | | 53/udp | DNS protocol over UDP | -| 9000/tcp | HTTP endpoint with Prometheus metrics | \ No newline at end of file +| 8888/tcp | Default port for statistics, is not opened by default, must be configured in named.conf | \ No newline at end of file diff --git a/config/named.conf b/config/named.conf index 21fe7f0..8443838 100644 --- a/config/named.conf +++ b/config/named.conf @@ -1,4 +1,2 @@ include "/config/named.conf"; - -include "/config-default/statistics.conf"; include "/config-default/healthcheck.conf"; \ No newline at end of file diff --git a/config/statistics.conf b/config/statistics.conf deleted file mode 100644 index 5a455d8..0000000 --- a/config/statistics.conf +++ /dev/null @@ -1,3 +0,0 @@ -statistics-channels { - inet 127.0.0.1 port 8888 allow { 127.0.0.1; }; -}; \ No newline at end of file diff --git a/config/supervisord.conf b/config/supervisord.conf deleted file mode 100644 index c1f7edd..0000000 --- a/config/supervisord.conf +++ /dev/null @@ -1,29 +0,0 @@ -[supervisord] -nodaemon=true -loglevel=info -pidfile=/tmp/supervisord.pid - -[program:bind9] -command=/usr/sbin/named -f -g -4 -c /config-default/named.conf -stdout_events_enabled=true -stderr_events_enabled=true - -[program:bind9_metrics] -command=/usr/bin/bind_exporter -bind.stats-groups "server,view,tasks" -web.listen-address ":9000" -bind.stats-url "http://localhost:8888" ;The port should be fixed somehow -stdout_events_enabled=true -stderr_events_enabled=true - -[group:dns] -programs=bind9,bind9_metrics - -[eventlistener:stdout] -command = supervisor_stdout -buffer_size = 1000 -events = PROCESS_LOG -result_handler = supervisor_stdout:event_handler - -[eventlistener:exit_on_any_fatal] -command=/usr/local/bin/exit-event-listener -events=PROCESS_STATE_FATAL -stdout_events_enabled=true -stderr_events_enabled=true \ No newline at end of file diff --git a/example/core b/example/core deleted file mode 100644 index e69de29..0000000 diff --git a/scripts/exit-event-listener.py b/scripts/exit-event-listener.py deleted file mode 100644 index 69b59f4..0000000 --- a/scripts/exit-event-listener.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python -import os -import signal - -from supervisor import childutils - -def main(): - while True: - headers, payload = childutils.listener.wait() - childutils.listener.ok() - if headers['eventname'] != 'PROCESS_STATE_FATAL': - continue - os.kill(os.getppid(), signal.SIGTERM) - -if __name__ == "__main__": - main() \ No newline at end of file