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

Collapse All | Expand All

(-)net-mgmt/prometheus2/Makefile (-28 / +15 lines)
Lines 2-8 Link Here
2
2
3
PORTNAME=	prometheus
3
PORTNAME=	prometheus
4
DISTVERSIONPREFIX=	v
4
DISTVERSIONPREFIX=	v
5
DISTVERSION=	2.23.0
5
DISTVERSION=	2.24.1
6
CATEGORIES=	net-mgmt
6
CATEGORIES=	net-mgmt
7
7
8
MAINTAINER=	dor.bsd@xm0.uk
8
MAINTAINER=	dor.bsd@xm0.uk
Lines 21-50 Link Here
21
GO_TARGET=	./cmd/prometheus \
21
GO_TARGET=	./cmd/prometheus \
22
		./cmd/promtool
22
		./cmd/promtool
23
23
24
SUB_FILES=	prometheus
25
26
SUB_LIST+=	PROMETHEUS_USER=${PROMETHEUS_USER} \
24
SUB_LIST+=	PROMETHEUS_USER=${PROMETHEUS_USER} \
27
		PROMETHEUS_GROUP=${PROMETHEUS_GROUP} \
25
		PROMETHEUS_GROUP=${PROMETHEUS_GROUP} \
28
		PROMETHEUS_CONSOLE_LIBRARIES_DIR=${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
26
		PROMETHEUS_CONSOLE_LIBRARIES_DIR=${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
29
		PROMETHEUS_CONSOLES_DIR=${PROMETHEUS_CONSOLES_DIR} \
27
		PROMETHEUS_CONSOLES_DIR=${PROMETHEUS_CONSOLES_DIR} \
30
		PROMETHEUS_DB_DIR=${PROMETHEUS_DB_DIR} \
28
		PROMETHEUS_DB_DIR=${PROMETHEUS_DB_DIR}
31
		PROMETHEUS_LOG_DIR=${PROMETHEUS_LOG_DIR} \
32
		PROMETHEUS_LOG_FILE=${PROMETHEUS_LOG_FILE} \
33
		PROMETHEUS_SHARE_DIR=${PROMETHEUS_SHARE_DIR}
34
29
35
USERS=		${PROMETHEUS_USER}
30
USERS=		${PROMETHEUS_USER}
36
GROUPS=		${PROMETHEUS_GROUP}
31
GROUPS=		${PROMETHEUS_GROUP}
37
32
38
PLIST_SUB+=	PORTNAME=${PORTNAME} \
33
PLIST_SUB+=	PROMETHEUS_USER=${PROMETHEUS_USER} \
34
		PROMETHEUS_GROUP=${PROMETHEUS_GROUP} \
39
		PROMETHEUS_CONSOLE_LIBRARIES_DIR=${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
35
		PROMETHEUS_CONSOLE_LIBRARIES_DIR=${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
40
		PROMETHEUS_CONSOLES_DIR=${PROMETHEUS_CONSOLES_DIR} \
36
		PROMETHEUS_CONSOLES_DIR=${PROMETHEUS_CONSOLES_DIR}
41
		PROMETHEUS_DB_DIR=${PROMETHEUS_DB_DIR} \
42
		PROMETHEUS_LOG_DIR=${PROMETHEUS_LOG_DIR}
43
37
44
OPTIONS_DEFINE=	DOCS
38
OPTIONS_DEFINE=	DOCS
45
39
46
BUILD_USER?=	${USER}
40
BUILD_USER?=	${USER}
47
LD_FLAG_STRING=		-s \
41
LD_FLAG_STRING=	-s \
48
		${LD_FLAG_X_PREFIX}.Version=${PORTVERSION} \
42
		${LD_FLAG_X_PREFIX}.Version=${PORTVERSION} \
49
		${LD_FLAG_X_PREFIX}.Revision=${PORTREVISION} \
43
		${LD_FLAG_X_PREFIX}.Revision=${PORTREVISION} \
50
		${LD_FLAG_X_PREFIX}.Branch=release-${PORTVERSION:R} \
44
		${LD_FLAG_X_PREFIX}.Branch=release-${PORTVERSION:R} \
Lines 55-66 Link Here
55
PROMETHEUS_USER?=	prometheus
49
PROMETHEUS_USER?=	prometheus
56
PROMETHEUS_GROUP?=	prometheus
50
PROMETHEUS_GROUP?=	prometheus
57
51
58
PROMETHEUS_CONSOLES_DIR=		${PROMETHEUS_SHARE_DIR}/consoles
52
PROMETHEUS_CONSOLES_DIR?=		${DATADIR}/consoles
59
PROMETHEUS_CONSOLE_LIBRARIES_DIR=	${PROMETHEUS_SHARE_DIR}/console_libraries
53
PROMETHEUS_CONSOLE_LIBRARIES_DIR?=	${DATADIR}/console_libraries
60
PROMETHEUS_DB_DIR=			/var/db/${PORTNAME}
54
PROMETHEUS_DB_DIR?=			/var/db/${PORTNAME}
61
PROMETHEUS_LOG_DIR=			/var/log/prometheus
62
PROMETHEUS_LOG_FILE=			${PROMETHEUS_LOG_DIR}/prometheus.log
63
PROMETHEUS_SHARE_DIR=			${DATADIR}
64
55
65
# Bring DISTINFO_FILE into scope so we can get the timestamp.
56
# Bring DISTINFO_FILE into scope so we can get the timestamp.
66
.include <bsd.port.pre.mk>
57
.include <bsd.port.pre.mk>
Lines 72-94 Link Here
72
		${WRKSRC}/web/ui/assets_vfadata.go
63
		${WRKSRC}/web/ui/assets_vfadata.go
73
64
74
post-install:
65
post-install:
66
	${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_CONSOLES_DIR}
67
	${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_CONSOLE_LIBRARIES_DIR}
75
	${INSTALL_DATA} \
68
	${INSTALL_DATA} \
76
		${WRKSRC}/documentation/examples/prometheus.yml \
69
		${WRKSRC}/documentation/examples/prometheus.yml \
77
		${STAGEDIR}${LOCALBASE}/etc/prometheus.yml.sample
70
		${STAGEDIR}${LOCALBASE}/etc/prometheus.yml.sample
78
	@${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_DB_DIR}
79
	@${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_CONSOLES_DIR}
80
	@${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_CONSOLE_LIBRARIES_DIR}
81
	@${MKDIR} ${STAGEDIR}${PROMETHEUS_LOG_DIR}
82
	( cd ${WRKSRC}/console_libraries \
71
	( cd ${WRKSRC}/console_libraries \
83
		&& ${COPYTREE_SHARE} . ${STAGEDIR}${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
72
		&& ${COPYTREE_SHARE} . ${STAGEDIR}${PROMETHEUS_CONSOLE_LIBRARIES_DIR} )
84
	)
85
	( cd ${WRKSRC}/consoles \
73
	( cd ${WRKSRC}/consoles \
86
		&& ${COPYTREE_SHARE} . ${STAGEDIR}${PROMETHEUS_CONSOLES_DIR} \
74
		&& ${COPYTREE_SHARE} . ${STAGEDIR}${PROMETHEUS_CONSOLES_DIR} )
87
	)
88
75
89
post-install-DOCS-on:
76
post-install-DOCS-on:
90
	${MKDIR} ${STAGEDIR}${DOCSDIR}
77
	${MKDIR} ${STAGEDIR}${DOCSDIR}
91
	cd ${WRKSRC}/docs && \
78
	( cd ${WRKSRC}/docs \
92
		${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR}
79
		&& ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR} )
93
80
94
.include <bsd.port.post.mk>
81
.include <bsd.port.post.mk>
(-)net-mgmt/prometheus2/distinfo (-5 / +5 lines)
Lines 1-5 Link Here
1
TIMESTAMP = 1606419997
1
TIMESTAMP = 1611646755
2
SHA256 (prometheus-prometheus-v2.23.0_GH0.tar.gz) = 7ef1d61052fe3dace20b89ab287a6a0e835f8f111ab41584aa39b80f6093842b
2
SHA256 (prometheus-prometheus-v2.24.1_GH0.tar.gz) = 9e08bacde869c6c4b68a9e34c7074b812be1391b33d033d3072a5e1ad2debd87
3
SIZE (prometheus-prometheus-v2.23.0_GH0.tar.gz) = 14470328
3
SIZE (prometheus-prometheus-v2.24.1_GH0.tar.gz) = 14633738
4
SHA256 (ports-assets-net-mgmt_prometheus2-v2.23.0_GH0.tar.gz) = 05348fd617fd2dd253442cc9a1a12ec03c320f41e14ecd1e2b2ed70edd47eae4
4
SHA256 (ports-assets-net-mgmt_prometheus2-v2.24.1_GH0.tar.gz) = e8b25f3745a2b40a0afdb8973f1c470ab4570b78724f522219e8aa77f671222f
5
SIZE (ports-assets-net-mgmt_prometheus2-v2.23.0_GH0.tar.gz) = 5064489
5
SIZE (ports-assets-net-mgmt_prometheus2-v2.24.1_GH0.tar.gz) = 5195942
(-)net-mgmt/prometheus2/files/prometheus.in (-53 / +88 lines)
Lines 8-24 Link Here
8
# to enable this service:
8
# to enable this service:
9
#
9
#
10
# prometheus_enable (bool)
10
# prometheus_enable (bool)
11
#     Set it to YES to enable prometheus
11
#     Set to NO by default
12
#     Set to NO by default
12
#     Set it to YES to enable prometheus
13
# prometheus_user (string)
13
# prometheus_user (string)
14
#     Set user to run prometheus
14
#     Set user that prometheus will run under
15
#     Default is "%%PROMETHEUS_USER%%"
15
#     Default is "%%PROMETHEUS_USER%%"
16
# prometheus_group (string)
16
# prometheus_group (string)
17
#     Set group to run prometheus
17
#     Set group that own prometheus files
18
#     Default is "%%PROMETHEUS_GROUP%%"
18
#     Default is "%%PROMETHEUS_GROUP%%"
19
# prometheus_data_dir (string)
19
# prometheus_config (string)
20
#     Set dir to run prometheus in
20
#     Set full path to config file
21
#     Default is "%%PROMETHEUS_DB_DIR%%"
21
#     Default is "%%PREFIX%%/etc/prometheus.yml"
22
# prometheus_pidfile (string)
23
#     Set full path to pid file
24
#     Default is "/var/run/prometheus.pid"
25
# prometheus_syslog_output_enable (bool)
26
#     Set it to NO to disable syslog output
27
#     Set to YES by default
28
# prometheus_syslog_output_tag (str)
29
#     Set syslog tag if syslog enabled
30
#     Default is "prometheus"
31
# prometheus_syslog_output_priority (string)
32
#     Set syslog priority if syslog enabled
33
#     Default is "info"
34
# prometheus_syslog_output_facility (string)
35
#     Set syslog facility if syslog enabled
36
#     Default is "daemon"
22
# prometheus_consoles (string)
37
# prometheus_consoles (string)
23
#     Set dir that contains Prometheus consoles
38
#     Set dir that contains Prometheus consoles
24
#     Default is "%%PROMETHEUS_CONSOLES_DIR%%"
39
#     Default is "%%PROMETHEUS_CONSOLES_DIR%%"
Lines 25-30 Link Here
25
# prometheus_console_libraries (string)
40
# prometheus_console_libraries (string)
26
#     Set dir containing Prometheus console libraries
41
#     Set dir containing Prometheus console libraries
27
#     Default is "%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%"
42
#     Default is "%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%"
43
# prometheus_data_dir (string)
44
#     Set dir to run prometheus in
45
#     Default is "%%PROMETHEUS_DB_DIR%%"
46
# prometheus_loglevel (string)
47
#     Set one of [debug, info, warn, error]
48
#     Default is "info"
49
# prometheus_logformat (string)
50
#     Set one of [logfmt, json]
51
#     Default is "logfmt"
52
# prometheus_env (string)
53
#     Set environment variables used with prometheus
54
#     Default is ""
28
# prometheus_args (string)
55
# prometheus_args (string)
29
#     Set additional command line arguments
56
#     Set additional command line arguments
30
#     Default is ""
57
#     Default is ""
Lines 40-106 Link Here
40
: ${prometheus_user:="%%PROMETHEUS_USER%%"}
67
: ${prometheus_user:="%%PROMETHEUS_USER%%"}
41
: ${prometheus_group:="%%PROMETHEUS_GROUP%%"}
68
: ${prometheus_group:="%%PROMETHEUS_GROUP%%"}
42
: ${prometheus_config:="%%PREFIX%%/etc/prometheus.yml"}
69
: ${prometheus_config:="%%PREFIX%%/etc/prometheus.yml"}
43
: ${prometheus_data_dir:="%%PROMETHEUS_DB_DIR%%"}
70
: ${prometheus_pidfile:="/var/run/prometheus.pid"}
71
: ${prometheus_syslog_output_enable:="YES"}
44
: ${prometheus_consoles_dir:="%%PROMETHEUS_CONSOLES_DIR%%"}
72
: ${prometheus_consoles_dir:="%%PROMETHEUS_CONSOLES_DIR%%"}
45
: ${prometheus_console_libraries_dir:="%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%"}
73
: ${prometheus_console_libraries_dir:="%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%"}
46
: ${prometheus_args:=""}
74
: ${prometheus_data_dir:="%%PROMETHEUS_DB_DIR%%"}
75
: ${prometheus_loglevel:="info"}
76
: ${prometheus_logformat:="logfmt"}
47
77
48
pidfile="/var/run/${name}.pid"
78
if checkyesno prometheus_syslog_output_enable; then
79
	if [ -n "${prometheus_syslog_output_tag}" ]; then
80
		prometheus_syslog_output_flags="-T ${prometheus_syslog_output_tag}"
81
	else
82
		prometheus_syslog_output_flags="-T ${name}"
83
	fi
84
	if [ -n "${prometheus_syslog_output_priority}" ]; then
85
		prometheus_syslog_output_flags="${prometheus_syslog_output_flags} -s ${prometheus_syslog_output_priority}"
86
	fi
87
	if [ -n "${prometheus_syslog_output_facility}" ]; then
88
		prometheus_syslog_output_flags="${prometheus_syslog_output_flags} -l ${prometheus_syslog_output_facility}"
89
	fi
90
fi
91
92
pidfile="${prometheus_pidfile}"
49
required_files="${prometheus_config}"
93
required_files="${prometheus_config}"
94
95
procname="%%PREFIX%%/bin/prometheus"
50
command="/usr/sbin/daemon"
96
command="/usr/sbin/daemon"
51
procname="%%PREFIX%%/bin/${name}"
97
command_args="-f ${prometheus_syslog_output_flags} -p ${pidfile} -t ${name} \
52
sig_reload="HUP"
98
	/usr/bin/env ${prometheus_env} ${procname} \
99
	--config.file=${prometheus_config} \
100
	--web.console.templates=${prometheus_consoles_dir} \
101
	--web.console.libraries=${prometheus_console_libraries_dir} \
102
	--storage.tsdb.path=${prometheus_data_dir} \
103
	--log.level=${prometheus_loglevel} \
104
	--log.format=${prometheus_logformat} \
105
	${prometheus_args}"
106
107
start_precmd="prometheus_start_precmd"
53
extra_commands="reload"
108
extra_commands="reload"
54
command_args="-p ${pidfile} -m 3 -T ${name} \
55
                /usr/bin/env ${procname} \
56
                --config.file=${prometheus_config} \
57
                --storage.tsdb.path=${prometheus_data_dir} \
58
                --web.console.templates=${prometheus_consoles_dir} \
59
                --web.console.libraries=${prometheus_console_libraries_dir} \
60
                ${prometheus_args}"
61
109
62
start_precmd=prometheus_startprecmd
110
# This checks for the existence of a prometheus 1.x data at the
63
64
# This checks for the existence of a prometheus 1.x data dir at the
65
# $prometheus_data_dir location. If one is found, Prometheus will not start.
111
# $prometheus_data_dir location. If one is found, Prometheus will not start.
66
prometheus_check_data_dir_version()
112
prometheus_check_data_version()
67
{
113
{
68
    local data_dir_version_file="${prometheus_data_dir}/VERSION"
114
	local _version
115
	local _version_file="${prometheus_data_dir}/VERSION"
69
116
70
    if [ -f "${data_dir_version_file}" ]; then
117
	if [ -f "${_version_file}" ]; then
71
        local data_dir_version="0"
118
		read _version < "${_version_file}"
72
119
73
        read data_dir_version < "${data_dir_version_file}"
120
		if [ "${_version}" = "1" ]; then
74
121
			return 1
75
        if [ "${data_dir_version}" = "1" ]; then
122
		fi
76
            return 1
123
	fi
77
        fi
78
    fi
79
}
124
}
80
125
81
prometheus_startprecmd()
126
prometheus_start_precmd()
82
{
127
{
83
    if [ ! -e ${pidfile} ]; then
128
	if [ ! -e "${pidfile}" ]; then
84
        install \
129
		install -m 0600 -o "${prometheus_user}" -g "${prometheus_group}" /dev/null "${pidfile}"
85
            -o ${prometheus_user} \
130
	fi
86
            -g ${prometheus_group} \
131
	if [ ! -d "${prometheus_data_dir}" ]; then
87
            /dev/null ${pidfile};
132
		install -d -m 750 -o "${prometheus_user}" -g "${prometheus_group}" "${prometheus_data_dir}"
88
    fi
133
	else
89
    if [ ! -d ${prometheus_data_dir} ]; then
134
		# Ensure it's not a prometheus 1.x data
90
        install \
135
		if [ ! prometheus_check_data_version ]; then
91
            -d \
136
			err 1 "Found \"net-mgmt/prometheus1\" data, refusing to start."
92
            -o ${prometheus_user} \
137
		fi
93
            -g ${prometheus_group} \
138
	fi
94
            -m 750 \
95
            ${prometheus_data_dir}
96
    else
97
        # The directory already existed. Ensure it's not a prometheus 1.x
98
        # data dir.
99
        if ! prometheus_check_data_dir_version; then
100
            err 1 "Found net-mgmt/prometheus1 data dir, refusing to start."
101
        fi
102
    fi
103
}
139
}
104
140
105
load_rc_config $name
106
run_rc_command "$1"
141
run_rc_command "$1"
(-)net-mgmt/prometheus2/pkg-plist (-2 lines)
Lines 32-36 Link Here
32
%%PORTDOCS%%%%DOCSDIR%%/stability.md
32
%%PORTDOCS%%%%DOCSDIR%%/stability.md
33
%%PORTDOCS%%%%DOCSDIR%%/storage.md
33
%%PORTDOCS%%%%DOCSDIR%%/storage.md
34
@sample etc/prometheus.yml.sample
34
@sample etc/prometheus.yml.sample
35
@dir(prometheus,prometheus) %%PROMETHEUS_DB_DIR%%
36
@dir(root,root) %%PROMETHEUS_LOG_DIR%%

Return to bug 253064