Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Mar 2018 10:41:37 +0000 (UTC)
From:      Rodrigo Osorio <rodrigo@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r464062 - in head/net-mgmt/kapacitor: . files
Message-ID:  <201803101041.w2AAfbYM029112@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rodrigo
Date: Sat Mar 10 10:41:37 2018
New Revision: 464062
URL: https://svnweb.freebsd.org/changeset/ports/464062

Log:
  Update net-mgmt/kapacitor from 1.3.2 to 1.4.0
  
  Major changes :
      Load TICKscripts and alert handlers from a directory.
      Structed Logging with a logging API endpoints to be able to tail logs for given tasks.
      Autoscale support for Docker Swarm and EC2 Autoscaling.
      Sideload data into your TICKscript streams from external sources.
      Fully customizable POST body for the alert POST handler and the httpPost node.
  
  See the complete list of bug fixes and features at
  https://github.com/influxdata/kapacitor/blob/master/CHANGELOG.md
  
  PR:		224205
  Submitted by:	cheffo@freebsd-bg.org (maintainer)

Modified:
  head/net-mgmt/kapacitor/Makefile
  head/net-mgmt/kapacitor/distinfo
  head/net-mgmt/kapacitor/files/kapacitord.in
  head/net-mgmt/kapacitor/pkg-plist

Modified: head/net-mgmt/kapacitor/Makefile
==============================================================================
--- head/net-mgmt/kapacitor/Makefile	Sat Mar 10 10:34:03 2018	(r464061)
+++ head/net-mgmt/kapacitor/Makefile	Sat Mar 10 10:41:37 2018	(r464062)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	kapacitor
-PORTVERSION=	1.3.2
+PORTVERSION=	1.4.0
 DISTVERSIONPREFIX=	v
 CATEGORIES=	net-mgmt
 
@@ -25,27 +25,50 @@ GH_ACCOUNT=	influxdata:DEFAULT
 #GH_SUBDIR=	src/github.com/${GH_ACCOUNT_DEFAULT}/${PORTNAME}
 
 SUB_FILES=	kapacitord
-SUB_LIST+=	KAPACITORD_PIDDIR=${KAPACITORD_PIDDIR}
-PLIST_SUB=	KAPACITORD_PIDDIR=${KAPACITORD_PIDDIR}
+SUB_LIST+=	KAPACITORD_USER=${KAPACITORD_USER} \
+		KAPACITORD_GROUP=${KAPACITORD_GROUP} \
+		KAPACITORD_DBDIR=${KAPACITORD_DBDIR} \
+		KAPACITORD_LOGDIR=${KAPACITORD_LOGDIR}
+PLIST_SUB=	KAPACITORD_USER=${KAPACITORD_USER} \
+		KAPACITORD_GROUP=${KAPACITORD_GROUP} \
+		KAPACITORD_DBDIR=${KAPACITORD_DBDIR} \
+		KAPACITORD_LOGDIR=${KAPACITORD_LOGDIR}
 
+#Use influxd user as it's aleary present in ports system
+KAPACITORD_USER=	influxd
+KAPACITORD_GROUP=	influxd
+
+USERS=		${KAPACITORD_USER}
+GROUPS=		${KAPACITORD_GROUP}
+
+.include <bsd.port.pre.mk>
+
+.if ${OPSYS} == "FreeBSD" && ((${OSVERSION} >= 1100513 && ${OSVERSION} < 1200000) || \
+	${OSVERSION} >= 1200015)
+SUB_LIST+=	KAPACITORD_LOGCMD="daemon"
+.else
+SUB_LIST+=	KAPACITORD_LOGCMD="logger"
+.endif
+
+KAPACITORD_DBDIR=	/var/db/${PORTNAME}/
+KAPACITORD_LOGDIR=	/var/log/${PORTNAME}/
+
 post-patch:
 	@${MKDIR} ${WRKSRC}/src/github.com/${GH_ACCOUNT}/${PORTNAME}
 	@cd ${WRKSRC} && ${MV} \
-	BLOB_STORE_DESIGN.md CHANGELOG.md CONTRIBUTING.md DESIGN.md \
-	Gopkg.lock Gopkg.toml LICENSE_OF_DEPENDENCIES.md README.md \
-	alert alert.go auth batch.go bufpool build.py build.sh \
-	circle-test.sh circle.yml client clock cmd combine.go combine_test.go \
-	command default.go delete.go derivative.go doc.go edge.go \
-	edge_test.go etc eval.go examples expr.go expvar flatten.go \
-	gobuild.sh group_by.go http_out.go http_post.go influxdb \
-	influxdb_out.go influxql.gen.go influxql.gen.go.tmpl influxql.go \
-	integrations join.go k8s_autoscale.go kapacitor_loopback.go \
-	list-deps listmap log.go metaclient.go models node.go noop.go \
-	output.go pipeline query.go query_test.go replay.go result.go \
-	sample.go scripts server services shift.go state_tracking.go \
-	stats.go stream.go task.go task_master.go template.go test.sh \
-	tick tickdoc.conf timer tmpldata.json udf udf.go udf_test.go \
-	union.go update_tick_docs.sh usr uuid vars vendor where.go \
+	BLOB_STORE_DESIGN.md CHANGELOG.md CONTRIBUTING.md DESIGN.md Gopkg.lock \
+	Gopkg.toml LICENSE_OF_DEPENDENCIES.md README.md alert alert.go auth \
+	autoscale.go barrier.go batch.go bufpool build.py build.sh circle-test.sh \
+	circle.yml client clock cmd combine.go combine_test.go command default.go \
+	delete.go derivative.go doc.go edge edge.go etc eval.go examples expr.go \
+	expvar flatten.go gobuild.sh group_by.go http_out.go http_post.go influxdb \
+	influxdb_out.go influxql.gen.go influxql.gen.go.tmpl influxql.go integrations \
+	join.go kapacitor_loopback.go keyvalue list-deps listmap log.go metaclient.go \
+	models node.go noop.go output.go pipeline query.go query_test.go replay.go \
+	result.go sample.go scripts server services shift.go sideload.go \
+	state_tracking.go stats.go stream.go task.go task_master.go template.go \
+	test.sh tick tickdoc.conf timer tlsconfig tmpldata.json udf udf.go \
+	udf_test.go union.go update_tick_docs.sh usr uuid vendor waiter where.go \
 	window.go window_test.go \
 		${WRKSRC}/src/github.com/${GH_ACCOUNT}/${PORTNAME}
 
@@ -55,10 +78,15 @@ do-build:
 		&& ${SETENV} ${MAKE_ENV} GOPATH=${WRKSRC} go install -ldflags "-X main.version=${DISTVERSION}" ./cmd/${PORTNAME}d
 
 do-install:
+	${MKDIR} ${STAGEDIR}${KAPACITORD_DBDIR} \
+	${STAGEDIR}${KAPACITORD_LOGDIR}
 	${INSTALL_PROGRAM} ${WRKSRC}/bin/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
 	${INSTALL_PROGRAM} ${WRKSRC}/bin/${PORTNAME}d ${STAGEDIR}${PREFIX}/bin/${PORTNAME}d
+	@${SED} -i .bak -e \
+		"s|/var/lib/kapacitor|/var/db/kapacitor|g" \
+		${WRKSRC}/src/github.com/${GH_ACCOUNT}/${GH_PROJECT}/etc/${PORTNAME}/${PORTNAME}.conf
 	${INSTALL_DATA} \
 		${WRKSRC}/src/github.com/${GH_ACCOUNT}/${GH_PROJECT}/etc/${PORTNAME}/${PORTNAME}.conf  \
 		${STAGEDIR}${PREFIX}/etc/${PORTNAME}.conf.sample
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>

Modified: head/net-mgmt/kapacitor/distinfo
==============================================================================
--- head/net-mgmt/kapacitor/distinfo	Sat Mar 10 10:34:03 2018	(r464061)
+++ head/net-mgmt/kapacitor/distinfo	Sat Mar 10 10:41:37 2018	(r464062)
@@ -1,3 +1,3 @@
-TIMESTAMP = 1511467900
-SHA256 (influxdata-kapacitor-v1.3.2_GH0.tar.gz) = bdd53ab115c36905edbe1026ca8a14595c2ee2703380cd06366d1599c0db8806
-SIZE (influxdata-kapacitor-v1.3.2_GH0.tar.gz) = 7039627
+TIMESTAMP = 1520602174
+SHA256 (influxdata-kapacitor-v1.4.0_GH0.tar.gz) = 3c448eec9fb26581d9074a9fca4593d7aa7a19e4934cc392b5a345fad90edbeb
+SIZE (influxdata-kapacitor-v1.4.0_GH0.tar.gz) = 7542927

Modified: head/net-mgmt/kapacitor/files/kapacitord.in
==============================================================================
--- head/net-mgmt/kapacitor/files/kapacitord.in	Sat Mar 10 10:34:03 2018	(r464061)
+++ head/net-mgmt/kapacitor/files/kapacitord.in	Sat Mar 10 10:41:37 2018	(r464062)
@@ -9,11 +9,11 @@
 # Add the following lines to /etc/rc.conf to enable telegrafb:
 # kapacitord_enable="YES"
 #
-# kapacitord_enable (bool):       Set to YES to enable telegraf
+# kapacitord_enable (bool):       Set to YES to enable kapacitord
 #                               Default: NO
-# kapacitord_conf (str):          telegraf configuration file
-#                               Default: ${PREFIX}/etc/telegraf.conf
-# kapacitord_flags (str):         Extra flags passed to telegraf
+# kapacitord_conf (str):          kapacitord configuration file
+#                               Default: ${PREFIX}/etc/kapacitord.conf
+# kapacitord_flags (str):         Extra flags passed to kapacitord
 
 . /etc/rc.subr
 
@@ -22,14 +22,34 @@ rcvar=kapacitord_enable
 load_rc_config $name
 
 : ${kapacitord_enable:="NO"}
+: ${kapacitord_user:="%%KAPACITORD_USER%%"}
+: ${kapacitord_group:="%%KAPACITORD_GROUP%%"}
+: ${kapacitord_facility:="daemon"}
+: ${kapacitord_priority:="info"}
 : ${kapacitord_flags:=""}
 : ${kapacitord_conf:="%%PREFIX%%/etc/kapacitor.conf"}
+: ${kapacitord_options:="${kapacitord_flags} -config=${kapacitord_conf}"}
 
 # daemon
 start_precmd=kapacitord_prestart
-pidfile="/var/run/${name}.pid"
+kapacitord_pidfile="/var/run/${name}.pid"
+procname="%%PREFIX%%/bin/${name}"
 command=/usr/sbin/daemon
-command_args="-f -crP ${pidfile} %%PREFIX%%/bin/${name} ${kapacitord_flags} -config=${kapacitord_conf} >> /var/log/kapacitord.log 2>&1"
++start_cmd="kapacitord_startcmd_%%KAPACITORD_LOGCMD%%"
+
+kapacitord_startcmd_daemon()
+{
+	echo "Starting ${name}."
+	/usr/sbin/daemon -c -p ${kapacitord_pidfile} -S -s ${kapacitord_priority} -l ${kapacitord_facility} \
+		-u ${kapacitord_user} ${procname} ${kapacitord_options}
+}
+
+kapacitord_startcmd_logger()
+{
+	echo "Starting ${name}."
+	/usr/sbin/daemon -c -p ${kapacitord_pidfile} -u ${kapacitord_user} /bin/sh -c "${procname} ${kapacitord_options} 2>&1 \
+		| /usr/bin/logger -t ${name} -p ${kapacitord_facility}.${kapacitord_priority}"
+}
 
 kapacitord_prestart() {
 # Have to empty rc_flags so they don't get passed to daemon(8)

Modified: head/net-mgmt/kapacitor/pkg-plist
==============================================================================
--- head/net-mgmt/kapacitor/pkg-plist	Sat Mar 10 10:34:03 2018	(r464061)
+++ head/net-mgmt/kapacitor/pkg-plist	Sat Mar 10 10:41:37 2018	(r464062)
@@ -1,3 +1,5 @@
 bin/kapacitor
 bin/kapacitord
+@dir(%%KAPACITORD_USER%%,%%KAPACITORD_GROUP%%,0750) %%KAPACITORD_DBDIR%%
+@dir(%%KAPACITORD_USER%%,%%KAPACITORD_GROUP%%,0750) %%KAPACITORD_LOGDIR%%
 @sample etc/kapacitor.conf.sample



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