View | Details | Raw Unified | Return to bug 228185 | Differences between
and this patch

Collapse All | Expand All

(-)b/net-mgmt/prometheus2/Makefile (-6 / +60 lines)
Lines 2-8 Link Here
2
2
3
PORTNAME=	prometheus
3
PORTNAME=	prometheus
4
DISTVERSIONPREFIX=	v
4
DISTVERSIONPREFIX=	v
5
DISTVERSION=	2.2.1
5
DISTVERSION=	2.3.1
6
CATEGORIES=	net-mgmt
6
CATEGORIES=	net-mgmt
7
7
8
MAINTAINER=	dor.bsd@xm0.uk
8
MAINTAINER=	dor.bsd@xm0.uk
Lines 16-23 GO_PKGNAME= github.com/${GH_ACCOUNT}/${GH_PROJECT} Link Here
16
USE_GITHUB=	yes
16
USE_GITHUB=	yes
17
USE_RC_SUBR=	prometheus
17
USE_RC_SUBR=	prometheus
18
18
19
USERS=		prometheus
19
OPTIONS_DEFINE=		EXAMPLES
20
GROUPS=		prometheus
20
OPTIONS_DEFAULT=	EXAMPLES
21
EXAMPLES_DESC=		Install example configuration files for syslog and newsyslog
22
23
PROMETHEUS_USER?=	prometheus
24
PROMETHEUS_GROUP?=	prometheus
25
26
USERS=		${PROMETHEUS_USER}
27
GROUPS=		${PROMETHEUS_GROUP}
28
29
PROMETHEUS_BINARIES=				prometheus promtool
30
PROMETHEUS_SHARE_DIR=				${DATADIR}
31
PROMETHEUS_CONSOLES_DIR=			${PROMETHEUS_SHARE_DIR}/consoles
32
PROMETHEUS_CONSOLE_LIBRARIES_DIR=	${PROMETHEUS_SHARE_DIR}/console_libraries
33
PROMETHEUS_DB_DIR=					/var/db/${PORTNAME}
34
PROMETHEUS_LOG_DIR=					/var/log/prometheus
35
PROMETHEUS_LOG_FILE=				${PROMETHEUS_LOG_DIR}/prometheus.log
36
37
SUB_FILES=	prometheus \
38
			newsyslog.conf \
39
			syslog.d.conf
40
41
SUB_LIST+=	PROMETHEUS_USER=${PROMETHEUS_USER} \
42
			PROMETHEUS_GROUP=${PROMETHEUS_GROUP} \
43
			PROMETHEUS_CONSOLE_LIBRARIES_DIR=${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
44
			PROMETHEUS_CONSOLES_DIR=${PROMETHEUS_CONSOLES_DIR} \
45
			PROMETHEUS_DB_DIR=${PROMETHEUS_DB_DIR} \
46
			PROMETHEUS_LOG_DIR=${PROMETHEUS_LOG_DIR} \
47
			PROMETHEUS_LOG_FILE=${PROMETHEUS_LOG_FILE} \
48
			PROMETHEUS_SHARE_DIR=${PROMETHEUS_SHARE_DIR}
49
50
PLIST_SUB+=	PROMETHEUS_CONSOLE_LIBRARIES_DIR=${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
51
			PROMETHEUS_CONSOLES_DIR=${PROMETHEUS_CONSOLES_DIR} \
52
			PROMETHEUS_DB_DIR=${PROMETHEUS_DB_DIR} \
53
			PROMETHEUS_LOG_DIR=${PROMETHEUS_LOG_DIR}
21
54
22
BUILD_USER?=	${USER}
55
BUILD_USER?=	${USER}
23
LD_FLAG_X_PREFIX=	-X ${GO_PKGNAME}/vendor/${GO_PKGNAME:H}/common/version
56
LD_FLAG_X_PREFIX=	-X ${GO_PKGNAME}/vendor/${GO_PKGNAME:H}/common/version
Lines 26-47 LD_FLAG_STRING= -s \ Link Here
26
				${LD_FLAG_X_PREFIX}.Revision=${PORTREVISION} \
59
				${LD_FLAG_X_PREFIX}.Revision=${PORTREVISION} \
27
				${LD_FLAG_X_PREFIX}.Branch=release-${PORTVERSION:R} \
60
				${LD_FLAG_X_PREFIX}.Branch=release-${PORTVERSION:R} \
28
				${LD_FLAG_X_PREFIX}.BuildUser=${BUILD_USER}
61
				${LD_FLAG_X_PREFIX}.BuildUser=${BUILD_USER}
29
PROMETHEUS_BINARIES=	prometheus promtool
30
62
31
do-build:
63
do-build:
32
.for bin in ${PROMETHEUS_BINARIES}
64
.for bin in ${PROMETHEUS_BINARIES}
33
	( cd ${GO_WRKSRC}/cmd/${bin} ; \
65
	( cd ${GO_WRKSRC}/cmd/${bin} ; \
34
		${SETENV} ${MAKE_ENV} ${GO_ENV} go install -ldflags "${LD_FLAG_STRING}" )
66
		${SETENV} ${MAKE_ENV} ${GO_ENV} \
67
		${GO_CMD} install -v -ldflags "${LD_FLAG_STRING}" )
35
.endfor
68
.endfor
36
69
37
do-install:
70
do-install:
38
.for bin in ${PROMETHEUS_BINARIES}
71
.for bin in ${PROMETHEUS_BINARIES}
39
	${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/${bin} ${STAGEDIR}${PREFIX}/bin
72
	${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/${bin} ${STAGEDIR}${PREFIX}/bin
40
.endfor
73
.endfor
74
41
	${INSTALL_DATA} \
75
	${INSTALL_DATA} \
42
		${WRKSRC}/documentation/examples/prometheus.yml \
76
		${WRKSRC}/documentation/examples/prometheus.yml \
43
		${STAGEDIR}${LOCALBASE}/etc/prometheus.yml.sample
77
		${STAGEDIR}${LOCALBASE}/etc/prometheus.yml.sample
44
78
45
	${MKDIR} ${STAGEDIR}${DESTDIR}/var/db/prometheus
79
	${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_DB_DIR}
80
	${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_CONSOLES_DIR}
81
	${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_CONSOLE_LIBRARIES_DIR}
82
	${MKDIR} ${STAGEDIR}${PROMETHEUS_LOG_DIR}
83
84
	( cd ${WRKSRC}/console_libraries \
85
		&& ${COPYTREE_SHARE} . ${STAGEDIR}${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
86
	)
87
	( cd ${WRKSRC}/consoles \
88
		&& ${COPYTREE_SHARE} . ${STAGEDIR}${PROMETHEUS_CONSOLES_DIR} \
89
	)
90
91
post-install-EXAMPLES-on:
92
	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
93
	${INSTALL_DATA} \
94
		${WRKDIR}/syslog.d.conf \
95
		${STAGEDIR}${EXAMPLESDIR}/syslog.d.conf
96
97
	${INSTALL_DATA} \
98
		${WRKDIR}/newsyslog.conf \
99
		${STAGEDIR}${EXAMPLESDIR}/newsyslog.conf
46
100
47
.include <bsd.port.mk>
101
.include <bsd.port.mk>
(-)b/net-mgmt/prometheus2/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1523391674
1
TIMESTAMP = 1529852060
2
SHA256 (prometheus-prometheus-v2.2.1_GH0.tar.gz) = 4f75427449bb72d1886f6cd46f752fe6300242da48b8bb870dbbd7ffc879ed92
2
SHA256 (prometheus-prometheus-v2.3.1_GH0.tar.gz) = 3aab85d3cb59540b6b43f5a80b14d13937fc0d51e8e82a29f0efebf6addd5f75
3
SIZE (prometheus-prometheus-v2.2.1_GH0.tar.gz) = 5629500
3
SIZE (prometheus-prometheus-v2.3.1_GH0.tar.gz) = 6175030
(-)b/net-mgmt/prometheus2/files/newsyslog.conf.in (+6 lines)
Added Link Here
1
# newsyslog(8) file for net-mgmt/prometheus2
2
# See newsyslog.conf(5) for details.
3
#
4
# Log file will be rotated daily, and we'll keep 15 days of logs matching the
5
# default Prometheus TSDB retention time.
6
%%PROMETHEUS_LOG_FILE%%	640	15	*	@T00	JC
(-)b/net-mgmt/prometheus2/files/prometheus.in (-25 / +31 lines)
Lines 7-24 Link Here
7
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
7
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
8
# to enable this service:
8
# to enable this service:
9
#
9
#
10
# prometheus_enable (bool):     Set to NO by default
10
# prometheus_enable (bool)
11
#                               Set it to YES to enable prometheus
11
#     Set to NO by default
12
# prometheus_user (string):     Set user to run prometheus
12
#     Set it to YES to enable prometheus
13
#                               Default is "prometheus"
13
# prometheus_user (string)
14
# prometheus_group (string):    Set group to run prometheus
14
#     Set user to run prometheus
15
#                               Default is "prometheus"
15
#     Default is "%%PROMETHEUS_USER%%"
16
# prometheus_data_dir (string): Set dir to run prometheus in
16
# prometheus_group (string)
17
#                               Default is "/var/db/prometheus"
17
#     Set group to run prometheus
18
# prometheus_log_file (string): Set file that prometheus will log to
18
#     Default is "%%PROMETHEUS_GROUP%%"
19
#                               Default is "/var/log/prometheus.log"
19
# prometheus_data_dir (string)
20
# prometheus_args (string):     Set additional command line arguments
20
#     Set dir to run prometheus in
21
#                               Default is ""
21
#     Default is "%%PROMETHEUS_DB_DIR%%"
22
# prometheus_consoles (string)
23
#     Set dir that contains Prometheus consoles
24
#     Default is "%%PROMETHEUS_CONSOLES_DIR%%"
25
# prometheus_console_libraries (string)
26
#     Set dir containing Prometheus console libraries
27
#     Default is "%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%"
28
# prometheus_args (string)
29
#     Set additional command line arguments
30
#     Default is ""
22
31
23
. /etc/rc.subr
32
. /etc/rc.subr
24
33
Lines 28-38 rcvar=prometheus_enable Link Here
28
load_rc_config $name
37
load_rc_config $name
29
38
30
: ${prometheus_enable:="NO"}
39
: ${prometheus_enable:="NO"}
31
: ${prometheus_user:="prometheus"}
40
: ${prometheus_user:="%%PROMETHEUS_USER%%"}
32
: ${prometheus_group:="prometheus"}
41
: ${prometheus_group:="%%PROMETHEUS_GROUP%%"}
33
: ${prometheus_config:="%%PREFIX%%/etc/prometheus.yml"}
42
: ${prometheus_config:="%%PREFIX%%/etc/prometheus.yml"}
34
: ${prometheus_data_dir:="/var/db/prometheus"}
43
: ${prometheus_data_dir:="%%PROMETHEUS_DB_DIR%%"}
35
: ${prometheus_log_file:="/var/log/prometheus.log"}
44
: ${prometheus_consoles_dir:="%%PROMETHEUS_CONSOLES_DIR%%"}
45
: ${prometheus_console_libraries_dir:="%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%"}
36
: ${prometheus_args:=""}
46
: ${prometheus_args:=""}
37
47
38
pidfile="/var/run/${name}.pid"
48
pidfile="/var/run/${name}.pid"
Lines 41-50 command="/usr/sbin/daemon" Link Here
41
procname="%%PREFIX%%/bin/${name}"
51
procname="%%PREFIX%%/bin/${name}"
42
sig_reload="HUP"
52
sig_reload="HUP"
43
extra_commands="reload"
53
extra_commands="reload"
44
command_args="-p ${pidfile} /usr/bin/env ${procname} \
54
command_args="-p ${pidfile} -m 3 -T ${name} \
55
                /usr/bin/env ${procname} \
45
                --config.file=${prometheus_config} \
56
                --config.file=${prometheus_config} \
46
                --storage.tsdb.path=${prometheus_data_dir} \
57
                --storage.tsdb.path=${prometheus_data_dir} \
47
                ${prometheus_args} >> ${prometheus_log_file} 2>&1"
58
                --web.console.templates=${prometheus_consoles_dir} \
59
                --web.console.libraries=${prometheus_console_libraries_dir} \
60
                ${prometheus_args}"
48
61
49
start_precmd=prometheus_startprecmd
62
start_precmd=prometheus_startprecmd
50
63
Lines 73-85 prometheus_startprecmd() Link Here
73
            -g ${prometheus_group} \
86
            -g ${prometheus_group} \
74
            /dev/null ${pidfile};
87
            /dev/null ${pidfile};
75
    fi
88
    fi
76
    if [ ! -f "${prometheus_log_file}" ]; then
77
        install \
78
            -o ${prometheus_user} \
79
            -g ${prometheus_group} \
80
            -m 640 \
81
            /dev/null ${prometheus_log_file};
82
    fi
83
    if [ ! -d ${prometheus_data_dir} ]; then
89
    if [ ! -d ${prometheus_data_dir} ]; then
84
        install \
90
        install \
85
            -d \
91
            -d \
(-)b/net-mgmt/prometheus2/files/syslog.d.conf.in (+5 lines)
Added Link Here
1
# syslogd(8) configuration file for net-mgmt/prometheus2
2
#
3
# See syslog.conf(5) for details.
4
!prometheus
5
daemon.*	%%PROMETHEUS_LOG_FILE%%
(-)b/net-mgmt/prometheus2/pkg-plist (-1 / +13 lines)
Lines 1-4 Link Here
1
bin/prometheus
1
bin/prometheus
2
bin/promtool
2
bin/promtool
3
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/newsyslog.conf
4
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/syslog.d.conf
5
%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%/menu.lib
6
%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%/prom.lib
7
%%PROMETHEUS_CONSOLES_DIR%%/index.html.example
8
%%PROMETHEUS_CONSOLES_DIR%%/node-cpu.html
9
%%PROMETHEUS_CONSOLES_DIR%%/node-disk.html
10
%%PROMETHEUS_CONSOLES_DIR%%/node-overview.html
11
%%PROMETHEUS_CONSOLES_DIR%%/node.html
12
%%PROMETHEUS_CONSOLES_DIR%%/prometheus-overview.html
13
%%PROMETHEUS_CONSOLES_DIR%%/prometheus.html
3
@sample etc/prometheus.yml.sample
14
@sample etc/prometheus.yml.sample
4
@dir(prometheus,prometheus) /var/db/prometheus
15
@dir(prometheus,prometheus) %%PROMETHEUS_DB_DIR%%
16
@dir(root,root) %%PROMETHEUS_LOG_DIR%%

Return to bug 228185