git: 759b193ef516 - main - textproc/opensearch-dashboards219: New port: Visualization dashboards for OpenSearch

From: Jose Alonso Cardenas Marquez <acm_at_FreeBSD.org>
Date: Sun, 11 May 2025 06:30:18 UTC
The branch main has been updated by acm:

URL: https://cgit.FreeBSD.org/ports/commit/?id=759b193ef516818f25e13640549fcd7105080f43

commit 759b193ef516818f25e13640549fcd7105080f43
Author:     Jose Alonso Cardenas Marquez <acm@FreeBSD.org>
AuthorDate: 2025-05-11 06:29:34 +0000
Commit:     Jose Alonso Cardenas Marquez <acm@FreeBSD.org>
CommitDate: 2025-05-11 06:29:34 +0000

    textproc/opensearch-dashboards219: New port: Visualization dashboards for OpenSearch
    
    OpenSearch Dashboards is the default visualization tool for data in OpenSearch.
    It also serves as a user interface for many of the OpenSearch plugins,
    including security, alerting, Index State Management, SQL, and more.
---
 textproc/Makefile                                  |  1 +
 textproc/opensearch-dashboards219/Makefile         | 92 ++++++++++++++++++++++
 textproc/opensearch-dashboards219/distinfo         |  5 ++
 .../files/opensearch-dashboards.in                 | 79 +++++++++++++++++++
 .../files/pkg-deinstall.in                         | 20 +++++
 textproc/opensearch-dashboards219/pkg-descr        |  3 +
 6 files changed, 200 insertions(+)

diff --git a/textproc/Makefile b/textproc/Makefile
index c65b9057068a..ea1e5af14694 100644
--- a/textproc/Makefile
+++ b/textproc/Makefile
@@ -522,6 +522,7 @@
     SUBDIR += opensearch-dashboards210
     SUBDIR += opensearch-dashboards213
     SUBDIR += opensearch-dashboards216
+    SUBDIR += opensearch-dashboards219
     SUBDIR += opensearch13
     SUBDIR += opensearch210
     SUBDIR += opensearch213
diff --git a/textproc/opensearch-dashboards219/Makefile b/textproc/opensearch-dashboards219/Makefile
new file mode 100644
index 000000000000..dfe6740216b9
--- /dev/null
+++ b/textproc/opensearch-dashboards219/Makefile
@@ -0,0 +1,92 @@
+PORTNAME=	opensearch-dashboards
+DISTVERSION=	2.19.1
+DISTVERSIONSUFFIX=	-linux-${OPENSEARCH_ARCH}
+CATEGORIES=	textproc www
+MASTER_SITES=	https://artifacts.opensearch.org/releases/bundle/${PORTNAME}/${DISTVERSION}/
+PKGNAMESUFFIX=	219
+
+MAINTAINER=	opensearch@FreeBSD.org
+COMMENT=	Visualization dashboards for OpenSearch
+WWW=		https://opensearch.org
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE.txt
+
+ONLY_FOR_ARCHS=	aarch64 amd64
+
+CONFLICTS=	opensearch-dashboards opensearch-dashboards210 opensearch-dashboards213 \
+		opensearch-dashboards216
+
+BUILD_DEPENDS=	npm-node18>0:www/npm-node18
+
+USES=		nodejs:18,build,run python:build
+USE_RC_SUBR=	${PORTNAME}
+
+SUB_FILES=	pkg-deinstall
+SUB_LIST=	PORTNAME="${PORTNAME}" \
+		PKGNAMESUFFIX="${PKGNAMESUFFIX}" \
+		WWWDIR=${WWWDIR}
+
+WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
+
+NODE_VER=	18.18.0
+NO_BUILD=	yes
+
+_DEVDIR=	${WRKDIR}/.devdir
+
+.include <bsd.port.pre.mk>
+
+.if ${ARCH} == "aarch64"
+OPENSEARCH_ARCH=	arm64
+.else
+OPENSEARCH_ARCH=	x64
+.endif
+
+post-patch:
+	@${REINPLACE_CMD} -e 's|14.20.1|${NODE_VER}|g' ${WRKSRC}/package.json
+	${RM} \
+		${WRKSRC}/bin/*.orig \
+		${WRKSRC}/bin/*.bak \
+		${WRKSRC}/package.json.bak
+	${RM} -r ${WRKSRC}/plugins/reportsDashboards/.chromium
+
+do-install:
+	${MKDIR} ${STAGEDIR}${WWWDIR} ${STAGEDIR}${ETCDIR}
+	${INSTALL_DATA} ${WRKSRC}/config/opensearch_dashboards.yml ${STAGEDIR}${ETCDIR}/opensearch_dashboards.yml.sample
+	(cd ${WRKSRC} && \
+		${COPYTREE_SHARE} "data node_modules package.json plugins src" ${STAGEDIR}${WWWDIR} && \
+		${COPYTREE_BIN} bin ${STAGEDIR}${WWWDIR})
+
+post-install:
+	${ECHO} "@sample ${ETCDIR}/opensearch_dashboards.yml.sample" >> ${TMPPLIST}
+	${FIND} -s ${STAGEDIR}${WWWDIR} -not -type d | ${SORT} | \
+		${SED} -e 's#^${STAGEDIR}${PREFIX}/##' >> ${TMPPLIST}
+	${ECHO} "@dir(www,www) ${WWWDIR}/data" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/reportsDashboards/node_modules/set-interval-async/test/resources/legacy" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/reportsDashboards/node_modules/set-interval-async/test/resources/fixed" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/reportsDashboards/node_modules/set-interval-async/test/resources/dynamic" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/reportsDashboards/node_modules/set-interval-async/examples/fixed" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/reportsDashboards/node_modules/set-interval-async/examples/dynamic" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/observabilityDashboards/server/adaptors/integrations/__test__" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/observabilityDashboards/server/adaptors/integrations/repository/__test__" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Alerts/components/AlertFlyout" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/CreateDetector/components/ConfigureAlerts/components/AlertCondition" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/components/AlertTriggerView" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/components/DetectorBasicDetailsView" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/components/DetectorRulesView" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/components/FieldMappingsView" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/components/UpdateAlertConditions" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/components/UpdateDetectorBasicDetails" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/components/UpdateDetectorRules" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/components/UpdateFieldMappings" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/containers/AlertTriggersView" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/containers/DetectorDetails" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/containers/DetectorDetailsView" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/containers/Detectors" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Detectors/containers/EditFieldMappings" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Rules/components/DeleteModal" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Rules/components/RuleEditor/components" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityAnalyticsDashboards/test/mocks/Rules/components/RulesTable" >> ${TMPPLIST}
+	${ECHO} "@dir ${WWWDIR}/plugins/securityDashboards/server/multitenancy/test" >> ${TMPPLIST}
+
+.include <bsd.port.post.mk>
diff --git a/textproc/opensearch-dashboards219/distinfo b/textproc/opensearch-dashboards219/distinfo
new file mode 100644
index 000000000000..28a08b40f649
--- /dev/null
+++ b/textproc/opensearch-dashboards219/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1746944520
+SHA256 (opensearch-dashboards-2.19.1-linux-arm64.tar.gz) = b73be280109669a412de8e620dc1090c02850f3675bb89e56ff6d1031dd1847c
+SIZE (opensearch-dashboards-2.19.1-linux-arm64.tar.gz) = 348067725
+SHA256 (opensearch-dashboards-2.19.1-linux-x64.tar.gz) = 3981a0bde67bf81b7c32541dff3965b0f7d341a0af0951b73767eab6ccf56261
+SIZE (opensearch-dashboards-2.19.1-linux-x64.tar.gz) = 348191923
diff --git a/textproc/opensearch-dashboards219/files/opensearch-dashboards.in b/textproc/opensearch-dashboards219/files/opensearch-dashboards.in
new file mode 100644
index 000000000000..7043fa9301a9
--- /dev/null
+++ b/textproc/opensearch-dashboards219/files/opensearch-dashboards.in
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+# PROVIDE: opensearch_dashboards
+# REQUIRE: DAEMON
+# BEFORE: LOGIN
+# KEYWORD: shutdown
+
+. /etc/rc.subr
+
+name=opensearch_dashboards
+rcvar=opensearch_dashboards_enable
+
+load_rc_config $name
+
+: ${opensearch_dashboards_enable:="NO"}
+: ${opensearch_dashboards_config:="%%ETCDIR%%/opensearch_dashboards.yml"}
+: ${opensearch_dashboards_user:="www"}
+: ${opensearch_dashboards_group:="www"}
+: ${opensearch_dashboards_log:="/var/log/opensearch_dashboards.log"}
+: ${opensearch_dashboards_syslog_output_enable:="NO"}
+
+start_precmd="opensearch_dashboards_start_precmd"
+reload_cmd="opensearch_dashboards_reload_cmd"
+extra_commands="reload"
+
+if checkyesno opensearch_dashboards_syslog_output_enable; then
+	if [ -n "${opensearch_dashboards_syslog_output_tag}" ]; then
+		opensearch_dashboards_syslog_output_flags="-T ${opensearch_dashboards_syslog_output_tag}"
+	else
+		opensearch_dashboards_syslog_output_flags="-T ${name}"
+	fi
+	if [ -n "${opensearch_dashboards_syslog_output_priority}" ]; then
+		opensearch_dashboards_syslog_output_flags="${opensearch_dashboards_syslog_output_flags} -s ${opensearch_dashboards_syslog_output_priority}"
+	fi
+	if [ -n "${opensearch_dashboards_syslog_output_facility}" ]; then
+		opensearch_dashboards_syslog_output_flags="${opensearch_dashboards_syslog_output_flags} -l ${opensearch_dashboards_syslog_output_facility}"
+	fi
+fi
+
+NODE="%%LOCALBASE%%/bin/node"
+
+required_files="${opensearch_dashboards_config}"
+pidfile="/var/run/${name}.pid"
+
+command="/usr/sbin/daemon"
+command_args="-f ${opensearch_dashboards_syslog_output_flags} -P ${pidfile} -t ${name} \
+	/usr/bin/env NODE_ENV=production ${opensearch_dashboards_env} \
+	${NODE} %%WWWDIR%%/src/cli/dist serve \
+	--config ${opensearch_dashboards_config} --log-file ${opensearch_dashboards_log} \
+	${opensearch_dashboards_args}"
+
+opensearch_dashboards_start_precmd()
+{
+	if [ ! -e "${pidfile}" ]; then
+		install -m 0600 -o ${opensearch_dashboards_user} -g ${opensearch_dashboards_group} /dev/null ${pidfile}
+	fi
+	if [ ! -f ${opensearch_dashboards_log} ]; then
+		install -o ${opensearch_dashboards_user} -g ${opensearch_dashboards_group} -m 640 /dev/null ${opensearch_dashboards_log}
+	fi
+	if [ ! -d %%WWWDIR%%/optimize ]; then
+		install -d -o ${opensearch_dashboards_user} -g ${opensearch_dashboards_group} %%WWWDIR%%/optimize
+	else
+		# We may have installed a plugin as root which will cause files in here
+		# to be owned by root:wheel. Fix with a chown.
+		chown -R ${opensearch_dashboards_user}:${opensearch_dashboards_group} %%WWWDIR%%/optimize
+	fi
+}
+
+opensearch_dashboards_reload_cmd()
+{
+	if [ -z "$rc_pid" ]; then
+		_run_rc_notrunning
+		return 1
+	else
+		pkill -HUP -P ${rc_pid}
+	fi
+}
+
+run_rc_command "$1"
diff --git a/textproc/opensearch-dashboards219/files/pkg-deinstall.in b/textproc/opensearch-dashboards219/files/pkg-deinstall.in
new file mode 100644
index 000000000000..0699ab559805
--- /dev/null
+++ b/textproc/opensearch-dashboards219/files/pkg-deinstall.in
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+case "$2" in
+POST-DEINSTALL)
+	if [ -d %%WWWDIR%%/optimize ]; then
+		/usr/bin/find %%WWWDIR%%/optimize/ -delete
+	fi
+
+	cat <<EOMSG
+
+If %%PORTNAME%%%%PKGNAMESUFFIX%% is being deleted permanently, and you do not wish to keep any
+data that was in the cluster, then you may wish to delete the
+%%WWWDIR%% directory.  This can be done by with the command:
+
+	# rm -rf %%WWWDIR%%
+
+Please ignore this if %%PORTNAME%%%%PKGNAMESUFFIX%% is being upgraded
+EOMSG
+    ;;
+esac
diff --git a/textproc/opensearch-dashboards219/pkg-descr b/textproc/opensearch-dashboards219/pkg-descr
new file mode 100644
index 000000000000..2669760829b1
--- /dev/null
+++ b/textproc/opensearch-dashboards219/pkg-descr
@@ -0,0 +1,3 @@
+OpenSearch Dashboards is the default visualization tool for data in OpenSearch.
+It also serves as a user interface for many of the OpenSearch plugins,
+including security, alerting, Index State Management, SQL, and more.