aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Leslie <zach.leslie@grafana.com>2024-04-24 13:41:46 +0000
committerMatthias Fechner <mfechner@FreeBSD.org>2024-07-23 05:26:31 +0000
commit802a051103c76dd7bec816cd8f31ec67ea489d7a (patch)
tree6c2abdbed1a751c73de1e7c28efa2911b7cffc4b
parent38c6c252a656870fde7987eaac6edc085371f9d8 (diff)
sysutils/alloy: new port version 1.0.0
-rw-r--r--sysutils/Makefile1
-rw-r--r--sysutils/alloy/Makefile48
-rw-r--r--sysutils/alloy/distinfo7
-rw-r--r--sysutils/alloy/files/alloy.in54
-rw-r--r--sysutils/alloy/pkg-descr1
-rw-r--r--sysutils/alloy/pkg-plist3
6 files changed, 114 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile
index 155a9094a2d0..d1d1e7b4193e 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -29,6 +29,7 @@
SUBDIR += aimage
SUBDIR += aird
SUBDIR += alfio
+ SUBDIR += alloy
SUBDIR += am-utils
SUBDIR += amazon-ssm-agent
SUBDIR += amazon-ssm-plugin
diff --git a/sysutils/alloy/Makefile b/sysutils/alloy/Makefile
new file mode 100644
index 000000000000..270458c75001
--- /dev/null
+++ b/sysutils/alloy/Makefile
@@ -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>
diff --git a/sysutils/alloy/distinfo b/sysutils/alloy/distinfo
new file mode 100644
index 000000000000..fbf52be850ce
--- /dev/null
+++ b/sysutils/alloy/distinfo
@@ -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
diff --git a/sysutils/alloy/files/alloy.in b/sysutils/alloy/files/alloy.in
new file mode 100644
index 000000000000..553cdb78d2ac
--- /dev/null
+++ b/sysutils/alloy/files/alloy.in
@@ -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"
diff --git a/sysutils/alloy/pkg-descr b/sysutils/alloy/pkg-descr
new file mode 100644
index 000000000000..0123b35713d8
--- /dev/null
+++ b/sysutils/alloy/pkg-descr
@@ -0,0 +1 @@
+OpenTelemetry Collector distribution with programmable pipelines
diff --git a/sysutils/alloy/pkg-plist b/sysutils/alloy/pkg-plist
new file mode 100644
index 000000000000..6b81424286ce
--- /dev/null
+++ b/sysutils/alloy/pkg-plist
@@ -0,0 +1,3 @@
+bin/alloy
+@sample etc/alloy.flow.sample
+@dir(root,nobody,0770) /var/alloy