git: 170431212955 - main - net/benthos: Add new port

From: Jimmy Olgeni <olgeni_at_FreeBSD.org>
Date: Sun, 05 May 2024 14:44:26 UTC
The branch main has been updated by olgeni:

URL: https://cgit.FreeBSD.org/ports/commit/?id=17043121295573db9777f6dd31364ee356e3154c

commit 17043121295573db9777f6dd31364ee356e3154c
Author:     Jimmy Olgeni <olgeni@FreeBSD.org>
AuthorDate: 2024-05-05 14:08:37 +0000
Commit:     Jimmy Olgeni <olgeni@FreeBSD.org>
CommitDate: 2024-05-05 14:43:31 +0000

    net/benthos: Add new port
    
    Benthos solves common data engineering tasks such as transformations,
    integrations, and multiplexing with declarative and unit testable
    configuration. This allows you to easily and incrementally adapt your data
    pipelines as requirements change, letting you focus on the more exciting stuff.
    
    Benthos is able to glue a wide range of sources and sinks together and hook
    into a variety of databases, caches, HTTP APIs, lambdas and more, enabling you
    to seamlessly drop it into your existing infrastructure.
---
 GIDs                          |  2 +-
 UIDs                          |  2 +-
 net/Makefile                  |  1 +
 net/benthos/Makefile          | 33 ++++++++++++++++++++++++
 net/benthos/distinfo          |  7 +++++
 net/benthos/files/benthos.in  | 60 +++++++++++++++++++++++++++++++++++++++++++
 net/benthos/files/config.yaml | 27 +++++++++++++++++++
 net/benthos/pkg-descr         | 15 +++++++++++
 8 files changed, 145 insertions(+), 2 deletions(-)

diff --git a/GIDs b/GIDs
index c406ff64d990..d98be0309a9c 100644
--- a/GIDs
+++ b/GIDs
@@ -275,7 +275,7 @@ svxlink:*:331:
 keycloak:*:332:
 honeytrap:*:333:
 percona:*:334:
-# free: 335
+benthos:*:335:
 # free: 336
 daapd:*:337:
 murmur:*:338:
diff --git a/UIDs b/UIDs
index 6c7bb79453ba..0e43c506f91e 100644
--- a/UIDs
+++ b/UIDs
@@ -280,7 +280,7 @@ svxlink:*:331:331::0:0:svxlink server:/nonexistent:/usr/sbin/nologin
 keycloak:*:332:332::0:0:keycloak server:/nonexistent:/usr/sbin/nologin
 honeytrap:*:333:333::0:0:HoneyTrap Daemon:/nonexistent:/usr/sbin/nologin
 percona:*:334:334::0:0:Percona Daemons:/nonexistent:/usr/sbin/nologin
-# free: 335
+benthos:*:335:335::0:0:Benthos Daemon:/nonexistent:/usr/sbin/nologin
 _pma:*:336:80::0:0:phpMyAdmin Owner:/nonexistent:/usr/sbin/nologin
 daapd:*:337:337::0:0:daapd User:/nonexistent:/usr/sbin/nologin
 murmur:*:338:338::0:0:& User:/nonexistent:/usr/sbin/nologin
diff --git a/net/Makefile b/net/Makefile
index 265fe9d9eba9..36041d1b163d 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -52,6 +52,7 @@
     SUBDIR += beacon
     SUBDIR += beanstalkd
     SUBDIR += belle-sip
+    SUBDIR += benthos
     SUBDIR += bindtest
     SUBDIR += binkd
     SUBDIR += bird
diff --git a/net/benthos/Makefile b/net/benthos/Makefile
new file mode 100644
index 000000000000..1a77541db6f3
--- /dev/null
+++ b/net/benthos/Makefile
@@ -0,0 +1,33 @@
+PORTNAME=	benthos
+PORTVERSION=	4.27.0
+DISTVERSIONPREFIX=	v
+CATEGORIES=	net
+
+MAINTAINER=	olgeni@FreeBSD.org
+COMMENT=	Stream processor for a wide array of data sources and sinks
+WWW=		https://www.benthos.dev/
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		go:modules
+USE_GITHUB=	yes
+GH_ACCOUNT=	benthosdev
+USE_RC_SUBR=	benthos
+
+GO_MODULE=	github.com/benthosdev/benthos/v4
+GO_PKGNAME=	github.com/${GH_ACCOUNT}/${PORTNAME}
+GO_TARGET=	./cmd/benthos
+
+USERS=		benthos
+GROUPS=		benthos
+
+PLIST_FILES=	bin/benthos \
+		"@dir(,,755) %%ETCDIR%%" \
+		"@sample %%ETCDIR%%/config.yaml.sample"
+
+post-install:
+	@${MKDIR} ${STAGEDIR}${ETCDIR}
+	${INSTALL_DATA} ${FILESDIR}/config.yaml ${STAGEDIR}${ETCDIR}/config.yaml.sample
+
+.include <bsd.port.mk>
diff --git a/net/benthos/distinfo b/net/benthos/distinfo
new file mode 100644
index 000000000000..8eee0cc40fef
--- /dev/null
+++ b/net/benthos/distinfo
@@ -0,0 +1,7 @@
+TIMESTAMP = 1714857427
+SHA256 (go/net_benthos/benthosdev-benthos-v4.27.0_GH0/v4.27.0.mod) = 8fbe69c73f2e5da6b0169269b175adfe0edb34b33b401162960d04ef455933eb
+SIZE (go/net_benthos/benthosdev-benthos-v4.27.0_GH0/v4.27.0.mod) = 17442
+SHA256 (go/net_benthos/benthosdev-benthos-v4.27.0_GH0/v4.27.0.zip) = 94b8ad0e6f6feb7138391c96580e9a3482f1a5e0f8631d4839ebd182b935e21e
+SIZE (go/net_benthos/benthosdev-benthos-v4.27.0_GH0/v4.27.0.zip) = 3980482
+SHA256 (go/net_benthos/benthosdev-benthos-v4.27.0_GH0/benthosdev-benthos-v4.27.0_GH0.tar.gz) = f196b90d1df54641110f9ac04e7b82c079190495e1a26785056cc9bd8abd2e09
+SIZE (go/net_benthos/benthosdev-benthos-v4.27.0_GH0/benthosdev-benthos-v4.27.0_GH0.tar.gz) = 2917074
diff --git a/net/benthos/files/benthos.in b/net/benthos/files/benthos.in
new file mode 100644
index 000000000000..e042c13e5896
--- /dev/null
+++ b/net/benthos/files/benthos.in
@@ -0,0 +1,60 @@
+#!/bin/sh
+#
+# PROVIDE: benthos
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf to run NATS:
+#
+# benthos_enable (bool):	Set it to "YES" to enable benthos.
+#				Default is "NO".
+# benthos_user:			User name to run as. default "benthos"
+# benthos_group:		Group name to run as. default "benthos"
+# benthos_resources:		Path to benthos resources files (glob).
+# benthos_config:		Path to benthos configuration file.
+# benthos_watcher (bool):	Set it to "YES" to enable benthos watcher mode.
+#				Default is "NO".
+# benthos_options:		Options to pass benthos
+#                               (e.g. 'streams' for streams mode).
+#
+
+. /etc/rc.subr
+
+name=benthos
+rcvar=`set_rcvar`
+
+load_rc_config ${name}
+
+: ${benthos_enable:=NO}
+: ${benthos_user:=benthos}
+: ${benthos_group:=benthos}
+: ${benthos_resources:=""}
+: ${benthos_config:="%%PREFIX%%/etc/benthos/config.yaml"}
+: ${benthos_watcher:=NO}
+: ${benthos_options=""}
+
+if [ -n "${benthos_resources}" ]; then
+    benthos_options="--resources '${benthos_resources}' ${benthos_options}"
+fi
+
+if [ -n "${benthos_config}" ]; then
+    benthos_options="--config ${benthos_config} ${benthos_options}"
+fi
+
+if checkyesno benthos_watcher; then
+    benthos_options="--watcher ${benthos_options}"
+fi
+
+start_precmd=benthos_start_precmd
+
+pidfile="/var/run/${name}.pid"
+procname=%%PREFIX%%/bin/benthos
+command=/usr/sbin/daemon
+command_args="-p ${pidfile} ${procname} ${benthos_options}"
+
+benthos_start_precmd()
+{
+    install -o ${benthos_user} -g ${benthos_group} /dev/null ${pidfile}
+}
+
+run_rc_command "$1"
diff --git a/net/benthos/files/config.yaml b/net/benthos/files/config.yaml
new file mode 100644
index 000000000000..9cd7eb3128b1
--- /dev/null
+++ b/net/benthos/files/config.yaml
@@ -0,0 +1,27 @@
+# Sample configuration file for Benthos. It saves all messages to a file (/tmp/benthos.txt).
+http:
+  enabled: true
+  address: 127.0.0.1:4195
+  root_path: /
+  debug_endpoints: false
+input:
+  http_server:
+    path: /post
+    ws_path: /post/ws
+    ws_welcome_message: "Welcome to the Benthos Websocket API."
+    allowed_verbs:
+      - POST
+    timeout: 5s
+    cors:
+      enabled: false
+      allowed_origins: []
+    sync_response:
+      status: "200"
+      headers:
+        Content-Type: application/octet-stream
+output:
+  file:
+    path: /tmp/benthos.txt
+    codec: lines
+shutdown_delay: 0s
+shutdown_timeout: 20s
diff --git a/net/benthos/pkg-descr b/net/benthos/pkg-descr
new file mode 100644
index 000000000000..85ca5f5a8c02
--- /dev/null
+++ b/net/benthos/pkg-descr
@@ -0,0 +1,15 @@
+Benthos solves common data engineering tasks such as transformations,
+integrations, and multiplexing with declarative and unit testable
+configuration. This allows you to easily and incrementally adapt your data
+pipelines as requirements change, letting you focus on the more exciting stuff.
+
+It comes armed with a wide range of processors, a lit mapping language,
+stateless windowed processing capabilities and an industry leading mascot.
+
+Benthos is able to glue a wide range of sources and sinks together and hook
+into a variety of databases, caches, HTTP APIs, lambdas and more, enabling you
+to seamlessly drop it into your existing infrastructure.
+
+Working with disparate APIs and services can be a daunting task, doubly so in a
+streaming data context. With Benthos it's possible to break these tasks down
+and automatically parallelize them as a streaming workflow.