From: Pieter Lexis Date: Thu, 14 Dec 2017 13:54:02 +0000 (+0100) Subject: builder: auth centos targets X-Git-Tag: dnsdist-1.3.3~83^2~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=927e24d482d3f62872f5619df0390ae1b878da74;p=thirdparty%2Fpdns.git builder: auth centos targets --- diff --git a/Makefile.am b/Makefile.am index 49e1cea72f..9a2942c458 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,6 +4,7 @@ EXTRA_DIST = \ INSTALL \ NOTICE \ README \ + COPYING \ codedocs/doxygen.conf \ contrib/powerdns.solaris.init.d \ pdns/named.conf.parsertest \ diff --git a/builder-support/dockerfiles/Dockerfile.authoritative b/builder-support/dockerfiles/Dockerfile.authoritative index aaade0b616..13de945a25 100644 --- a/builder-support/dockerfiles/Dockerfile.authoritative +++ b/builder-support/dockerfiles/Dockerfile.authoritative @@ -3,9 +3,8 @@ FROM alpine:3.6 as pdns-authoritative RUN apk add --no-cache gcc g++ make tar autoconf automake protobuf-dev lua-dev \ libtool file boost-dev curl openssl-dev ragel py-virtualenv - # the pdns/ dir is a bit broad, but who cares :) -ADD configure.ac Makefile.am INSTALL NOTICE README /pdns-authoritative/ +ADD configure.ac Makefile.am COPYING INSTALL NOTICE README /pdns-authoritative/ @EXEC sdist_dirs=(build-aux m4 pdns ext docs modules codedocs contrib regression-tests) @EXEC for d in ${sdist_dirs[@]} ; do echo "COPY $d/ /pdns-authoritative/$d/" ; done ADD builder/helpers/set-configure-ac-version.sh /pdns-authoritative/builder/helpers/ diff --git a/builder-support/dockerfiles/Dockerfile.rpmbuild b/builder-support/dockerfiles/Dockerfile.rpmbuild new file mode 100644 index 0000000000..677c2b22c8 --- /dev/null +++ b/builder-support/dockerfiles/Dockerfile.rpmbuild @@ -0,0 +1,35 @@ +FROM dist-base as package-builder +RUN yum install -y rpm-build rpmdevtools python34 && \ + yum groupinstall -y "Development Tools" && \ + rpmdev-setuptree + +RUN mkdir /dist /pdns +WORKDIR /pdns +RUN rpmdev-setuptree + +# Only ADD/COPY the files you really need for efficient docker caching. +ADD builder/helpers/ /pdns/builder/helpers/ + +# Used for -p option to only build specific spec files +ARG BUILDER_PACKAGE_MATCH + +ARG BUILDER_VERSION +ARG BUILDER_RELEASE +COPY --from=sdist /sdist /sdist +RUN for file in /sdist/* ; do ln -s $file /root/rpmbuild/SOURCES/ ; done && ls /root/rpmbuild/SOURCES/ + +ADD builder-support/specs/ /pdns/builder-support/specs +RUN find /pdns/builder-support/specs/ -not -name '*.spec' -exec ln -s {} /root/rpmbuild/SOURCES/ \; + +@IF [ ! -z "$M_authoritative" ] +RUN if $(grep -q 'release 6' /etc/redhat-release); then \ + scl enable devtoolset-3 -- builder/helpers/build-specs.sh builder-support/specs/pdns.spec; \ + else \ + builder/helpers/build-specs.sh builder-support/specs/pdns.spec; \ + fi +@ENDIF + +# mv accross layers with overlay2 is buggy in some kernel versions (results in empty dirs) +# See: https://github.com/moby/moby/issues/33733 +#RUN mv /root/rpmbuild/RPMS/* /dist/ +RUN cp -R /root/rpmbuild/RPMS/* /dist/ diff --git a/builder-support/dockerfiles/Dockerfile.target.centos-6 b/builder-support/dockerfiles/Dockerfile.target.centos-6 new file mode 100644 index 0000000000..0d53ed47b6 --- /dev/null +++ b/builder-support/dockerfiles/Dockerfile.target.centos-6 @@ -0,0 +1,15 @@ +# First do the source builds +@INCLUDE Dockerfile.target.sdist + +# This defines the dstribution base layer +# Put only the bare minimum of common commands here, without dev tools +FROM centos:6 as dist-base +RUN yum install -y epel-release centos-release-scl-rh && \ + yum install -y --nogpgcheck devtoolset-3-gcc-c++ + +# Do the actual rpm build +@INCLUDE Dockerfile.rpmbuild + +# Do a test install and verify +# Can be skipped with skiptests=1 in the environment +# @EXEC [ "$skiptests" = "" ] && include Dockerfile.rpmtest diff --git a/builder-support/dockerfiles/Dockerfile.target.centos-7 b/builder-support/dockerfiles/Dockerfile.target.centos-7 new file mode 100644 index 0000000000..cbf48a4df1 --- /dev/null +++ b/builder-support/dockerfiles/Dockerfile.target.centos-7 @@ -0,0 +1,14 @@ +# First do the source builds +@INCLUDE Dockerfile.target.sdist + +# This defines the dstribution base layer +# Put only the bare minimum of common commands here, without dev tools +FROM centos:7 as dist-base +RUN yum install -y epel-release + +# Do the actual rpm build +@INCLUDE Dockerfile.rpmbuild + +# Do a test install and verify +# Can be skipped with skiptests=1 in the environment +# @EXEC [ "$skiptests" = "" ] && include Dockerfile.rpmtest diff --git a/builder-support/dockerfiles/Dockerfile.target.sdist b/builder-support/dockerfiles/Dockerfile.target.sdist index bd98dd4035..5c1c160e2d 100644 --- a/builder-support/dockerfiles/Dockerfile.target.sdist +++ b/builder-support/dockerfiles/Dockerfile.target.sdist @@ -1,25 +1,25 @@ -@IF [ ! -z "$M_all$M_authoritative" ] +@IF [ ! -z "$M_authoritative" ] @INCLUDE Dockerfile.authoritative @ENDIF -@IF [ ! -z "$M_all$M_recursor" ] +@IF [ ! -z "$M_recursor" ] @INCLUDE Dockerfile.recursor @ENDIF -@IF [ ! -z "$M_all$M_dnsdist" ] +@IF [ ! -z "$M_dnsdist" ] @INCLUDE Dockerfile.dnsdist @ENDIF FROM alpine:3.6 as sdist -@IF [ ! -z "$M_all$M_authoritative" ] +@IF [ ! -z "$M_authoritative" ] COPY --from=pdns-authoritative /sdist/ /sdist/ @ENDIF -@IF [ ! -z "$M_all$M_recursor" ] +@IF [ ! -z "$M_recursor" ] COPY --from=recursor /sdist/ /sdist/ @ENDIF -@IF [ ! -z "$M_all$M_dnsdist" ] +@IF [ ! -z "$M_dnsdist" ] COPY --from=dnsdist /sdist/ /sdist/ @ENDIF diff --git a/builder-support/specs/pdns.init b/builder-support/specs/pdns.init new file mode 100644 index 0000000000..c544f9a95c --- /dev/null +++ b/builder-support/specs/pdns.init @@ -0,0 +1,212 @@ + +# chkconfig: - 80 75 +# description: PDNS is a versatile high performance authoritative nameserver + +### BEGIN INIT INFO +# Provides: pdns +# Required-Start: $remote_fs $network $syslog +# Required-Stop: $remote_fs $network $syslog +# Should-Start: +# Should-Stop: +# Default-Start: +# Default-Stop: 0 1 6 +# Short-Description: PowerDNS authoritative server +# Description: PowerDNS authoritative server +### END INIT INFO + +set -e + +prefix=/usr +exec_prefix=/usr +BINARYPATH=/usr/bin +SBINARYPATH=/usr/sbin +SOCKETPATH=/var/run + +[ -f "$SBINARYPATH/pdns_server" ] || exit 0 + +[ -r /etc/default/pdns ] && . /etc/default/pdns + +cd $SOCKETPATH +suffix=$(basename $0 | cut -d- -f2- -s) +if [ -n "$suffix" ] +then + EXTRAOPTS=--config-name=$suffix + PROGNAME=pdns-$suffix +else + PROGNAME=pdns +fi + +pdns_server="$SBINARYPATH/pdns_server $EXTRAOPTS" + +doPC() +{ + ret=$($BINARYPATH/pdns_control $EXTRAOPTS $1 $2 2> /dev/null) +} + +NOTRUNNING=0 +doPC ping || NOTRUNNING=$? + +case "$1" in + status) + if test "$NOTRUNNING" = "0" + then + doPC status + echo $ret + else + echo "not running" + exit 3 + fi + ;; + + stop) + echo -n "Stopping PowerDNS authoritative nameserver: " + if test "$NOTRUNNING" = "0" + then + doPC quit + rm -f /var/lock/subsys/pdns + echo $ret + else + echo "not running" + fi + ;; + + + force-stop) + echo -n "Stopping PowerDNS authoritative nameserver: " + killall -v -9 pdns_server + rm -f /var/lock/subsys/pdns + echo "killed" + ;; + + start) + echo -n "Starting PowerDNS authoritative nameserver: " + if test "$NOTRUNNING" = "0" + then + echo "already running" + else + if $pdns_server --daemon --guardian=yes + then + touch /var/lock/subsys/pdns + echo "started" + else + echo "starting failed" + exit 1 + fi + fi + ;; + + condrestart) + if [ -f /var/lock/subsys/pdns ]; + then + echo "running, restarting" + $0 restart + else + echo "not running" + fi + ;; + + force-reload | restart) + echo -n "Restarting PowerDNS authoritative nameserver: " + if test "$NOTRUNNING" = "1" + then + echo "not running, starting" + else + + echo -n stopping and waiting.. + doPC quit + sleep 3 + echo done + fi + $0 start + ;; + + reload) + echo -n "Reloading PowerDNS authoritative nameserver: " + if test "$NOTRUNNING" = "0" + then + doPC cycle + echo requested reload + else + echo not running yet + $0 start + fi + ;; + + monitor) + if test "$NOTRUNNING" = "0" + then + echo "already running" + else + $pdns_server --daemon=no --guardian=no --control-console --loglevel=9 + fi + ;; + + dump) + if test "$NOTRUNNING" = "0" + then + doPC list + echo $ret + else + echo "not running" + fi + ;; + + show) + if [ $# -lt 2 ] + then + echo Insufficient parameters + exit + fi + if test "$NOTRUNNING" = "0" + then + echo -n "$2=" + doPC show $2 ; echo $ret + else + echo "not running" + fi + ;; + + mrtg) + if [ $# -lt 2 ] + then + echo Insufficient parameters + exit + fi + if test "$NOTRUNNING" = "0" + then + doPC show $2 ; echo $ret + if [ "$3x" != "x" ] + then + doPC show $3 ; echo $ret + else + echo 0 + fi + doPC uptime ; echo $ret + echo PowerDNS daemon + else + echo "not running" + fi + + ;; + + cricket) + if [ $# -lt 2 ] + then + echo Insufficient parameters + exit + fi + if test "$NOTRUNNING" = "0" + then + doPC show $2 ; echo $ret + else + echo "not running" + fi + + ;; + + *) + echo pdns [start|stop|condrestart|force-reload|reload|restart|status|dump|show|mrtg|cricket|monitor] + + ;; +esac +