From owner-dev-commits-ports-main@freebsd.org Sat Apr 10 08:09:35 2021 Return-Path: Delivered-To: dev-commits-ports-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56C9C5D50F8; Sat, 10 Apr 2021 08:09:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FHSMg23f5z4hnr; Sat, 10 Apr 2021 08:09:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 397A85ABD; Sat, 10 Apr 2021 08:09:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13A89Znt076103; Sat, 10 Apr 2021 08:09:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A89ZSQ076102; Sat, 10 Apr 2021 08:09:35 GMT (envelope-from git) Date: Sat, 10 Apr 2021 08:09:35 GMT Message-Id: <202104100809.13A89ZSQ076102@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Alexey Dokuchaev Subject: git: 8eca04cb1eed - main - Add a port of ancillary utilities and agent for VictoriaMetrics. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: danfe X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8eca04cb1eedc479d78a0e655a9be3f0bd32dc02 Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the main branch of the FreeBSD ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 08:09:35 -0000 The branch main has been updated by danfe: URL: https://cgit.FreeBSD.org/ports/commit/?id=8eca04cb1eedc479d78a0e655a9be3f0bd32dc02 commit 8eca04cb1eedc479d78a0e655a9be3f0bd32dc02 Author: Alexey Dokuchaev AuthorDate: 2021-04-10 08:00:35 +0000 Commit: Alexey Dokuchaev CommitDate: 2021-04-10 08:07:24 +0000 Add a port of ancillary utilities and agent for VictoriaMetrics. Based on the work of: Oleg Ginzburg --- net-mgmt/Makefile | 1 + net-mgmt/vmutils/Makefile | 50 ++++++++++++++++++++++++++++++ net-mgmt/vmutils/files/vmagent.in | 65 +++++++++++++++++++++++++++++++++++++++ net-mgmt/vmutils/pkg-descr | 6 ++++ net-mgmt/vmutils/pkg-plist | 17 ++++++++++ 5 files changed, 139 insertions(+) diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile index 92ee236c8e9f..f8a303d630d5 100644 --- a/net-mgmt/Makefile +++ b/net-mgmt/Makefile @@ -376,6 +376,7 @@ SUBDIR += unifi6 SUBDIR += victoria-metrics SUBDIR += virt-viewer + SUBDIR += vmutils SUBDIR += wdiag SUBDIR += whatmask SUBDIR += wifimgr diff --git a/net-mgmt/vmutils/Makefile b/net-mgmt/vmutils/Makefile new file mode 100644 index 000000000000..754534b5f087 --- /dev/null +++ b/net-mgmt/vmutils/Makefile @@ -0,0 +1,50 @@ +# Created by: Alexey Dokuchaev + +PORTNAME= vmutils +DISTVERSIONPREFIX= v +DISTVERSION= 1.58.0 +CATEGORIES= net-mgmt +DISTINFO_FILE= ${.CURDIR}/../victoria-metrics/distinfo + +MAINTAINER= danfe@FreeBSD.org +COMMENT= Ancillary utilities and agent for VictoriaMetrics + +LICENSE= APACHE20 +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= gmake go:modules,no_targets +USE_RC_SUBR= vmagent +MAKE_ENV= PKG_TAG=${DISTVERSIONPREFIX}${DISTVERSION} \ + BUILDINFO_TAG=edd1590 GOOS=${OPSYS:tl} +ALL_TARGET= ${PORTNAME}-pure + +USE_GITHUB= yes +GH_ACCOUNT= VictoriaMetrics +GH_PROJECT= VictoriaMetrics + +.include "${.CURDIR}/../victoria-metrics/Makefile.deps" + +USERS= victoria-metrics +GROUPS= victoria-metrics +VICTORIA_DATA?= /var/db/victoria-metrics + +SUB_LIST+= VICTORIA_DATA=${VICTORIA_DATA} \ + VICTORIA_USER=${USERS} + +PLIST_SUB+= VICTORIA_DATA=${VICTORIA_DATA} \ + VICTORIA_GROUP=${GROUPS} \ + VICTORIA_USER=${USERS} + +OPTIONS_DEFINE= DOCS + +do-install: +.for p in agent alert auth backup ctl restore + ${INSTALL_PROGRAM} ${WRKSRC}/bin/vm${p}-pure \ + ${STAGEDIR}${PREFIX}/bin/vm${p} +.endfor + +do-install-DOCS-on: + @${MKDIR} ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${INSTALL_WRKSRC}/docs/vm* ${STAGEDIR}${DOCSDIR} + +.include diff --git a/net-mgmt/vmutils/files/vmagent.in b/net-mgmt/vmutils/files/vmagent.in new file mode 100644 index 000000000000..b07a662486a9 --- /dev/null +++ b/net-mgmt/vmutils/files/vmagent.in @@ -0,0 +1,65 @@ +#!/bin/sh + +# PROVIDE: victoria_vmagent +# REQUIRE: NETWORK +# BEFORE: DAEMON + +. /etc/rc.subr + +name="victoria_vmagent" +desc="Fast, cost-effective, and scalable time series database" +rcvar="victoria_vmagent_enable" +pidfile="/var/run/${name}.pid" +daemon_pidfile="/var/run/${name}-daemon.pid" +logdir="/var/log/${name}" +logfile="${logdir}/victoria_vmagent.log" +command="%%PREFIX%%/bin/vmagent" +victoria_vmagent_args=${cbsd_mq_router_config-"--remoteWrite.tmpDataPath=/tmp --promscrape.config=%%PREFIX%%/etc/prometheus/prometheus.yml --remoteWrite.url=http://127.0.0.1:8429/api/v1/write -httpListenAddr=:9429 --memory.allowedPercent=80"} +victoria_vmagent_user="%%VICTORIA_USER%%" +load_rc_config ${name} + +start_cmd="start" +stop_cmd="stop" +status_cmd="status" + +start() +{ + [ ! -d ${logdir} ] && mkdir -p ${logdir} + touch ${logfile} + chown ${victoria_vmagent_user} ${logdir} ${logfile} + /usr/sbin/daemon -u ${victoria_vmagent_user} -f -R5 -p ${pidfile} -P ${daemon_pidfile} -o ${logfile} ${command} ${victoria_vmagent_args} +} + +stop() +{ + if [ -f "${daemon_pidfile}" ]; then + pids=$( pgrep -F ${daemon_pidfile} 2>&1 ) + _err=$? + [ ${_err} -eq 0 ] && kill -9 ${pids} && /bin/rm -f ${daemon_pidfile} + fi + if [ -f "${pidfile}" ]; then + pids=$( pgrep -F ${pidfile} 2>&1 ) + _err=$? + [ ${_err} -eq 0 ] && kill -9 ${pids} && /bin/rm -f ${pidfile} + fi +} + +status() +{ + if [ -f "${pidfile}" ]; then + pids=$( pgrep -F ${pidfile} 2>&1 ) + _err=$? + if [ ${_err} -eq 0 ]; then + echo "${name} is running as pid ${pids}" + exit 0 + else + echo "wrong pid: ${pids}" + exit 1 + fi + else + echo "no pidfile $pidfile" + exit 1 + fi +} + +run_rc_command "$1" diff --git a/net-mgmt/vmutils/pkg-descr b/net-mgmt/vmutils/pkg-descr new file mode 100644 index 000000000000..84f9ad399c4f --- /dev/null +++ b/net-mgmt/vmutils/pkg-descr @@ -0,0 +1,6 @@ +VictoriaMetrics is fast, cost-effective, and scalable monitoring solution +and time series database. + +This package installs ancillary utilities and agent for VictoriaMetrics. + +WWW: https://victoriametrics.github.io/ diff --git a/net-mgmt/vmutils/pkg-plist b/net-mgmt/vmutils/pkg-plist new file mode 100644 index 000000000000..606b04af287f --- /dev/null +++ b/net-mgmt/vmutils/pkg-plist @@ -0,0 +1,17 @@ +bin/vmagent +bin/vmalert +bin/vmauth +bin/vmbackup +bin/vmctl +bin/vmrestore +%%PORTDOCS%%%%DOCSDIR%%/vmagent.md +%%PORTDOCS%%%%DOCSDIR%%/vmagent.png +%%PORTDOCS%%%%DOCSDIR%%/vmalert.md +%%PORTDOCS%%%%DOCSDIR%%/vmauth.md +%%PORTDOCS%%%%DOCSDIR%%/vmbackup.md +%%PORTDOCS%%%%DOCSDIR%%/vmctl.md +%%PORTDOCS%%%%DOCSDIR%%/vmgateway-access-control.jpg +%%PORTDOCS%%%%DOCSDIR%%/vmgateway-overview.jpeg +%%PORTDOCS%%%%DOCSDIR%%/vmgateway-rate-limiting.jpg +%%PORTDOCS%%%%DOCSDIR%%/vmgateway.md +%%PORTDOCS%%%%DOCSDIR%%/vmrestore.md