]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
builder: auth centos targets
authorPieter Lexis <pieter.lexis@powerdns.com>
Thu, 14 Dec 2017 13:54:02 +0000 (14:54 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Thu, 27 Sep 2018 11:59:25 +0000 (13:59 +0200)
Makefile.am
builder-support/dockerfiles/Dockerfile.authoritative
builder-support/dockerfiles/Dockerfile.rpmbuild [new file with mode: 0644]
builder-support/dockerfiles/Dockerfile.target.centos-6 [new file with mode: 0644]
builder-support/dockerfiles/Dockerfile.target.centos-7 [new file with mode: 0644]
builder-support/dockerfiles/Dockerfile.target.sdist
builder-support/specs/pdns.init [new file with mode: 0644]

index 49e1cea72f3119c0fe6bb7ae3e9efd63505dad6c..9a2942c458a5331ef02c652f8943818afd1ccae9 100644 (file)
@@ -4,6 +4,7 @@ EXTRA_DIST = \
        INSTALL \
        NOTICE \
        README \
+       COPYING \
        codedocs/doxygen.conf \
        contrib/powerdns.solaris.init.d \
        pdns/named.conf.parsertest \
index aaade0b616aee583bd393b54dc4a2f13e25fffaf..13de945a25c4a0ca74675e275a74386ea44404bf 100644 (file)
@@ -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 (file)
index 0000000..677c2b2
--- /dev/null
@@ -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 (file)
index 0000000..0d53ed4
--- /dev/null
@@ -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 (file)
index 0000000..cbf48a4
--- /dev/null
@@ -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
index bd98dd40352311c75fb09534b5bffbb31827b95b..5c1c160e2d2fc3034231467b8d363ed70b3cfa0b 100644 (file)
@@ -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 (file)
index 0000000..c544f9a
--- /dev/null
@@ -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
+