New port: sysutils/puppetserver

Puppet master is a Ruby application that compiles configurations
for any number of Puppet agent nodes, using Puppet code and various
other data sources. (For more info, see Overview of Puppet's
Architecture.)

Puppet Server is an application that runs on the Java Virtual Machine
(JVM) and provides the same services as the classic Puppet master
application. It mostly does this by running the existing Puppet
master code in several JRuby interpreters, but it replaces some
parts of the classic application with new services written in
Clojure.

WWW: https://docs.puppetlabs.com/puppetserver/latest/services_master_puppetserver.html

PR:		204072
Submitted by:	Zach Leslie <freebsd@zleslie.info>
This commit is contained in:
Kurt Jaeger 2016-03-12 14:30:00 +00:00
parent 5bb40b5b56
commit 597f83d16e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=410891
12 changed files with 276 additions and 0 deletions

View File

@ -774,6 +774,7 @@
SUBDIR += puppet37
SUBDIR += puppet38
SUBDIR += puppet4
SUBDIR += puppetserver
SUBDIR += pv
SUBDIR += pwd_unmkdb
SUBDIR += pwgen

View File

@ -0,0 +1,76 @@
# $FreeBSD$
PORTNAME= puppetserver
PORTVERSION= 2.2.1
CATEGORIES= sysutils java
MASTER_SITES= http://downloads.puppetlabs.com/puppet/
MAINTAINER= xaque208@gmail.com
COMMENT= Puppet Server running in the JVM
LICENSE= APACHE20
RUN_DEPENDS= bash>=0:${PORTSDIR}/shells/bash \
puppet4>=0:${PORTSDIR}/sysutils/puppet4
BUILD_DEPENDS= rubygem-rake>=0:${PORTSDIR}/devel/rubygem-rake
USE_RC_SUBR= puppetserver
USE_JAVA= yes
USE_RUBY= yes
NO_BUILD= yes
JAVA_VERSION= 1.7+
USERS= puppet
GROUPS= puppet
SUB_LIST= JAVA_HOME=${JAVA_HOME}
SUB_FILES= pkg-message
PKGMESSAGE= ${WRKDIR}/pkg-message
OPTIONS_DEFAULT= RFACTER
OPTIONS_RADIO= FACTER
OPTIONS_RADIO_FACTER= CFACTER RFACTER
RFACTER_DESC= Use facter 2.x (written in Ruby)
CFACTER_DESC= Use facter 3.x (experimental rewrite in C++)
RFACTER_BUILD_DEPENDS= rubygem-facter>=2.0:${PORTSDIR}/sysutils/rubygem-facter
RFACTER_RUN_DEPENDS= rubygem-facter>=2.0:${PORTSDIR}/sysutils/rubygem-facter
CFACTER_BUILD_DEPENDS= facter>=3.0:${PORTSDIR}/sysutils/facter
CFACTER_RUN_DEPENDS= facter>=3.0:${PORTSDIR}/sysutils/facter
.include <bsd.port.options.mk>
.include <bsd.port.pre.mk>
post-patch:
.for file in ext/config/bootstrap.cfg ext/config/logback.xml \
ext/config/request-logging.xml \
ext/config/conf.d/global.conf ext/config/conf.d/puppetserver.conf \
ext/config/conf.d/web-routes.conf ext/config/conf.d/webserver.conf \
ext/config/conf.d/auth.conf
@${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|" ${WRKSRC}/${file}
@${REINPLACE_CMD} -e "s|%%RUBY_SITELIBDIR%%|${RUBY_SITELIBDIR}|" ${WRKSRC}/${file}
@${REINPLACE_CMD} -e "s|%%RUBY_VER%%|${RUBY_VER}|" ${WRKSRC}/${file}
.endfor
do-install:
${MKDIR} ${STAGEDIR}${DATADIR}
${MKDIR} ${STAGEDIR}${ETCDIR}
${MKDIR} ${STAGEDIR}${ETCDIR}/conf.d
${MKDIR} ${STAGEDIR}${PREFIX}/etc/puppet/code
${MKDIR} ${STAGEDIR}/var/log/puppetserver
${INSTALL_DATA} ${WRKSRC}/puppet-server-release.jar ${STAGEDIR}${DATADIR}/puppetserver.jar
${INSTALL_DATA} ${WRKSRC}/ext/config/conf.d/global.conf ${STAGEDIR}${ETCDIR}/conf.d/global.conf
${INSTALL_DATA} ${WRKSRC}/ext/config/logback.xml ${STAGEDIR}${ETCDIR}/logback.xml
${INSTALL_DATA} ${WRKSRC}/ext/config/bootstrap.cfg ${STAGEDIR}${ETCDIR}/bootstrap.cfg
${INSTALL_DATA} ${WRKSRC}/ext/config/request-logging.xml ${STAGEDIR}${ETCDIR}/request-logging.xml
${INSTALL_DATA} ${WRKSRC}/ext/config/conf.d/puppetserver.conf ${STAGEDIR}${ETCDIR}/conf.d/puppetserver.conf
${INSTALL_DATA} ${WRKSRC}/ext/config/conf.d/web-routes.conf ${STAGEDIR}${ETCDIR}/conf.d/web-routes.conf
${INSTALL_DATA} ${WRKSRC}/ext/config/conf.d/webserver.conf ${STAGEDIR}${ETCDIR}/conf.d/webserver.conf
${INSTALL_DATA} ${WRKSRC}/ext/config/conf.d/auth.conf ${STAGEDIR}${ETCDIR}/conf.d/auth.conf
.include <bsd.port.post.mk>

View File

@ -0,0 +1,2 @@
SHA256 (puppetserver-2.2.1.tar.gz) = 583662380b161fc35e0f0c5e7e2964892ec4b7e0cb848cadcd76b29684a85843
SIZE (puppetserver-2.2.1.tar.gz) = 42665674

View File

@ -0,0 +1,9 @@
--- ext/config/conf.d/global.conf.orig 2015-10-27 16:22:06 UTC
+++ ext/config/conf.d/global.conf
@@ -1,5 +1,5 @@
global: {
# Path to logback logging configuration file; for more
# info, see http://logback.qos.ch/manual/configuration.html
- logging-config: /etc/puppetlabs/puppetserver/logback.xml
+ logging-config: %%PREFIX%%/etc/puppetserver/logback.xml
}

View File

@ -0,0 +1,48 @@
--- ext/config/conf.d/puppetserver.conf.orig 2015-10-27 17:03:52 UTC
+++ ext/config/conf.d/puppetserver.conf
@@ -2,11 +2,14 @@
jruby-puppet: {
# Where the puppet-agent dependency places puppet, facter, etc...
# Puppet server expects to load Puppet from this location
- ruby-load-path: [/opt/puppetlabs/puppet/lib/ruby/vendor_ruby]
+ ruby-load-path: [
+ %%RUBY_SITELIBDIR%%,
+ %%PREFIX%%/lib/ruby/gems/%%RUBY_VER%%/gems/facter-2.4.4/lib/,
+ ]
# This setting determines where JRuby will look for gems. It is also
# used by the `puppetserver gem` command line tool.
- gem-home: /opt/puppetlabs/server/data/puppetserver/jruby-gems
+ gem-home: /var/puppet/server/data/puppetserver/jruby-gems
# PLEASE NOTE: Use caution when modifying the below settings. Modifying
@@ -22,23 +25,23 @@
# (optional) path to puppet conf dir; if not specified, will use
# /etc/puppetlabs/puppet
- master-conf-dir: /etc/puppetlabs/puppet
+ master-conf-dir: %%PREFIX%%/etc/puppet
# (optional) path to puppet code dir; if not specified, will use
# /etc/puppetlabs/code
- master-code-dir: /etc/puppetlabs/code
+ master-code-dir: %%PREFIX%%/etc/puppet/code
# (optional) path to puppet var dir; if not specified, will use
# /opt/puppetlabs/server/data/puppetserver
- master-var-dir: /opt/puppetlabs/server/data/puppetserver
+ master-var-dir: /var/puppet/server/data/puppetserver
# (optional) path to puppet run dir; if not specified, will use
# /var/run/puppetlabs/puppetserver
- master-run-dir: /var/run/puppetlabs/puppetserver
+ master-run-dir: /var/run/puppetserver
# (optional) path to puppet log dir; if not specified, will use
# /var/log/puppetlabs/puppetserver
- master-log-dir: /var/log/puppetlabs/puppetserver
+ master-log-dir: /var/log/puppetserver
# (optional) maximum number of JRuby instances to allow
#max-active-instances: 1

View File

@ -0,0 +1,9 @@
--- ext/config/conf.d/webserver.conf.orig 2015-10-27 16:26:17 UTC
+++ ext/config/conf.d/webserver.conf
@@ -1,5 +1,5 @@
webserver: {
- access-log-config = /etc/puppetlabs/puppetserver/request-logging.xml
+ access-log-config = %%PREFIX%%/etc/puppetserver/request-logging.xml
client-auth = want
ssl-host = 0.0.0.0
ssl-port = 8140

View File

@ -0,0 +1,11 @@
--- ext/config/logback.xml.orig 2015-10-27 16:40:33 UTC
+++ ext/config/logback.xml
@@ -7,7 +7,7 @@
<appender name="F1" class="ch.qos.logback.core.FileAppender">
<!-- TODO: this path should not be hard-coded -->
- <file>/var/log/puppetlabs/puppetserver/puppetserver.log</file>
+ <file>/var/log/puppetserver/puppetserver.log</file>
<append>true</append>
<encoder>
<pattern>%d %-5p [%c{2}] %m%n</pattern>

View File

@ -0,0 +1,10 @@
--- ext/config/request-logging.xml.orig 2015-10-27 16:40:09 UTC
+++ ext/config/request-logging.xml
@@ -1,6 +1,6 @@
<configuration debug="false" scan="true">
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <file>/var/log/puppetlabs/puppetserver/puppetserver-access.log</file>
+ <file>/var/log/puppetserver/puppetserver-access.log</file>
<encoder>
<pattern>%h %l %u %user %date "%r" %s %b %h %a %localPort %D</pattern>
</encoder>

View File

@ -0,0 +1 @@
Remember to add puppetserver_enable="YES" to rc.conf.

View File

@ -0,0 +1,82 @@
#!/bin/sh
# $FreeBSD$
#
# PROVIDE: puppetserver
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Configuration settings for puppetserver in /etc/rc.conf:
#
# puppetserver_enable (bool):
# Set to "NO" by default.
# Set it to "YES" to enable puppetserver
#
# puppetserver_args (str):
# Extra arguments passed to start command
#
# puppetserver_java_home (str):
# Set to "%%JAVA_HOME%%" by default.
# Set the Java virtual machine to run puppetserver
#
# puppetserver_java_opts (str):
# Set to "" by default.
# Java VM args to use.
#
# puppetserver_user (str):
# Set to "puppet" by default.
# User to run puppetserver as.
#
# puppetserver_group (str):
# Set to "puppet" by default.
# Group for data file ownership.
#
# puppetserver_log_file (str):
# Set to "/var/log/puppetserver/puppetserver.log" by default.
# Log file location.
#
. /etc/rc.subr
name="puppetserver"
rcvar=puppetserver_enable
load_rc_config "${name}"
: ${puppetserver_enable="NO"}
: ${puppetserver_args="--config %%PREFIX%%/etc/puppetserver/conf.d -b %%PREFIX%%/etc/puppetserver/bootstrap.cfg"}
: ${puppetserver_java_home="%%JAVA_HOME%%"}
: ${puppetserver_user="puppet"}
: ${puppetserver_group="puppet"}
: ${puppetserver_log_file="/var/log/puppetserver/puppetserver.log"}
pidfile="/var/run/puppetserver/puppetserver.pid"
command="/usr/sbin/daemon"
java_cmd="${puppetserver_java_home}/bin/java"
procname="${java_cmd}"
command_args="-p ${pidfile} ${java_cmd} -cp %%DATADIR%%/puppetserver.jar clojure.main -m puppetlabs.trapperkeeper.main ${puppetserver_args} > ${puppetserver_log_file} 2>&1"
required_files="${java_cmd}"
start_precmd="puppetserver_prestart"
puppetserver_prestart() {
if [ ! -f "${puppetserver_log_file}" ]; then
touch "${puppetserver_log_file}"
chown "${puppetserver_user}:${puppetserver_group}" "${puppetserver_log_file}"
chmod 640 "${puppetserver_log_file}"
fi
if [ ! -d "/var/run/puppetserver" ]; then
install -d -o "${puppetserver_user}" -g "${puppetserver_group}" -m 750 "/var/run/puppetserver"
fi
chown -R "root:${puppetserver_group}" "%%PREFIX%%/etc/puppetserver/conf.d"
chmod 0750 "%%PREFIX%%/etc/puppetserver/conf.d"
chown "root:${puppetserver_group}" "%%PREFIX%%/etc/puppetserver/logback.xml"
chmod 0640 "%%PREFIX%%/etc/puppetserver/logback.xml"
}
run_rc_command "$1"

View File

@ -0,0 +1,13 @@
Puppet master is a Ruby application that compiles configurations
for any number of Puppet agent nodes, using Puppet code and various
other data sources. (For more info, see Overview of Puppet's
Architecture.)
Puppet Server is an application that runs on the Java Virtual Machine
(JVM) and provides the same services as the classic Puppet master
application. It mostly does this by running the existing Puppet
master code in several JRuby interpreters, but it replaces some
parts of the classic application with new services written in
Clojure.
WWW: https://docs.puppetlabs.com/puppetserver/latest/services_master_puppetserver.html

View File

@ -0,0 +1,14 @@
%%ETCDIR%%/logback.xml
%%ETCDIR%%/bootstrap.cfg
%%ETCDIR%%/request-logging.xml
%%ETCDIR%%/conf.d/global.conf
%%ETCDIR%%/conf.d/puppetserver.conf
%%ETCDIR%%/conf.d/web-routes.conf
%%ETCDIR%%/conf.d/webserver.conf
%%ETCDIR%%/conf.d/auth.conf
%%DATADIR%%/puppetserver.jar
@mode 0750
@group puppet
@dir etc/puppet/code
@owner puppet
@dir /var/log/puppetserver