Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Mar 2014 05:06:58 GMT
From:      Zach Leslie <xaque208@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/187517: New Port: databases/puppetdb
Message-ID:  <201403130506.s2D56w60026032@cgiserv.freebsd.org>
Resent-Message-ID: <201403130510.s2D5A0qG049965@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         187517
>Category:       ports
>Synopsis:       New Port: databases/puppetdb
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 13 05:10:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Zach Leslie
>Release:        10.0-RELEASE
>Organization:
>Environment:
>Description:
PuppetDB is the backend database for Puppet.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: databases/Makefile
===================================================================
--- databases/Makefile	(revision 348025)
+++ databases/Makefile	(working copy)
@@ -698,6 +698,7 @@
     SUBDIR += proftpd-mod_sql_postgres
     SUBDIR += proftpd-mod_sql_sqlite
     SUBDIR += proftpd-mod_sql_tds
+    SUBDIR += puppetdb
     SUBDIR += pure-sql3
     SUBDIR += puredb
     SUBDIR += pxlib
Index: databases/puppetdb/Makefile
===================================================================
--- databases/puppetdb/Makefile	(revision 0)
+++ databases/puppetdb/Makefile	(working copy)
@@ -0,0 +1,67 @@
+# $FreeBSD$
+
+PORTNAME=		puppetdb
+PORTVERSION=		1.6.2
+CATEGORIES=		databases java
+MASTER_SITES=		http://downloads.puppetlabs.com/puppetdb/
+
+MAINTAINER=		xaque208@gmail.com
+COMMENT=		The PuppetDB storeconfigs backend
+
+RUN_DEPENDS=		bash>=0:${PORTSDIR}/shells/bash
+BUILD_DEPENDS=		rubygem-facter>=0:${PORTSDIR}/sysutils/rubygem-facter \
+			rubygem-rake>=0:${PORTSDIR}/devel/rubygem-rake
+
+USE_RC_SUBR=		puppetdb
+
+#LICENSE=		Apache-2.0
+
+USE_JAVA=		yes
+USE_RUBY=		yes
+USE_RAKE=		yes
+NO_BUILD=		yes
+JAVA_VERSION=		1.7+
+
+PUPPETDB_USER?=		puppet
+PUPPETDB_GROUP?=	puppet
+PUPPETDB_LOG_FILE?=	/var/log/puppetdb/puppetdb.log
+
+.if ${PUPPETDB_USER} == "puppet"
+USERS=	"puppet"
+.endif
+.if ${PUPPETDB_GROUP} == "puppet"
+GROUPS=	"puppet"
+.endif
+
+SUB_LIST+=		JAVA_HOME=${JAVA_HOME} \
+			PUPPETDB_USER=${PUPPETDB_USER} \
+			PUPPETDB_GROUP=${PUPPETDB_GROUP} \
+			PUPPETDB_LOG_FILE=${PUPPETDB_LOG_FILE}
+
+PLIST_SUB+=		PUPPETDB_USER=${PUPPETDB_USER} \
+			PUPPETDB_GROUP=${PUPPETDB_GROUP}
+
+.include <bsd.port.pre.mk>
+
+post-patch:
+.for file in ext/files/puppetdb ext/files/puppetdb-anonymize ext/files/puppetdb-export \
+	ext/files/puppetdb-foreground ext/files/puppetdb-import ext/files/puppetdb-legacy \
+	ext/files/puppetdb-ssl-setup ext/files/config.ini ext/files/database.ini Rakefile
+
+	@${REINPLACE_CMD} -e 's|/bin/bash|${PREFIX}/bin/bash|' \
+		-e 's|/usr/bin/java|${JAVA}|g' \
+		-e 's|su puppetdb|su ${PUPPETDB_USER}|' \
+		-e 's|user=puppetdb|user=${PUPPETDB_USER}|' \
+		-e 's|/usr/libexec/puppetdb|${PREFIX}/libexec/puppetdb|' \
+		-e 's|/usr/share/puppetdb|${DATADIR}|' \
+		-e 's|/etc/puppetdb|${ETCDIR}|' \
+		-e 's|/etc/puppetlabs/puppetdb|${PREFIX}/etc/puppetlabs/puppetdb|' \
+		-e 's|/var/lib/puppetdb|/var/puppetdb|' \
+		-e 's|/usr/sbin|${PREFIX}/sbin|' \
+		${WRKSRC}/${file}
+.endfor
+
+do-install:
+	@cd ${WRKSRC} && ${SETENV} DESTDIR=${STAGEDIR} rake install
+
+.include <bsd.port.post.mk>

Property changes on: databases/puppetdb/Makefile
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=%H
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: databases/puppetdb/distinfo
===================================================================
--- databases/puppetdb/distinfo	(revision 0)
+++ databases/puppetdb/distinfo	(working copy)
@@ -0,0 +1,2 @@
+SHA256 (puppetdb-1.6.2.tar.gz) = 884c62968877a8026edf0a60f4c82c311e2d7f2f3e9eb270d60a8dc2033ff540
+SIZE (puppetdb-1.6.2.tar.gz) = 21340797

Property changes on: databases/puppetdb/distinfo
___________________________________________________________________
Added: fbsd:nokeywords
## -0,0 +1 ##
+yes
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: databases/puppetdb/files/patch-Rakefile
===================================================================
--- databases/puppetdb/files/patch-Rakefile	(revision 0)
+++ databases/puppetdb/files/patch-Rakefile	(working copy)
@@ -0,0 +1,11 @@
+--- ./Rakefile.orig	2014-03-05 11:42:53.000000000 +0000
++++ ./Rakefile	2014-03-05 13:55:04.000000000 +0000
+@@ -95,6 +95,8 @@
+     @plibdir = @pe ? PE_SITELIBDIR : (%x(ruby -rrbconfig -e "puts RbConfig::CONFIG['sitelibdir']").chomp)
+   when /openbsd/
+     @plibdir = @pe ? PE_SITELIBDIR : '/usr/local/lib/ruby/site_ruby/1.9.1'
++  when /freebsd/
++    @plibdir = @pe ? PE_SITELIBDIR : Facter.value(:rubysitedir).chomp
+ end
+ 
+ @heap_dump_path = "#{@log_dir}/puppetdb-oom.hprof"

Property changes on: databases/puppetdb/files/patch-Rakefile
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: fbsd:nokeywords
## -0,0 +1 ##
+yes
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: databases/puppetdb/files/patch-ext__files__config.ini
===================================================================
--- databases/puppetdb/files/patch-ext__files__config.ini	(revision 0)
+++ databases/puppetdb/files/patch-ext__files__config.ini	(working copy)
@@ -0,0 +1,10 @@
+--- ./ext/files/config.ini.orig	2014-02-06 18:05:31.000000000 +0000
++++ ./ext/files/config.ini	2014-03-05 09:03:55.000000000 +0000
+@@ -17,3 +17,7 @@
+ 
+ # Maximum amount of disk space (in MB) to allow for ActiveMQ temporary message storage
+ # temp-usage = 51200
++
++[jetty]
++# Port to listen on for clear-text HTTP.
++port = 8080

Property changes on: databases/puppetdb/files/patch-ext__files__config.ini
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: fbsd:nokeywords
## -0,0 +1 ##
+yes
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: databases/puppetdb/files/patch-tasks__install.rake
===================================================================
--- databases/puppetdb/files/patch-tasks__install.rake	(revision 0)
+++ databases/puppetdb/files/patch-tasks__install.rake	(working copy)
@@ -0,0 +1,73 @@
+--- ./tasks/install.rake.orig	2014-02-06 18:04:53.000000000 +0000
++++ ./tasks/install.rake	2014-03-06 09:20:38.000000000 +0000
+@@ -16,22 +16,16 @@
+   mkdir_p "#{DESTDIR}/#{@config_dir}"
+   mkdir_p "#{DESTDIR}/#{@config_dir}/.."
+   mkdir_p "#{DESTDIR}/#{@log_dir}"
+-  mkdir_p "#{DESTDIR}/etc/init.d/"
+   mkdir_p "#{DESTDIR}/#{@lib_dir}"
+   mkdir_p "#{DESTDIR}/#{@libexec_dir}"
+   mkdir_p "#{DESTDIR}/#{@sbin_dir}"
+   mkdir_p "#{DESTDIR}/etc/logrotate.d/"
+-  ln_sf @config_dir, "#{DESTDIR}/#{@lib_dir}/config"
+-  ln_sf @log_dir, "#{DESTDIR}/#{@install_dir}/log"
+ 
+   unless @pe
+-    mkdir_p "#{DESTDIR}/var/lib/puppetdb/state"
+-    mkdir_p "#{DESTDIR}/var/lib/puppetdb/db"
+-    mkdir_p "#{DESTDIR}/var/lib/puppetdb/mq"
+-    ln_sf "#{@lib_dir}/state", "#{DESTDIR}#{@link}/state"
+-    ln_sf "#{@lib_dir}/db", "#{DESTDIR}#{@link}/db"
+-    ln_sf "#{@lib_dir}/mq", "#{DESTDIR}#{@link}/mq"
+-    mkdir_p "#{DESTDIR}/etc/puppetdb"
++    mkdir_p "#{DESTDIR}#{@lib_dir}/state"
++    mkdir_p "#{DESTDIR}#{@lib_dir}/db"
++    mkdir_p "#{DESTDIR}#{@lib_dir}/mq"
++    mkdir_p "#{DESTDIR}#{@etc_dir}"
+   else
+     mkdir_p "#{DESTDIR}#{@lib_dir}/state"
+     mkdir_p "#{DESTDIR}#{@lib_dir}/db"
+@@ -40,19 +34,15 @@
+   end
+ 
+   cp_p JAR_FILE, "#{DESTDIR}/#{@install_dir}"
+-  cp_pr "ext/files/config.ini", "#{DESTDIR}/#{@config_dir}"
+-  cp_pr "ext/files/database.ini", "#{DESTDIR}/#{@config_dir}"
+-  cp_pr "ext/files/jetty.ini", "#{DESTDIR}/#{@config_dir}"
+-  cp_pr "ext/files/repl.ini", "#{DESTDIR}/#{@config_dir}"
++  cp_pr "ext/files/config.ini", "#{DESTDIR}/#{@config_dir}/config.ini.sample"
++  cp_pr "ext/files/database.ini", "#{DESTDIR}/#{@config_dir}/database.ini.sample"
++  cp_pr "ext/files/jetty.ini", "#{DESTDIR}/#{@config_dir}/jetty.ini.sample"
++  cp_pr "ext/files/repl.ini", "#{DESTDIR}/#{@config_dir}/repl.ini.sample"
+   cp_pr "ext/files/puppetdb.logrotate", "#{DESTDIR}/etc/logrotate.d/#{@name}"
+   cp_pr "ext/files/log4j.properties", "#{DESTDIR}/#{@config_dir}/.."
+   cp_pr "ext/files/puppetdb", "#{DESTDIR}/#{@sbin_dir}"
+ 
+-  # Copy legacy wrapper for deprecated hyphenated sub-commands
+   legacy_cmds=%w|puppetdb-ssl-setup puppetdb-foreground puppetdb-import puppetdb-export puppetdb-anonymize|
+-  legacy_cmds.each do |file|
+-    cp_pr "ext/files/puppetdb-legacy", "#{DESTDIR}/#{@sbin_dir}/#{file}"
+-  end
+ 
+   # Copy internal sub-commands to libexec location
+   internal_cmds=legacy_cmds
+@@ -93,15 +83,14 @@
+     mkdir_p "#{DESTDIR}/etc/rc.d/"
+     cp_p "ext/files/puppetdb.openbsd.init", "#{DESTDIR}/etc/rc.d/#{@name}.rc"
+     chmod 0755, "#{DESTDIR}/etc/rc.d/#{@name}.rc"
++  elsif @osfamily == "freebsd"
++    #mkdir_p "#{DESTDIR}/usr/local/etc/rc.d/"
++    #cp_p "ext/files/puppetdb.openbsd.init", "#{DESTDIR}/etc/rc.d/#{@name}.rc"
++    #chmod 0755, "#{DESTDIR}/etc/rc.d/#{@name}.rc"
+   else
+     raise "Unknown or unsupported osfamily: #{@osfamily}"
+   end
+   chmod 0750, "#{DESTDIR}/#{@config_dir}"
+   chmod 0640, "#{DESTDIR}/#{@config_dir}/../log4j.properties"
+-  chmod 0700, "#{DESTDIR}/#{@sbin_dir}/puppetdb-ssl-setup"
+-  chmod 0700, "#{DESTDIR}/#{@sbin_dir}/puppetdb-foreground"
+-  chmod 0700, "#{DESTDIR}/#{@sbin_dir}/puppetdb-import"
+-  chmod 0700, "#{DESTDIR}/#{@sbin_dir}/puppetdb-export"
+-  chmod 0700, "#{DESTDIR}/#{@sbin_dir}/puppetdb-anonymize"
+   chmod 0700, "#{DESTDIR}/#{@sbin_dir}/puppetdb"
+ end

Property changes on: databases/puppetdb/files/patch-tasks__install.rake
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: fbsd:nokeywords
## -0,0 +1 ##
+yes
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: databases/puppetdb/files/puppetdb.in
===================================================================
--- databases/puppetdb/files/puppetdb.in	(revision 0)
+++ databases/puppetdb/files/puppetdb.in	(working copy)
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+# $FreeBSD: $
+#
+# PROVIDE: puppetdb
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+#
+# Configuration settings for puppetdb in /etc/rc.conf:
+#
+# puppetdb_enable (bool):
+#   Set to "NO" by default.
+#   Set it to "YES" to enable puppetdb
+#
+# puppetdb_args (str):
+#   Extra arguments passed to start command
+#
+# puppetdb_java_home (str):
+#   Set to "%%JAVA_HOME%%" by default.
+#   Set the Java virtual machine to run puppetdb
+#
+# puppetdb_java_opts (str):
+#   Set to "" by default.
+#   Java VM args to use.
+#
+# puppetdb_user (str):
+#   Set to "%%PUPPETDB_USER%%" by default.
+#   User to run puppetdb as.
+#
+# puppetdb_group (str):
+#   Set to "%%PUPPETDB_GROUP%%" by default.
+#   Group for data file ownership.
+#
+# puppetdb_log_file (str):
+#   Set to "%%PUPPETDB_LOG_FILE%%" by default.
+#   Log file location.
+#
+
+. /etc/rc.subr
+
+name="puppetdb"
+rcvar=puppetdb_enable
+
+load_rc_config "${name}"
+
+: ${puppetdb_enable="NO"}
+: ${puppetdb_args="services -c %%PREFIX%%/etc/puppetdb/conf.d"}
+: ${puppetdb_java_home="%%JAVA_HOME%%"}
+: ${puppetdb_user="%%PUPPETDB_USER%%"}
+: ${puppetdb_group="%%PUPPETDB_GROUP%%"}
+: ${puppetdb_log_file="%%PUPPETDB_LOG_FILE%%"}
+
+pidfile="/var/run/puppetdb/puppetdb.pid"
+command="/usr/sbin/daemon"
+java_cmd="${puppetdb_java_home}/bin/java"
+procname="${java_cmd}"
+command_args="-p ${pidfile} ${java_cmd} -jar %%DATADIR%%/puppetdb.jar ${puppetdb_args} > ${puppetdb_log_file} 2>&1"
+required_files="${java_cmd}"
+
+start_precmd="puppetdb_prestart"
+
+puppetdb_prestart() {
+  if [ ! -f "${puppetdb_log_file}" ]; then
+    touch "${puppetdb_log_file}"
+    chown "${puppetdb_user}:${puppetdb_group}" "${puppetdb_log_file}"
+    chmod 640 "${puppetdb_log_file}"
+  fi
+  if [ ! -d "/var/run/puppetdb" ]; then
+    install -d -o "${puppetdb_user}" -g "${puppetdb_group}" -m 750 "/var/run/puppetdb"
+  fi
+
+  chown -R "root:${puppetdb_group}" "%%PREFIX%%/etc/puppetdb/conf.d"
+  chmod 0750 "%%PREFIX%%/etc/puppetdb/conf.d"
+
+  chown "root:${puppetdb_group}" "%%PREFIX%%/etc/puppetdb/log4j.properties"
+  chmod 0640 "%%PREFIX%%/etc/puppetdb/log4j.properties"
+
+  chown -R "${puppetdb_user}:${puppetdb_group}" "/var/puppetdb"
+  chmod 0750 "/var/puppetdb"
+}
+
+run_rc_command "$1"

Property changes on: databases/puppetdb/files/puppetdb.in
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: databases/puppetdb/pkg-descr
===================================================================
--- databases/puppetdb/pkg-descr	(revision 0)
+++ databases/puppetdb/pkg-descr	(working copy)
@@ -0,0 +1,2 @@
+The PuppetDB storeconfigs backend
+WWW: https://docs.puppetlabs.com/puppetdb/latest/

Property changes on: databases/puppetdb/pkg-descr
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: fbsd:nokeywords
## -0,0 +1 ##
+yes
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: databases/puppetdb/pkg-message
===================================================================
--- databases/puppetdb/pkg-message	(revision 0)
+++ databases/puppetdb/pkg-message	(working copy)
@@ -0,0 +1,5 @@
+Please run the follow to setup your SSL/puppetdb server:
+
+/usr/local/sbin/puppetdb ssl-setup
+
+Also do not forget to add puppetdb_enable="YES" into your rc.conf

Property changes on: databases/puppetdb/pkg-message
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: fbsd:nokeywords
## -0,0 +1 ##
+yes
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: databases/puppetdb/pkg-plist
===================================================================
--- databases/puppetdb/pkg-plist	(revision 0)
+++ databases/puppetdb/pkg-plist	(working copy)
@@ -0,0 +1,58 @@
+/etc/logrotate.d/puppetdb
+libexec/puppetdb/puppetdb-anonymize
+libexec/puppetdb/puppetdb-export
+libexec/puppetdb/puppetdb-foreground
+libexec/puppetdb/puppetdb-import
+libexec/puppetdb/puppetdb-ssl-setup
+sbin/puppetdb
+%%DATADIR%%/puppetdb.jar
+
+@group %%PUPPETDB_GROUP%%
+@unexec if cmp -s %D/etc/puppetdb/conf.d/config.ini.sample %D/etc/puppetdb/conf.d/config.ini; then rm -f %D/etc/puppetdb/conf.d/config.ini; fi
+etc/puppetdb/conf.d/config.ini.sample
+@exec if [ ! -f %D/etc/puppetdb/conf.d/config.ini ] ; then cp -p %D/%F %B/config.ini; fi
+@unexec if cmp -s %D/etc/puppetdb/conf.d/database.ini.sample %D/etc/puppetdb/conf.d/database.ini; then rm -f %D/etc/puppetdb/conf.d/database.ini; fi
+etc/puppetdb/conf.d/database.ini.sample
+@exec if [ ! -f %D/etc/puppetdb/conf.d/database.ini ] ; then cp -p %D/%F %B/database.ini; fi
+@unexec if cmp -s %D/etc/puppetdb/conf.d/jetty.ini.sample %D/etc/puppetdb/conf.d/jetty.ini; then rm -f %D/etc/puppetdb/conf.d/jetty.ini; fi
+etc/puppetdb/conf.d/jetty.ini.sample
+@exec if [ ! -f %D/etc/puppetdb/conf.d/jetty.ini ] ; then cp -p %D/%F %B/jetty.ini; fi
+@unexec if cmp -s %D/etc/puppetdb/conf.d/repl.ini.sample %D/etc/puppetdb/conf.d/repl.ini; then rm -f %D/etc/puppetdb/conf.d/repl.ini; fi
+etc/puppetdb/conf.d/repl.ini.sample
+@exec if [ ! -f %D/etc/puppetdb/conf.d/repl.ini ] ; then cp -p %D/%F %B/repl.ini; fi
+etc/puppetdb/log4j.properties
+
+@owner %%PUPPETDB_USER%%
+@exec mkdir -p /var/log/puppetdb
+@dirrmtry /var/log/puppetdb
+
+@mode 0750
+@exec mkdir -p /var/puppetdb
+@mode
+
+@exec mkdir -p /var/puppetdb/state
+@dirrmtry /var/puppetdb/state
+@exec mkdir -p /var/puppetdb/db
+@dirrmtry /var/puppetdb/db
+@exec mkdir -p /var/puppetdb/mq
+@dirrmtry /var/puppetdb/mq
+@dirrmtry /var/puppetdb
+
+@owner
+@group
+
+@unexec rm -f %D/share/puppetdb/state
+@exec ln -s /var/puppetdb/state %D/share/puppetdb/state
+@unexec rm -f %D/share/puppetdb/mq
+@exec ln -s /var/puppetdb/mq %D/share/puppetdb/mq
+@unexec rm -f %D/share/puppetdb/db
+@exec ln -s /var/puppetdb/db %D/share/puppetdb/db
+@unexec rm -f %D/share/puppetdb/log
+@exec ln -s /var/log/puppetdb %D/share/puppetdb/log
+
+@dirrmtry etc/puppetdb/conf.d
+@dirrmtry etc/puppetdb
+@dirrm libexec/puppetdb
+
+@dirrm %%DATADIR%%
+@dirrmtry /etc/logrotate.d

Property changes on: databases/puppetdb/pkg-plist
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: fbsd:nokeywords
## -0,0 +1 ##
+yes
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403130506.s2D56w60026032>