1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-23 00:43:28 +00:00

net-mgmt/prometheus2: Update to 2.24.1

Changes:	https://github.com/prometheus/prometheus/releases/tag/v2.24.1
PR:		253064
Submitted by:	Boris Korzun <drtr0jan@yandex.ru>
Approved by:	David O'Rourke <dor.bsd@xm0.uk> (maintainer)
This commit is contained in:
Dmitri Goutnik 2021-01-28 23:11:57 +00:00
parent 7e7ce4f507
commit 5109fb2d06
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=563164
4 changed files with 109 additions and 88 deletions

View File

@ -2,7 +2,7 @@
PORTNAME= prometheus PORTNAME= prometheus
DISTVERSIONPREFIX= v DISTVERSIONPREFIX= v
DISTVERSION= 2.23.0 DISTVERSION= 2.24.1
CATEGORIES= net-mgmt CATEGORIES= net-mgmt
MAINTAINER= dor.bsd@xm0.uk MAINTAINER= dor.bsd@xm0.uk
@ -21,30 +21,24 @@ GO_BUILDFLAGS= -v -ldflags "${LD_FLAG_STRING}" -tags netgo,builtinassets
GO_TARGET= ./cmd/prometheus \ GO_TARGET= ./cmd/prometheus \
./cmd/promtool ./cmd/promtool
SUB_FILES= prometheus
SUB_LIST+= PROMETHEUS_USER=${PROMETHEUS_USER} \ SUB_LIST+= PROMETHEUS_USER=${PROMETHEUS_USER} \
PROMETHEUS_GROUP=${PROMETHEUS_GROUP} \ PROMETHEUS_GROUP=${PROMETHEUS_GROUP} \
PROMETHEUS_CONSOLE_LIBRARIES_DIR=${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \ PROMETHEUS_CONSOLE_LIBRARIES_DIR=${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
PROMETHEUS_CONSOLES_DIR=${PROMETHEUS_CONSOLES_DIR} \ PROMETHEUS_CONSOLES_DIR=${PROMETHEUS_CONSOLES_DIR} \
PROMETHEUS_DB_DIR=${PROMETHEUS_DB_DIR} \ PROMETHEUS_DB_DIR=${PROMETHEUS_DB_DIR}
PROMETHEUS_LOG_DIR=${PROMETHEUS_LOG_DIR} \
PROMETHEUS_LOG_FILE=${PROMETHEUS_LOG_FILE} \
PROMETHEUS_SHARE_DIR=${PROMETHEUS_SHARE_DIR}
USERS= ${PROMETHEUS_USER} USERS= ${PROMETHEUS_USER}
GROUPS= ${PROMETHEUS_GROUP} GROUPS= ${PROMETHEUS_GROUP}
PLIST_SUB+= PORTNAME=${PORTNAME} \ PLIST_SUB+= PROMETHEUS_USER=${PROMETHEUS_USER} \
PROMETHEUS_GROUP=${PROMETHEUS_GROUP} \
PROMETHEUS_CONSOLE_LIBRARIES_DIR=${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \ PROMETHEUS_CONSOLE_LIBRARIES_DIR=${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
PROMETHEUS_CONSOLES_DIR=${PROMETHEUS_CONSOLES_DIR} \ PROMETHEUS_CONSOLES_DIR=${PROMETHEUS_CONSOLES_DIR}
PROMETHEUS_DB_DIR=${PROMETHEUS_DB_DIR} \
PROMETHEUS_LOG_DIR=${PROMETHEUS_LOG_DIR}
OPTIONS_DEFINE= DOCS OPTIONS_DEFINE= DOCS
BUILD_USER?= ${USER} BUILD_USER?= ${USER}
LD_FLAG_STRING= -s \ LD_FLAG_STRING= -s \
${LD_FLAG_X_PREFIX}.Version=${PORTVERSION} \ ${LD_FLAG_X_PREFIX}.Version=${PORTVERSION} \
${LD_FLAG_X_PREFIX}.Revision=${PORTREVISION} \ ${LD_FLAG_X_PREFIX}.Revision=${PORTREVISION} \
${LD_FLAG_X_PREFIX}.Branch=release-${PORTVERSION:R} \ ${LD_FLAG_X_PREFIX}.Branch=release-${PORTVERSION:R} \
@ -55,12 +49,9 @@ LD_FLAG_X_PREFIX= -X github.com/prometheus/common/version
PROMETHEUS_USER?= prometheus PROMETHEUS_USER?= prometheus
PROMETHEUS_GROUP?= prometheus PROMETHEUS_GROUP?= prometheus
PROMETHEUS_CONSOLES_DIR= ${PROMETHEUS_SHARE_DIR}/consoles PROMETHEUS_CONSOLES_DIR?= ${DATADIR}/consoles
PROMETHEUS_CONSOLE_LIBRARIES_DIR= ${PROMETHEUS_SHARE_DIR}/console_libraries PROMETHEUS_CONSOLE_LIBRARIES_DIR?= ${DATADIR}/console_libraries
PROMETHEUS_DB_DIR= /var/db/${PORTNAME} PROMETHEUS_DB_DIR?= /var/db/${PORTNAME}
PROMETHEUS_LOG_DIR= /var/log/prometheus
PROMETHEUS_LOG_FILE= ${PROMETHEUS_LOG_DIR}/prometheus.log
PROMETHEUS_SHARE_DIR= ${DATADIR}
# Bring DISTINFO_FILE into scope so we can get the timestamp. # Bring DISTINFO_FILE into scope so we can get the timestamp.
.include <bsd.port.pre.mk> .include <bsd.port.pre.mk>
@ -72,23 +63,19 @@ post-patch:
${WRKSRC}/web/ui/assets_vfadata.go ${WRKSRC}/web/ui/assets_vfadata.go
post-install: post-install:
${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_CONSOLES_DIR}
${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_CONSOLE_LIBRARIES_DIR}
${INSTALL_DATA} \ ${INSTALL_DATA} \
${WRKSRC}/documentation/examples/prometheus.yml \ ${WRKSRC}/documentation/examples/prometheus.yml \
${STAGEDIR}${LOCALBASE}/etc/prometheus.yml.sample ${STAGEDIR}${LOCALBASE}/etc/prometheus.yml.sample
@${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_DB_DIR}
@${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_CONSOLES_DIR}
@${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_CONSOLE_LIBRARIES_DIR}
@${MKDIR} ${STAGEDIR}${PROMETHEUS_LOG_DIR}
( cd ${WRKSRC}/console_libraries \ ( cd ${WRKSRC}/console_libraries \
&& ${COPYTREE_SHARE} . ${STAGEDIR}${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \ && ${COPYTREE_SHARE} . ${STAGEDIR}${PROMETHEUS_CONSOLE_LIBRARIES_DIR} )
)
( cd ${WRKSRC}/consoles \ ( cd ${WRKSRC}/consoles \
&& ${COPYTREE_SHARE} . ${STAGEDIR}${PROMETHEUS_CONSOLES_DIR} \ && ${COPYTREE_SHARE} . ${STAGEDIR}${PROMETHEUS_CONSOLES_DIR} )
)
post-install-DOCS-on: post-install-DOCS-on:
${MKDIR} ${STAGEDIR}${DOCSDIR} ${MKDIR} ${STAGEDIR}${DOCSDIR}
cd ${WRKSRC}/docs && \ ( cd ${WRKSRC}/docs \
${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR} && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR} )
.include <bsd.port.post.mk> .include <bsd.port.post.mk>

View File

@ -1,5 +1,5 @@
TIMESTAMP = 1606419997 TIMESTAMP = 1611646755
SHA256 (prometheus-prometheus-v2.23.0_GH0.tar.gz) = 7ef1d61052fe3dace20b89ab287a6a0e835f8f111ab41584aa39b80f6093842b SHA256 (prometheus-prometheus-v2.24.1_GH0.tar.gz) = 9e08bacde869c6c4b68a9e34c7074b812be1391b33d033d3072a5e1ad2debd87
SIZE (prometheus-prometheus-v2.23.0_GH0.tar.gz) = 14470328 SIZE (prometheus-prometheus-v2.24.1_GH0.tar.gz) = 14633738
SHA256 (ports-assets-net-mgmt_prometheus2-v2.23.0_GH0.tar.gz) = 05348fd617fd2dd253442cc9a1a12ec03c320f41e14ecd1e2b2ed70edd47eae4 SHA256 (ports-assets-net-mgmt_prometheus2-v2.24.1_GH0.tar.gz) = e8b25f3745a2b40a0afdb8973f1c470ab4570b78724f522219e8aa77f671222f
SIZE (ports-assets-net-mgmt_prometheus2-v2.23.0_GH0.tar.gz) = 5064489 SIZE (ports-assets-net-mgmt_prometheus2-v2.24.1_GH0.tar.gz) = 5195942

View File

@ -8,23 +8,50 @@
# to enable this service: # to enable this service:
# #
# prometheus_enable (bool) # prometheus_enable (bool)
# Set to NO by default
# Set it to YES to enable prometheus # Set it to YES to enable prometheus
# Set to NO by default
# prometheus_user (string) # prometheus_user (string)
# Set user to run prometheus # Set user that prometheus will run under
# Default is "%%PROMETHEUS_USER%%" # Default is "%%PROMETHEUS_USER%%"
# prometheus_group (string) # prometheus_group (string)
# Set group to run prometheus # Set group that own prometheus files
# Default is "%%PROMETHEUS_GROUP%%" # Default is "%%PROMETHEUS_GROUP%%"
# prometheus_data_dir (string) # prometheus_config (string)
# Set dir to run prometheus in # Set full path to config file
# Default is "%%PROMETHEUS_DB_DIR%%" # Default is "%%PREFIX%%/etc/prometheus.yml"
# prometheus_pidfile (string)
# Set full path to pid file
# Default is "/var/run/prometheus.pid"
# prometheus_syslog_output_enable (bool)
# Set it to NO to disable syslog output
# Set to YES by default
# prometheus_syslog_output_tag (str)
# Set syslog tag if syslog enabled
# Default is "prometheus"
# prometheus_syslog_output_priority (string)
# Set syslog priority if syslog enabled
# Default is "info"
# prometheus_syslog_output_facility (string)
# Set syslog facility if syslog enabled
# Default is "daemon"
# prometheus_consoles (string) # prometheus_consoles (string)
# Set dir that contains Prometheus consoles # Set dir that contains Prometheus consoles
# Default is "%%PROMETHEUS_CONSOLES_DIR%%" # Default is "%%PROMETHEUS_CONSOLES_DIR%%"
# prometheus_console_libraries (string) # prometheus_console_libraries (string)
# Set dir containing Prometheus console libraries # Set dir containing Prometheus console libraries
# Default is "%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%" # Default is "%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%"
# prometheus_data_dir (string)
# Set dir to run prometheus in
# Default is "%%PROMETHEUS_DB_DIR%%"
# prometheus_loglevel (string)
# Set one of [debug, info, warn, error]
# Default is "info"
# prometheus_logformat (string)
# Set one of [logfmt, json]
# Default is "logfmt"
# prometheus_env (string)
# Set environment variables used with prometheus
# Default is ""
# prometheus_args (string) # prometheus_args (string)
# Set additional command line arguments # Set additional command line arguments
# Default is "" # Default is ""
@ -40,67 +67,75 @@ load_rc_config $name
: ${prometheus_user:="%%PROMETHEUS_USER%%"} : ${prometheus_user:="%%PROMETHEUS_USER%%"}
: ${prometheus_group:="%%PROMETHEUS_GROUP%%"} : ${prometheus_group:="%%PROMETHEUS_GROUP%%"}
: ${prometheus_config:="%%PREFIX%%/etc/prometheus.yml"} : ${prometheus_config:="%%PREFIX%%/etc/prometheus.yml"}
: ${prometheus_data_dir:="%%PROMETHEUS_DB_DIR%%"} : ${prometheus_pidfile:="/var/run/prometheus.pid"}
: ${prometheus_syslog_output_enable:="YES"}
: ${prometheus_consoles_dir:="%%PROMETHEUS_CONSOLES_DIR%%"} : ${prometheus_consoles_dir:="%%PROMETHEUS_CONSOLES_DIR%%"}
: ${prometheus_console_libraries_dir:="%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%"} : ${prometheus_console_libraries_dir:="%%PROMETHEUS_CONSOLE_LIBRARIES_DIR%%"}
: ${prometheus_args:=""} : ${prometheus_data_dir:="%%PROMETHEUS_DB_DIR%%"}
: ${prometheus_loglevel:="info"}
: ${prometheus_logformat:="logfmt"}
pidfile="/var/run/${name}.pid" if checkyesno prometheus_syslog_output_enable; then
if [ -n "${prometheus_syslog_output_tag}" ]; then
prometheus_syslog_output_flags="-T ${prometheus_syslog_output_tag}"
else
prometheus_syslog_output_flags="-T ${name}"
fi
if [ -n "${prometheus_syslog_output_priority}" ]; then
prometheus_syslog_output_flags="${prometheus_syslog_output_flags} -s ${prometheus_syslog_output_priority}"
fi
if [ -n "${prometheus_syslog_output_facility}" ]; then
prometheus_syslog_output_flags="${prometheus_syslog_output_flags} -l ${prometheus_syslog_output_facility}"
fi
fi
pidfile="${prometheus_pidfile}"
required_files="${prometheus_config}" required_files="${prometheus_config}"
procname="%%PREFIX%%/bin/prometheus"
command="/usr/sbin/daemon" command="/usr/sbin/daemon"
procname="%%PREFIX%%/bin/${name}" command_args="-f ${prometheus_syslog_output_flags} -p ${pidfile} -t ${name} \
sig_reload="HUP" /usr/bin/env ${prometheus_env} ${procname} \
--config.file=${prometheus_config} \
--web.console.templates=${prometheus_consoles_dir} \
--web.console.libraries=${prometheus_console_libraries_dir} \
--storage.tsdb.path=${prometheus_data_dir} \
--log.level=${prometheus_loglevel} \
--log.format=${prometheus_logformat} \
${prometheus_args}"
start_precmd="prometheus_start_precmd"
extra_commands="reload" extra_commands="reload"
command_args="-p ${pidfile} -m 3 -T ${name} \
/usr/bin/env ${procname} \
--config.file=${prometheus_config} \
--storage.tsdb.path=${prometheus_data_dir} \
--web.console.templates=${prometheus_consoles_dir} \
--web.console.libraries=${prometheus_console_libraries_dir} \
${prometheus_args}"
start_precmd=prometheus_startprecmd # This checks for the existence of a prometheus 1.x data at the
# 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_data_dir location. If one is found, Prometheus will not start.
prometheus_check_data_dir_version() prometheus_check_data_version()
{ {
local data_dir_version_file="${prometheus_data_dir}/VERSION" local _version
local _version_file="${prometheus_data_dir}/VERSION"
if [ -f "${data_dir_version_file}" ]; then if [ -f "${_version_file}" ]; then
local data_dir_version="0" read _version < "${_version_file}"
read data_dir_version < "${data_dir_version_file}" if [ "${_version}" = "1" ]; then
return 1
if [ "${data_dir_version}" = "1" ]; then fi
return 1 fi
fi
fi
} }
prometheus_startprecmd() prometheus_start_precmd()
{ {
if [ ! -e ${pidfile} ]; then if [ ! -e "${pidfile}" ]; then
install \ install -m 0600 -o "${prometheus_user}" -g "${prometheus_group}" /dev/null "${pidfile}"
-o ${prometheus_user} \ fi
-g ${prometheus_group} \ if [ ! -d "${prometheus_data_dir}" ]; then
/dev/null ${pidfile}; install -d -m 750 -o "${prometheus_user}" -g "${prometheus_group}" "${prometheus_data_dir}"
fi else
if [ ! -d ${prometheus_data_dir} ]; then # Ensure it's not a prometheus 1.x data
install \ if [ ! prometheus_check_data_version ]; then
-d \ err 1 "Found \"net-mgmt/prometheus1\" data, refusing to start."
-o ${prometheus_user} \ fi
-g ${prometheus_group} \ fi
-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
} }
load_rc_config $name
run_rc_command "$1" run_rc_command "$1"

View File

@ -11,6 +11,7 @@ bin/promtool
%%PROMETHEUS_CONSOLES_DIR%%/prometheus.html %%PROMETHEUS_CONSOLES_DIR%%/prometheus.html
%%PORTDOCS%%%%DOCSDIR%%/configuration/alerting_rules.md %%PORTDOCS%%%%DOCSDIR%%/configuration/alerting_rules.md
%%PORTDOCS%%%%DOCSDIR%%/configuration/configuration.md %%PORTDOCS%%%%DOCSDIR%%/configuration/configuration.md
%%PORTDOCS%%%%DOCSDIR%%/configuration/https.md
%%PORTDOCS%%%%DOCSDIR%%/configuration/index.md %%PORTDOCS%%%%DOCSDIR%%/configuration/index.md
%%PORTDOCS%%%%DOCSDIR%%/configuration/recording_rules.md %%PORTDOCS%%%%DOCSDIR%%/configuration/recording_rules.md
%%PORTDOCS%%%%DOCSDIR%%/configuration/template_examples.md %%PORTDOCS%%%%DOCSDIR%%/configuration/template_examples.md
@ -32,5 +33,3 @@ bin/promtool
%%PORTDOCS%%%%DOCSDIR%%/stability.md %%PORTDOCS%%%%DOCSDIR%%/stability.md
%%PORTDOCS%%%%DOCSDIR%%/storage.md %%PORTDOCS%%%%DOCSDIR%%/storage.md
@sample etc/prometheus.yml.sample @sample etc/prometheus.yml.sample
@dir(prometheus,prometheus) %%PROMETHEUS_DB_DIR%%
@dir(root,root) %%PROMETHEUS_LOG_DIR%%