Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Mar 2018 22:34:09 +0000 (UTC)
From:      Brad Davis <brd@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r466011 - in head/net-mgmt/prometheus2: . files
Message-ID:  <201803302234.w2UMY9Og003966@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brd
Date: Fri Mar 30 22:34:09 2018
New Revision: 466011
URL: https://svnweb.freebsd.org/changeset/ports/466011

Log:
  Readd prometheus2 with corrected history.
  
  PR:		225169

Added:
  head/net-mgmt/prometheus2/
     - copied from r466007, head/net-mgmt/prometheus1/
Modified:
  head/net-mgmt/prometheus2/Makefile
  head/net-mgmt/prometheus2/distinfo
  head/net-mgmt/prometheus2/files/prometheus.in
  head/net-mgmt/prometheus2/pkg-descr

Modified: head/net-mgmt/prometheus2/Makefile
==============================================================================
--- head/net-mgmt/prometheus1/Makefile	Fri Mar 30 21:36:22 2018	(r466007)
+++ head/net-mgmt/prometheus2/Makefile	Fri Mar 30 22:34:09 2018	(r466011)
@@ -1,14 +1,11 @@
-# Created by: Jev Björsell <ports@ecadlabs.com>
 # $FreeBSD$
 
 PORTNAME=	prometheus
-PORTVERSION=	1.8.2
+PORTVERSION=	2.1.0
 DISTVERSIONPREFIX=	v
-PORTREVISION=	1
 CATEGORIES=	net-mgmt
-PKGNAMESUFFIX=	1
 
-MAINTAINER=	ports@ecadlabs.com
+MAINTAINER=	dor.bsd@xm0.uk
 COMMENT=	Systems monitoring and alerting toolkit
 
 LICENSE=	APACHE20
@@ -16,8 +13,10 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 
 USES=		go gmake
 USE_GITHUB=	yes
+GH_ACCOUNT=	prometheus
+GH_PROJECT=	prometheus
 
-GO_PKGNAME=	github.com/${PORTNAME}/${PORTNAME}
+GO_PKGNAME=	github.com/${GH_ACCOUNT}/${GH_PROJECT}
 
 USE_RC_SUBR=	prometheus
 
@@ -25,24 +24,29 @@ USERS=		prometheus
 GROUPS=		prometheus
 
 BUILD_USER?=	${USER}
-LD_FLAG_X_PREFIX=	-X ${GO_PKGNAME}/vendor/github.com/prometheus/common/version
+LD_FLAG_X_PREFIX=	-X ${GO_PKGNAME}/vendor/${GO_PKGNAME:H}/common/version
 LD_FLAG_STRING=	-s \
 				${LD_FLAG_X_PREFIX}.Version=${PORTVERSION} \
 				${LD_FLAG_X_PREFIX}.Revision=${PORTREVISION} \
 				${LD_FLAG_X_PREFIX}.Branch=release-${PORTVERSION:R} \
 				${LD_FLAG_X_PREFIX}.BuildUser=${BUILD_USER}
 
+PROMETHEUS_BINARIES=	prometheus promtool
+
 do-build:
-	( cd ${GO_WRKSRC}/cmd/prometheus ; \
+.for bin in ${PROMETHEUS_BINARIES}
+	( cd ${GO_WRKSRC}/cmd/${bin} ; \
 		${SETENV} ${MAKE_ENV} ${GO_ENV} go install -ldflags "${LD_FLAG_STRING}" )
+.endfor
 
-	( cd ${GO_WRKSRC}/cmd/promtool ; \
-		${SETENV} ${MAKE_ENV} ${GO_ENV} go install -ldflags "${LD_FLAG_STRING}" )
-
 do-install:
-	${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/prometheus ${STAGEDIR}${PREFIX}/bin
-	${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/promtool ${STAGEDIR}${PREFIX}/bin
-	${INSTALL_DATA} ${WRKSRC}/documentation/examples/prometheus.yml ${STAGEDIR}${LOCALBASE}/etc/prometheus.yml.sample
+.for bin in ${PROMETHEUS_BINARIES}
+	${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/${bin} ${STAGEDIR}${PREFIX}/bin
+.endfor
+
+	${INSTALL_DATA} \
+		${WRKSRC}/documentation/examples/prometheus.yml \
+		${STAGEDIR}${LOCALBASE}/etc/prometheus.yml.sample
 
 	${MKDIR} ${STAGEDIR}${DESTDIR}/var/db/prometheus
 

Modified: head/net-mgmt/prometheus2/distinfo
==============================================================================
--- head/net-mgmt/prometheus1/distinfo	Fri Mar 30 21:36:22 2018	(r466007)
+++ head/net-mgmt/prometheus2/distinfo	Fri Mar 30 22:34:09 2018	(r466011)
@@ -1,3 +1,3 @@
-TIMESTAMP = 1510001444
-SHA256 (prometheus-prometheus-v1.8.2_GH0.tar.gz) = 7c8a9c9756790d1c4eb436bb6ebda49e2f671a6319c06a1c63d5df9eff7da0e2
-SIZE (prometheus-prometheus-v1.8.2_GH0.tar.gz) = 5238057
+TIMESTAMP = 1516749966
+SHA256 (prometheus-prometheus-v2.1.0_GH0.tar.gz) = c6fc92d695c9af30574eb41af5e0e89f4fde9a04a3169ba58aa2b2f80d5862a4
+SIZE (prometheus-prometheus-v2.1.0_GH0.tar.gz) = 5669858

Modified: head/net-mgmt/prometheus2/files/prometheus.in
==============================================================================
--- head/net-mgmt/prometheus1/files/prometheus.in	Fri Mar 30 21:36:22 2018	(r466007)
+++ head/net-mgmt/prometheus2/files/prometheus.in	Fri Mar 30 22:34:09 2018	(r466011)
@@ -35,29 +35,64 @@ load_rc_config $name
 : ${prometheus_log_file:="/var/log/prometheus.log"}
 : ${prometheus_args:=""}
 
-pidfile=/var/run/prometheus.pid
+pidfile="/var/run/${name}.pid"
 required_files="${prometheus_config}"
 command="/usr/sbin/daemon"
-procname="%%PREFIX%%/bin/prometheus"
-sig_reload=HUP
+procname="%%PREFIX%%/bin/${name}"
+sig_reload="HUP"
 extra_commands="reload"
 command_args="-p ${pidfile} /usr/bin/env ${procname} \
-                -config.file=${prometheus_config} \
-                -storage.local.path=${prometheus_data_dir} \
+                --config.file=${prometheus_config} \
+                --storage.tsdb.path=${prometheus_data_dir} \
                 ${prometheus_args} >> ${prometheus_log_file} 2>&1"
 
 start_precmd=prometheus_startprecmd
 
+# This checks for the existence of a prometheus 1.x data dir at the
+# $prometheus_data_dir location. If one is found, Prometheus will not start.
+prometheus_check_data_dir_version()
+{
+    local data_dir_version_file="${prometheus_data_dir}/VERSION"
+
+    if [ -f "${data_dir_version_file}" ]; then
+        local data_dir_version="0"
+
+        read data_dir_version < "${data_dir_version_file}"
+
+        if [ "${data_dir_version}" = "1" ]; then
+            return 1
+        fi
+    fi
+}
+
 prometheus_startprecmd()
 {
     if [ ! -e ${pidfile} ]; then
-        install -o ${prometheus_user} -g ${prometheus_group} /dev/null ${pidfile};
+        install \
+            -o ${prometheus_user} \
+            -g ${prometheus_group} \
+            /dev/null ${pidfile};
     fi
     if [ ! -f "${prometheus_log_file}" ]; then
-        install -o ${prometheus_user} -g ${prometheus_group} -m 640 /dev/null ${prometheus_log_file};
+        install \
+            -o ${prometheus_user} \
+            -g ${prometheus_group} \
+            -m 640 \
+            /dev/null ${prometheus_log_file};
     fi
     if [ ! -d ${prometheus_data_dir} ]; then
-        install -d -o ${prometheus_user} -g ${prometheus_group} -m 750 ${prometheus_data_dir}
+        install \
+            -d \
+            -o ${prometheus_user} \
+            -g ${prometheus_group} \
+            -m 750 \
+            ${prometheus_data_dir}
+    else
+        # The directory already existed. Ensure it's not a prometheus 1.x
+        # data dir.
+        if ! prometheus_check_data_dir_version; then
+            err 1 "Found net-mgmt/prometheus1 data dir, refusing to start."
+        fi
     fi
 }
 

Modified: head/net-mgmt/prometheus2/pkg-descr
==============================================================================
--- head/net-mgmt/prometheus1/pkg-descr	Fri Mar 30 21:36:22 2018	(r466007)
+++ head/net-mgmt/prometheus2/pkg-descr	Fri Mar 30 22:34:09 2018	(r466011)
@@ -7,8 +7,8 @@ Prometheus' main distinguishing features as compared t
 systems are:
 
 - a multi-dimensional data model (timeseries defined by metric name and
-  set of key/value dimensions) 
-- a flexible query language to leverage this dimensionality 
+  set of key/value dimensions)
+- a flexible query language to leverage this dimensionality
 - no dependency on distributed storage; single server nodes are autonomous
 - timeseries collection happens via a pull model over HTTP
 - pushing timeseries is supported via an intermediary gateway



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