Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jul 2024 13:29:25 GMT
From:      Emanuel Haupt <ehaupt@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 0de56f2a1c17 - main - net-mgmt/promxy: Add new port
Message-ID:  <202407111329.46BDTP8W045713@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by ehaupt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0de56f2a1c1746ae4bc96674b8e0ce57bbb9eb43

commit 0de56f2a1c1746ae4bc96674b8e0ce57bbb9eb43
Author:     Pavel Timofeev <timp87@gmail.com>
AuthorDate: 2024-07-11 13:28:19 +0000
Commit:     Emanuel Haupt <ehaupt@FreeBSD.org>
CommitDate: 2024-07-11 13:29:12 +0000

    net-mgmt/promxy: Add new port
    
    Promxy is a prometheus proxy that makes many shards of prometheus appear
    as a single API endpoint to the user. This significantly simplifies
    operations and use of prometheus at scale (when you have more than one
    prometheus host). Promxy delivers this unified access endpoint without
    requiring any sidecars, custom-builds, or other changes to your
    prometheus infrastructure.
    
    PR:             269195
---
 GIDs                            |  2 +-
 UIDs                            |  2 +-
 net-mgmt/Makefile               |  1 +
 net-mgmt/promxy/Makefile        | 39 +++++++++++++++++++++
 net-mgmt/promxy/distinfo        |  5 +++
 net-mgmt/promxy/files/promxy.in | 77 +++++++++++++++++++++++++++++++++++++++++
 net-mgmt/promxy/pkg-descr       |  5 +++
 net-mgmt/promxy/pkg-plist       |  4 +++
 8 files changed, 133 insertions(+), 2 deletions(-)

diff --git a/GIDs b/GIDs
index 2fe7c6905e41..d9db9223af8d 100644
--- a/GIDs
+++ b/GIDs
@@ -421,7 +421,7 @@ fiche:*:477:
 prometheus:*:478:
 alertmanager:*:479:
 datadog:*:480:
-# free: 481
+promxy:*:481:
 # free: 482
 # free: 483
 # free: 484
diff --git a/UIDs b/UIDs
index c4f31fcd8949..7bb85ead9f11 100644
--- a/UIDs
+++ b/UIDs
@@ -426,7 +426,7 @@ fiche:*:477:477::0:0:fiche Daemon:/usr/local/www/fiche:/usr/sbin/nologin
 prometheus:*:478:478::0:0:Prometheus Daemon:/var/tmp/prometheus:/usr/sbin/nologin
 alertmanager:*:479:479::0:0:Alertmanager Daemon:/var/tmp/alertmanager:/usr/sbin/nologin
 datadog:*:480:480::0:0:DataDog Agent:/var/db/datadog:/usr/sbin/nologin
-# free: 481
+promxy:*:481:481::0:0:Promxy Daemon:/nonexistent:/usr/sbin/nologin
 # free: 482
 # free: 483
 # free: 484
diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile
index e23838498843..4d7709d01515 100644
--- a/net-mgmt/Makefile
+++ b/net-mgmt/Makefile
@@ -307,6 +307,7 @@
     SUBDIR += prometheus1
     SUBDIR += prometheus2
     SUBDIR += promscale
+    SUBDIR += promxy
     SUBDIR += pushgateway
     SUBDIR += py-adal
     SUBDIR += py-aggregate6
diff --git a/net-mgmt/promxy/Makefile b/net-mgmt/promxy/Makefile
new file mode 100644
index 000000000000..a94801d0d2e1
--- /dev/null
+++ b/net-mgmt/promxy/Makefile
@@ -0,0 +1,39 @@
+PORTNAME=	promxy
+DISTVERSIONPREFIX=	v
+DISTVERSION=	0.0.86
+CATEGORIES=	net-mgmt
+
+MAINTAINER=	timp87@gmail.com
+COMMENT=	Aggregating proxy to enable HA prometheus
+WWW=		https://github.com/jacksontj/promxy
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		go:modules
+USE_RC_SUBR=	promxy
+GO_MODULE=	github.com/jacksontj/promxy
+GO_TARGET=	./cmd/promxy
+GO_BUILDFLAGS=	-ldflags=" \
+			-X github.com/prometheus/common/version.Version=v${DISTVERSION} \
+			-X github.com/prometheus/common/version.Revision=${PORTREVISION} \
+			-X github.com/prometheus/common/version.Branch=release-${PORTVERSION:R} \
+			-X github.com/prometheus/common/version.BuildUser=${USER} \
+			-X github.com/prometheus/common/version.BuildDate=$$(date +'%Y%m%d-%T')"
+
+SUB_LIST=	GROUPS=${GROUPS} \
+		USERS=${USERS}
+
+USERS=		promxy
+GROUPS=		promxy
+
+post-patch:
+	@${REINPLACE_CMD} 's|"\*rule"|"${ETCDIR}/*rule"|' ${WRKSRC}/cmd/promxy/config.yaml
+
+post-install:
+	${MKDIR} ${STAGEDIR}${ETCDIR}
+.for f in alert_example.rule config.yaml
+	${INSTALL_DATA} ${WRKSRC}/cmd/promxy/${f} ${STAGEDIR}${ETCDIR}/${f}.sample
+.endfor
+
+.include <bsd.port.mk>
diff --git a/net-mgmt/promxy/distinfo b/net-mgmt/promxy/distinfo
new file mode 100644
index 000000000000..19483626b293
--- /dev/null
+++ b/net-mgmt/promxy/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1717380682
+SHA256 (go/net-mgmt_promxy/promxy-v0.0.86/v0.0.86.mod) = eb2034fcead52a7deb94942379564c5590fee7720f4eb735b5a363f7477b7f67
+SIZE (go/net-mgmt_promxy/promxy-v0.0.86/v0.0.86.mod) = 8436
+SHA256 (go/net-mgmt_promxy/promxy-v0.0.86/v0.0.86.zip) = ccc9b18c573ab0ec3adfacabec5048beda9b93f8d5dd250098189212f6e5e8ba
+SIZE (go/net-mgmt_promxy/promxy-v0.0.86/v0.0.86.zip) = 226317
diff --git a/net-mgmt/promxy/files/promxy.in b/net-mgmt/promxy/files/promxy.in
new file mode 100644
index 000000000000..b9adc225918c
--- /dev/null
+++ b/net-mgmt/promxy/files/promxy.in
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+# PROVIDE: promxy
+# REQUIRE: NETWORKING SERVERS DAEMON
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf or /etc/rc.conf.local
+# to enable this service:
+#
+# promxy_enable:			Enable Promxy
+#					Default: NO
+# promxy_user:				Username to run Promxy
+#					Default: %%USERS%%
+# promxy_config:			Configuration file to run Promxy
+#					Default: %%ETCDIR%%/config.yaml
+# promxy_pidfile:			Full path of the Promxy process PID file
+#					Default: /var/run/promxy.pid
+# promxy_remediate_enable:		Enable auto-restart if Promxy's been terminated
+#					Default: NO
+# promxy_remediate_delay:		Auto-restart delay if auto-restart enabled
+#					Default: 5
+# promxy_syslog_output_enable:		Enable syslog output.
+#					Default: YES
+# promxy_syslog_output_tag:		Syslog tag if syslog output enabled.
+#					Default: promxy
+# promxy_syslog_output_priority:	Syslog priority if syslog output enabled.
+#					Default: info
+# promxy_syslog_output_facility:	Syslog facility if syslog output enabled.
+#					Default: daemon
+
+. /etc/rc.subr
+
+name=promxy
+rcvar=promxy_enable
+
+load_rc_config "${name}"
+
+: ${promxy_enable:="NO"}
+: ${promxy_user:="%%USERS%%"}
+: ${promxy_config:="%%ETCDIR%%/config.yaml"}
+: ${promxy_pidfile:=/var/run/promxy.pid}
+: ${promxy_remediate_enable:="NO"}
+: ${promxy_remediate_delay="5"}
+: ${promxy_syslog_output_enable:="YES"}
+: ${promxy_syslog_output_tag:="${name}"}
+: ${promxy_syslog_output_priority:="info"}
+: ${promxy_syslog_output_facility:="daemon"}
+
+if checkyesno promxy_syslog_output_enable; then
+	if [ -n "${promxy_syslog_output_tag}" ]; then
+		promxy_syslog_output_flags="-T ${promxy_syslog_output_tag}"
+	fi
+	if [ -n "${promxy_syslog_output_priority}" ]; then
+		promxy_syslog_output_flags="${promxy_syslog_output_flags} -s ${promxy_syslog_output_priority}"
+	fi
+	if [ -n "${promxy_syslog_output_facility}" ]; then
+		promxy_syslog_output_flags="${promxy_syslog_output_flags} -l ${promxy_syslog_output_facility}"
+	fi
+fi
+
+if checkyesno promxy_remediate_enable; then
+	if [ -n "${promxy_remediate_delay}" ]; then
+		promxy_remediate_flags="-R ${promxy_remediate_delay}"
+	fi
+fi
+
+pidfile="${promxy_pidfile}"
+required_files="${promxy_config}"
+
+promxy_bin="%%PREFIX%%/bin/promxy"
+command="/usr/sbin/daemon"
+command_args="-u ${promxy_user} ${promxy_remediate_flags} -f ${promxy_syslog_output_flags} -P ${pidfile} ${promxy_bin} --config=${promxy_config}"
+
+# Run daemon(8) as root
+unset promxy_user
+
+run_rc_command "$1"
diff --git a/net-mgmt/promxy/pkg-descr b/net-mgmt/promxy/pkg-descr
new file mode 100644
index 000000000000..8a15049bfbb3
--- /dev/null
+++ b/net-mgmt/promxy/pkg-descr
@@ -0,0 +1,5 @@
+Promxy is a prometheus proxy that makes many shards of prometheus appear as
+a single API endpoint to the user. This significantly simplifies operations
+and use of prometheus at scale (when you have more than one prometheus host).
+Promxy delivers this unified access endpoint without requiring any sidecars,
+custom-builds, or other changes to your prometheus infrastructure.
diff --git a/net-mgmt/promxy/pkg-plist b/net-mgmt/promxy/pkg-plist
new file mode 100644
index 000000000000..41552c1b70ab
--- /dev/null
+++ b/net-mgmt/promxy/pkg-plist
@@ -0,0 +1,4 @@
+bin/promxy
+@dir %%ETCDIR%%
+@sample %%ETCDIR%%/alert_example.rule.sample
+@sample %%ETCDIR%%/config.yaml.sample



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