sysutils/tempo: add new port.

PR:		283803
Reported by:	Daniel Morante <daniel at morante.net>
This commit is contained in:
Vanilla I. Shu 2025-01-05 14:54:19 +08:00
parent da732256e1
commit 6797c5bb66
9 changed files with 177 additions and 2 deletions

2
GIDs
View file

@ -289,7 +289,7 @@ _metronome:*:345:
ngircd:*:346: ngircd:*:346:
eturnal:*:347: eturnal:*:347:
davfs2:*:348: davfs2:*:348:
# free: 349 tempo:*:349:
_sabnzbd:*:350: _sabnzbd:*:350:
sonarr:*:351: sonarr:*:351:
radarr:*:352: radarr:*:352:

2
UIDs
View file

@ -295,7 +295,7 @@ _metronome:*:345:345::0:0:Metronome Daemon:/nonexistent:/usr/sbin/nologin
ngircd:*:346:346::0:0:ngIRCd Daemon:/var/empty:/usr/sbin/nologin ngircd:*:346:346::0:0:ngIRCd Daemon:/var/empty:/usr/sbin/nologin
eturnal:*:347:347::0:0:eturnal User:/var/spool/eturnal:/bin/sh eturnal:*:347:347::0:0:eturnal User:/var/spool/eturnal:/bin/sh
davfs2:*:348:348::0:0:Davfs2 Daemon:/nonexistent:/usr/sbin/nologin davfs2:*:348:348::0:0:Davfs2 Daemon:/nonexistent:/usr/sbin/nologin
# free: 349 tempo:*:349:349::0:0:Tempo Daemon:/nonexistent:/usr/sbin/nologin
_sabnzbd:*:350:350::0:0:sabnzb Daemon:/nonexistent:/usr/sbin/nologin _sabnzbd:*:350:350::0:0:sabnzb Daemon:/nonexistent:/usr/sbin/nologin
sonarr:*:351:351::0:0:Sonarr PVR:/nonexistent:/usr/sbin/nologin sonarr:*:351:351::0:0:Sonarr PVR:/nonexistent:/usr/sbin/nologin
radarr:*:352:352::0:0:Radarr Daemon:/nonexistent:/usr/sbin/nologin radarr:*:352:352::0:0:Radarr Daemon:/nonexistent:/usr/sbin/nologin

View file

@ -1363,6 +1363,7 @@
SUBDIR += tcplist SUBDIR += tcplist
SUBDIR += tdir SUBDIR += tdir
SUBDIR += tealdeer SUBDIR += tealdeer
SUBDIR += tempo
SUBDIR += tenshi SUBDIR += tenshi
SUBDIR += tere SUBDIR += tere
SUBDIR += terraform SUBDIR += terraform

53
sysutils/tempo/Makefile Normal file
View file

@ -0,0 +1,53 @@
PORTNAME= tempo
DISTVERSIONPREFIX= v
DISTVERSION= 2.6.1
CATEGORIES= sysutils
MASTER_SITES+= https://raw.githubusercontent.com/${GH_ACCOUNT}/${PORTNAME}/${DISTVERSIONFULL}/
PKGNAMEPREFIX= grafana-
DISTFILES= go.mod
MAINTAINER= daniel@morante.net
COMMENT= High volume, minimal dependency distributed tracing backend
WWW= https://github.com/grafana/tempo
LICENSE= AGPLv3
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= go:modules
USE_GITHUB= yes
GH_ACCOUNT= grafana
GH_PROJECT= tempo
USE_RC_SUBR= tempo
GO_MODULE= github.com/${GH_ACCOUNT}/${GH_PROJECT}
GO_TARGET= ./cmd/tempo ./cmd/tempo-query ./cmd/tempo-cli ./cmd/tempo-vulture
GO_BUILDFLAGS= -v -ldflags "${LD_FLAG_STRING}"
LD_FLAG_STRING= -s \
${LD_FLAG_X_PREFIX}.Version=${PORTVERSION} \
${LD_FLAG_X_PREFIX}.Revision=${PORTREVISION} \
${LD_FLAG_X_PREFIX}.Branch=HEAD \
${LD_FLAG_X_PREFIX}.BuildUser=${BUILD_USER} \
${LD_FLAG_X_PREFIX}.BuildDate=$$(date -u +"%Y-%m-%dT%H:%M:%SZ")
LD_FLAG_X_PREFIX= -X github.com/grafana/tempo/pkg/util/build
BUILD_USER?= ${USER}
TEMPO_USER?= tempo
TEMPO_GROUP?= tempo
TEMPO_DATADIR?= /var/db/${PORTNAME}
SUB_LIST= TEMPO_USER=${TEMPO_USER} \
TEMPO_GROUP=${TEMPO_GROUP} \
TEMPO_DATADIR=${TEMPO_DATADIR} \
USERS= ${TEMPO_USER}
GROUPS= ${TEMPO_GROUP}
PLIST_SUB= ${SUB_LIST}
post-install:
@${CP} ${WRKSRC}/example/docker-compose/shared/tempo.yaml ${STAGEDIR}${PREFIX}/etc/tempo.yaml.sample
@${MKDIR} ${STAGEDIR}${TEMPO_DATADIR}
.include <bsd.port.mk>

5
sysutils/tempo/distinfo Normal file
View file

@ -0,0 +1,5 @@
TIMESTAMP = 1735843421
SHA256 (go/sysutils_tempo/grafana-tempo-v2.6.1_GH0/go.mod) = 16764341886c2531d9cbba50cbbc30c80676a2010c494cfed439b1f80c89b61e
SIZE (go/sysutils_tempo/grafana-tempo-v2.6.1_GH0/go.mod) = 17886
SHA256 (go/sysutils_tempo/grafana-tempo-v2.6.1_GH0/grafana-tempo-v2.6.1_GH0.tar.gz) = ff53e3eb7ed70e378b06a70295677d4f05d40554b33b8bd91d5c351c18d3b55f
SIZE (go/sysutils_tempo/grafana-tempo-v2.6.1_GH0/grafana-tempo-v2.6.1_GH0.tar.gz) = 36372210

View file

@ -0,0 +1,30 @@
--- example/docker-compose/shared/tempo.yaml.orig 2024-10-22 18:23:02 UTC
+++ example/docker-compose/shared/tempo.yaml
@@ -36,22 +36,22 @@ metrics_generator:
registry:
external_labels:
source: tempo
- cluster: docker-compose
+ cluster: freebsd
storage:
- path: /var/tempo/generator/wal
+ path: /var/db/tempo/generator/wal
remote_write:
- url: http://prometheus:9090/api/v1/write
send_exemplars: true
traces_storage:
- path: /var/tempo/generator/traces
+ path: /var/db/tempo/generator/traces
storage:
trace:
backend: local # backend configuration to use
wal:
- path: /var/tempo/wal # where to store the wal locally
+ path: /var/db/tempo/wal # where to store the wal locally
local:
- path: /var/tempo/blocks
+ path: /var/db/tempo/blocks
overrides:
defaults:

View file

@ -0,0 +1,71 @@
#!/bin/sh
# PROVIDE: tempo
# REQUIRE: LOGIN
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf to enable tempo
# tempo_enable="YES"
#
# tempo_enable (bool):
# Set it to YES to enable grafana
# Set to NO by default
# tempo_user (string):
# Set user that grafana will run under
# Default is "%%tempo_USER%%"
# tempo_group (string):
# Set group that own grafana files
# Default is "%%tempo_GROUP%%"
# tempo_config (string)
# Set full path to config file
# Default is "%%PREFIX%%/etc/tempo.yaml"
# tempo_logfile (string)
# Set full path to log file
# Default is "/var/log/tempo/tempo.log"
# tempo_loglevel (string)
# Set log level. Only log messages with the given severity or above.
# Valid levels: [debug, info, warn, error]
# Default is "warn"
# tempo_args (string)
# Set additional command line arguments
# Default is ""
. /etc/rc.subr
name=tempo
rcvar=tempo_enable
load_rc_config $name
: ${tempo_enable:="NO"}
: ${tempo_user:="%%TEMPO_USER%%"}
: ${tempo_group:="%%TEMPO_GROUP%%"}
: ${tempo_config:="%%PREFIX%%/etc/tempo.yaml"}
: ${tempo_logfile:="/var/log/tempo/tempo.log"}
: ${tempo_loglevel:="warn"}
pidfile="/var/run/${name}/${name}.pid"
required_files="${tempo_config}"
procname="%%PREFIX%%/bin/tempo"
command="/usr/sbin/daemon"
command_args="-p ${pidfile} -t ${name} -o ${tempo_logfile} \
${procname} \
-config.file=${tempo_config} \
-log.level=${tempo_loglevel} \
${tempo_args}"
start_precmd="tempo_start_precmd"
tempo_start_precmd()
{
if [ ! -d "/var/run/${name}" ]; then
install -d -m 0750 -o ${tempo_user} -g ${tempo_group} "/var/run/${name}"
fi
if [ ! -d "/var/log/tempo" ]; then
install -d -m 0750 -o ${tempo_user} -g ${tempo_group} "/var/log/tempo"
fi
}
run_rc_command "$1"

3
sysutils/tempo/pkg-descr Normal file
View file

@ -0,0 +1,3 @@
Grafana Tempo is an open source, easy-to-use and high-scale distributed tracing
backend. Tempo is cost-efficient, requiring only object storage to operate, and
is deeply integrated with Grafana, Prometheus, and Loki.

12
sysutils/tempo/pkg-plist Normal file
View file

@ -0,0 +1,12 @@
bin/tempo
bin/tempo-query
bin/tempo-cli
bin/tempo-vulture
@sample etc/tempo.yaml.sample
@owner %%TEMPO_USER%%
@group %%TEMPO_GROUP%%
@mode 750
@dir %%TEMPO_DATADIR%%
@mode
@group
@owner