1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-14 07:43:06 +00:00

sysutils/alloy: new port version 1.0.0

Pull Request:	https://github.com/freebsd/freebsd-ports/pull/252
This commit is contained in:
Zach Leslie 2024-04-24 13:41:46 +00:00 committed by Matthias Fechner
parent 38c6c252a6
commit 802a051103
6 changed files with 114 additions and 0 deletions

View File

@ -29,6 +29,7 @@
SUBDIR += aimage
SUBDIR += aird
SUBDIR += alfio
SUBDIR += alloy
SUBDIR += am-utils
SUBDIR += amazon-ssm-agent
SUBDIR += amazon-ssm-plugin

48
sysutils/alloy/Makefile Normal file
View File

@ -0,0 +1,48 @@
PORTNAME= alloy
PORTVERSION= 1.0.0
DISTVERSIONPREFIX=v
CATEGORIES= sysutils
MAINTAINER= zach.leslie@grafana.com
COMMENT= OpenTelemetry Collector distribution with programmable pipelines
WWW= https://github.com/grafana/alloy
LICENSE= MIT
BUILD_DEPENDS= git:devel/git
USES= go:1.22,modules
USE_GITHUB= yes
GH_ACCOUNT= grafana
GH_PROJECT= alloy
USE_RC_SUBR= alloy
GO_MODULE= github.com/${GH_ACCOUNT}/${GH_PROJECT}
GO_PKGNAME= github.com/${GH_ACCOUNT}/${GH_PROJECT}
GO_TARGET= github.com/${GH_ACCOUNT}/${GH_PROJECT}
GO_BUILDFLAGS= -ldflags='-X github.com/grafana/alloy/internal/build.Version=v${PORTVERSION}'
# Copy the go.mod so we can get all the dist files during fetch.
_USES_fetch+= 600:go-syntax-fetch
go-syntax-fetch:
@${ECHO_MSG} "===> Fetching ${GO_MODNAME}/syntax dependency";
(cd ${DISTDIR}/${DIST_SUBDIR}; [ -e syntax/go.mod ] || mkdir syntax/; \
tar -xzf grafana-alloy-v${PORTVERSION}_GH0.tar.gz ${PORTNAME}-${PORTVERSION}/syntax/go.mod; \
cp ${PORTNAME}-${PORTVERSION}/syntax/go.mod syntax/go.mod)
# Copy over the syntax/ directory from the source extract to ensure the go mod
# replace for ./syntax is handled with the correct files on disk.
_USES_extract+= 600:go-post-extract-syntax
go-post-extract-syntax:
@cp -r ${WRKDIR}/${PORTNAME}-${PORTVERSION}/syntax ${GO_WRKSRC}/syntax;
do-install:
${INSTALL_PROGRAM} ${WRKDIR}/bin/alloy ${STAGEDIR}${PREFIX}/bin/alloy
${INSTALL_DATA} ${WRKSRC}/example-config.alloy ${STAGEDIR}${PREFIX}/etc/alloy.flow.sample
post-install:
${MKDIR} ${STAGEDIR}/var/alloy
chgrp nobody ${STAGEDIR}/var/alloy
.include <bsd.port.mk>

7
sysutils/alloy/distinfo Normal file
View File

@ -0,0 +1,7 @@
TIMESTAMP = 1713809924
SHA256 (go/sysutils_alloy/grafana-alloy-v1.0.0_GH0/v1.0.0.mod) = 180077222c8e613cc9eabd746199013aeea08ba01e0066fdf7aaa9f2d9d85b6c
SIZE (go/sysutils_alloy/grafana-alloy-v1.0.0_GH0/v1.0.0.mod) = 44822
SHA256 (go/sysutils_alloy/grafana-alloy-v1.0.0_GH0/v1.0.0.zip) = 818226307afab490f566fcc78abc483eca2001b26a40c5e4fad22f544ae568b7
SIZE (go/sysutils_alloy/grafana-alloy-v1.0.0_GH0/v1.0.0.zip) = 18132479
SHA256 (go/sysutils_alloy/grafana-alloy-v1.0.0_GH0/grafana-alloy-v1.0.0_GH0.tar.gz) = 422aa6ab7b9e606ebec2edcde79d6f26b6e648da85955fd1d5d08d6e33e7c537
SIZE (go/sysutils_alloy/grafana-alloy-v1.0.0_GH0/grafana-alloy-v1.0.0_GH0.tar.gz) = 16808552

View File

@ -0,0 +1,54 @@
#!/bin/sh
# PROVIDE: alloy
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# alloy_enable (bool): Set to NO by default.
# Set it to YES to enable alloy.
# alloy_user (string): Set user that alloy will run under
# Default is "nobody".
# alloy_group (string): Set group that alloy will run under
# Default is "nobody".
# alloy_listen_address (string):Set ip:port that alloy will listen on
# Default is ":9200".
# alloy_storage_path (string): Set storage.path
# Default is "/var/alloy".
# alloy_args (string): Set extra arguments to pass to alloy
# Default is "".
. /etc/rc.subr
name=alloy
rcvar=alloy_enable
load_rc_config $name
: ${alloy_enable:="NO"}
: ${alloy_user:="nobody"}
: ${alloy_group:="nobody"}
: ${alloy_args:=""}
: ${alloy_storage_path:="/var/alloy"}
: ${alloy_listen_address:=":9200"}
pidfile=/var/run/alloy.pid
command="/usr/sbin/daemon"
procname="%%PREFIX%%/bin/alloy"
run="run /usr/local/etc/alloy.flow"
command_args="-S -R 3 -T ${name} -P ${pidfile} /usr/bin/env ${procname} ${run} \
--storage.path=${alloy_storage_path} --server.http.listen-addr=${alloy_listen_address} ${alloy_args}"
start_precmd=alloy_startprecmd
alloy_startprecmd()
{
if [ ! -e ${pidfile} ]; then
install -o ${alloy_user} -g ${alloy_group} /dev/null ${pidfile};
fi
}
load_rc_config $name
run_rc_command "$1"

1
sysutils/alloy/pkg-descr Normal file
View File

@ -0,0 +1 @@
OpenTelemetry Collector distribution with programmable pipelines

3
sysutils/alloy/pkg-plist Normal file
View File

@ -0,0 +1,3 @@
bin/alloy
@sample etc/alloy.flow.sample
@dir(root,nobody,0770) /var/alloy