Date: Sun, 19 Sep 2021 19:35:26 GMT From: =?utf-8?Q?Romain Tarti=C3=A8re?= <romain@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: 19e156d51421 - main - textproc/opensearch-dashboards: New port Message-ID: <202109191935.18JJZQLk033939@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by romain: URL: https://cgit.FreeBSD.org/ports/commit/?id=19e156d5142115dcd542d47ee329a2656798d789 commit 19e156d5142115dcd542d47ee329a2656798d789 Author: Romain Tartière <romain@FreeBSD.org> AuthorDate: 2021-09-07 03:39:18 +0000 Commit: Romain Tartière <romain@FreeBSD.org> CommitDate: 2021-09-19 19:33:47 +0000 textproc/opensearch-dashboards: New port 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. WWW: http://opensearch.org With hat: opensearch --- textproc/opensearch-dashboards/Makefile | 75 ++++++++++++++++++++ textproc/opensearch-dashboards/distinfo | 3 + .../files/opensearch-dashboards.in | 80 ++++++++++++++++++++++ .../files/patch-bin_opensearch-dashboards | 13 ++++ .../files/patch-bin_opensearch-dashboards-keystore | 13 ++++ .../files/patch-bin_opensearch-dashboards-plugin | 13 ++++ .../files/patch-node__modules_re2_binding.gyp | 21 ++++++ ...ortsDashboards_server_routes_utils_constants.js | 11 +++ ...rc_setup__node__env_node__version__validator.js | 18 +++++ .../opensearch-dashboards/files/pkg-deinstall.in | 20 ++++++ textproc/opensearch-dashboards/pkg-descr | 5 ++ textproc/opensearch/Makefile | 7 +- 12 files changed, 278 insertions(+), 1 deletion(-) diff --git a/textproc/opensearch-dashboards/Makefile b/textproc/opensearch-dashboards/Makefile new file mode 100644 index 000000000000..6532255cca01 --- /dev/null +++ b/textproc/opensearch-dashboards/Makefile @@ -0,0 +1,75 @@ +PORTNAME= opensearch-dashboards +DISTVERSION= 1.0.1 +DISTVERSIONSUFFIX= -linux-x64 +CATEGORIES= textproc www +MASTER_SITES= https://artifacts.opensearch.org/releases/bundle/${PORTNAME}/${DISTVERSION}/ + +MAINTAINER= opensearch@FreeBSD.org +COMMENT= Visualization dashboards for OpenSearch + +LICENSE= APACHE20 +LICENSE_FILE= ${WRKSRC}/LICENSE.txt + +BUILD_DEPENDS= node14>=14.17.0:www/node14 \ + npm-node14>0:www/npm-node14 +RUN_DEPENDS= node14>=14.17.0:www/node14 + +USES= python:build +USE_RC_SUBR= ${PORTNAME} + +WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION} + +_DEVDIR= ${WRKDIR}/.devdir + +post-patch: + @${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|' -e 's|%%LOCALBASE%%|${LOCALBASE}|' -e 's|%%WRKSRC%%|${WRKSRC}|' \ + ${WRKSRC}/bin/opensearch-dashboards \ + ${WRKSRC}/bin/opensearch-dashboards-keystore \ + ${WRKSRC}/bin/opensearch-dashboards-plugin \ + ${WRKSRC}/node_modules/re2/binding.gyp \ + ${WRKSRC}/plugins/reportsDashboards/server/routes/utils/constants.js + ${RM} \ + ${WRKSRC}/bin/*.orig \ + ${WRKSRC}/bin/*.bak \ + ${WRKSRC}/node_modules/re2/binding.gyp.orig \ + ${WRKSRC}/node_modules/re2/binding.gyp.bak \ + ${WRKSRC}/plugins/reportsDashboards/server/routes/utils/constants.js.orig \ + ${WRKSRC}/plugins/reportsDashboards/server/routes/utils/constants.js.bak + ${RM} -r ${WRKSRC}/plugins/reportsDashboards/.chromium + +do-configure: + (cd ${WRKSRC}/node_modules/re2 && \ + ${SETENV} HOME=${WRKDIR} \ + ${LOCALBASE}/lib/node_modules/npm/bin/node-gyp-bin/node-gyp configure \ + --python=${PYTHON_CMD} \ + --nodedir ${LOCALBASE} \ + --devdir=${_DEVDIR}) + +do-build: + (cd ${WRKSRC}/node_modules/re2 && \ + ${SETENV} HOME=${WRKDIR} \ + ${LOCALBASE}/lib/node_modules/npm/bin/node-gyp-bin/node-gyp build \ + --devdir=${_DEVDIR}) + ${RM} -r ${WRKSRC}/node_modules/re2/build/Release/.deps \ + ${WRKSRC}/node_modules/re2/build/Release/obj.target + +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}) + ${STRIP_CMD} ${STAGEDIR}${WWWDIR}/node_modules/re2/build/Release/re2.node + +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} + +.include <bsd.port.mk> diff --git a/textproc/opensearch-dashboards/distinfo b/textproc/opensearch-dashboards/distinfo new file mode 100644 index 000000000000..052e1a43e8f4 --- /dev/null +++ b/textproc/opensearch-dashboards/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1630974509 +SHA256 (opensearch-dashboards-1.0.1-linux-x64.tar.gz) = 2ed7dac6d98dbf0bdeb04c21197ee12cef731a3ab5a549b633f708111122d9ee +SIZE (opensearch-dashboards-1.0.1-linux-x64.tar.gz) = 203017916 diff --git a/textproc/opensearch-dashboards/files/opensearch-dashboards.in b/textproc/opensearch-dashboards/files/opensearch-dashboards.in new file mode 100644 index 000000000000..38d667de990c --- /dev/null +++ b/textproc/opensearch-dashboards/files/opensearch-dashboards.in @@ -0,0 +1,80 @@ +#!/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} --no-warnings --max-http-header-size=65536 \ + %%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-dashboards/files/patch-bin_opensearch-dashboards b/textproc/opensearch-dashboards/files/patch-bin_opensearch-dashboards new file mode 100644 index 000000000000..1846571abdea --- /dev/null +++ b/textproc/opensearch-dashboards/files/patch-bin_opensearch-dashboards @@ -0,0 +1,13 @@ +--- bin/opensearch-dashboards.orig 2021-07-02 23:30:56 UTC ++++ bin/opensearch-dashboards +@@ -14,8 +14,8 @@ while [ -h "$SCRIPT" ] ; do + done + + DIR="$(dirname "${SCRIPT}")/.." +-CONFIG_DIR=${OSD_PATH_CONF:-"$DIR/config"} +-NODE="${DIR}/node/bin/node" ++CONFIG_DIR="%%PREFIX%%/etc/opensearch-dashboards" ++NODE="%%LOCALBASE%%/bin/node" + test -x "$NODE" + if [ ! -x "$NODE" ]; then + echo "unable to find usable node.js executable." diff --git a/textproc/opensearch-dashboards/files/patch-bin_opensearch-dashboards-keystore b/textproc/opensearch-dashboards/files/patch-bin_opensearch-dashboards-keystore new file mode 100644 index 000000000000..d8c1b1d5387a --- /dev/null +++ b/textproc/opensearch-dashboards/files/patch-bin_opensearch-dashboards-keystore @@ -0,0 +1,13 @@ +--- bin/opensearch-dashboards-keystore.orig 2021-07-02 23:30:56 UTC ++++ bin/opensearch-dashboards-keystore +@@ -14,8 +14,8 @@ while [ -h "$SCRIPT" ] ; do + done + + DIR="$(dirname "${SCRIPT}")/.." +-CONFIG_DIR=${OSD_PATH_CONF:-"$DIR/config"} +-NODE="${DIR}/node/bin/node" ++CONFIG_DIR="%%PREFIX%%/etc/opensearch-dashboards" ++NODE="%%LOCALBASE%%/bin/node" + test -x "$NODE" + if [ ! -x "$NODE" ]; then + echo "unable to find usable node.js executable." diff --git a/textproc/opensearch-dashboards/files/patch-bin_opensearch-dashboards-plugin b/textproc/opensearch-dashboards/files/patch-bin_opensearch-dashboards-plugin new file mode 100644 index 000000000000..358fc3f02326 --- /dev/null +++ b/textproc/opensearch-dashboards/files/patch-bin_opensearch-dashboards-plugin @@ -0,0 +1,13 @@ +--- bin/opensearch-dashboards-plugin.orig 2021-07-02 23:30:56 UTC ++++ bin/opensearch-dashboards-plugin +@@ -14,8 +14,8 @@ while [ -h "$SCRIPT" ] ; do + done + + DIR="$(dirname "${SCRIPT}")/.." +-CONFIG_DIR=${OSD_PATH_CONF:-"$DIR/config"} +-NODE="${DIR}/node/bin/node" ++CONFIG_DIR="%%PREFIX%%/etc/opensearch-dashboards" ++NODE="%%LOCALBASE%%/bin/node" + test -x "$NODE" + if [ ! -x "$NODE" ]; then + echo "unable to find usable node.js executable." diff --git a/textproc/opensearch-dashboards/files/patch-node__modules_re2_binding.gyp b/textproc/opensearch-dashboards/files/patch-node__modules_re2_binding.gyp new file mode 100644 index 000000000000..0ab0b1f203c9 --- /dev/null +++ b/textproc/opensearch-dashboards/files/patch-node__modules_re2_binding.gyp @@ -0,0 +1,21 @@ +--- node_modules/re2/binding.gyp.orig 2021-07-02 23:30:56 UTC ++++ node_modules/re2/binding.gyp +@@ -45,7 +45,7 @@ + "-Wno-sign-compare", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", +- "-Wno-cast-function-type", ++ "-Wno-bad-function-cast", + "-O3", + "-g" + ], +@@ -54,7 +54,8 @@ + "NOMINMAX" + ], + "include_dirs": [ +- "<!(node -e \"require('nan')\")", ++ "%%WRKSRC%%/node_modules/nan", ++ "%%LOCALBASE%%/include", + "vendor" + ], + "xcode_settings": { diff --git a/textproc/opensearch-dashboards/files/patch-plugins_reportsDashboards_server_routes_utils_constants.js b/textproc/opensearch-dashboards/files/patch-plugins_reportsDashboards_server_routes_utils_constants.js new file mode 100644 index 000000000000..bef199433323 --- /dev/null +++ b/textproc/opensearch-dashboards/files/patch-plugins_reportsDashboards_server_routes_utils_constants.js @@ -0,0 +1,11 @@ +--- plugins/reportsDashboards/server/routes/utils/constants.js.orig 2021-09-16 00:07:34 UTC ++++ plugins/reportsDashboards/server/routes/utils/constants.js +@@ -130,7 +130,7 @@ const SECURITY_CONSTANTS = { + PROXY_AUTH_IP_HEADER: 'x-forwarded-for' + }; + exports.SECURITY_CONSTANTS = SECURITY_CONSTANTS; +-const CHROMIUM_PATH = `${__dirname}/../../../.chromium/headless_shell`; ++const CHROMIUM_PATH = '%%LOCALBASE%%/bin/chrome'; + /** + * Metric constants + */ diff --git a/textproc/opensearch-dashboards/files/patch-src_setup__node__env_node__version__validator.js b/textproc/opensearch-dashboards/files/patch-src_setup__node__env_node__version__validator.js new file mode 100644 index 000000000000..d7fb2e5ead8b --- /dev/null +++ b/textproc/opensearch-dashboards/files/patch-src_setup__node__env_node__version__validator.js @@ -0,0 +1,18 @@ +--- src/setup_node_env/node_version_validator.js.orig 2021-09-07 03:05:30 UTC ++++ src/setup_node_env/node_version_validator.js +@@ -38,11 +38,11 @@ var pkg = require('../../package.json'); // Note: This + var currentVersion = process && process.version || null; + var rawRequiredVersion = pkg && pkg.engines && pkg.engines.node || null; + var requiredVersion = rawRequiredVersion ? 'v' + rawRequiredVersion : rawRequiredVersion; +-var isVersionValid = !!currentVersion && !!requiredVersion && currentVersion === requiredVersion; // Validates current the NodeJS version compatibility when OpenSearch Dashboards starts. ++var isVersionValid = !!currentVersion && !!requiredVersion && currentVersion >= requiredVersion; // Validates current the NodeJS version compatibility when OpenSearch Dashboards starts. + + if (!isVersionValid) { +- var errorMessage = 'OpenSearch Dashboards does not support the current Node.js version ' + currentVersion + '. Please use Node.js ' + requiredVersion + '.'; // Actions to apply when validation fails: error report + exit. ++ var errorMessage = 'OpenSearch Dashboards does not support the current Node.js version ' + currentVersion + '. Please use Node.js >= ' + requiredVersion + '.'; // Actions to apply when validation fails: error report + exit. + + console.error(errorMessage); + process.exit(1); +-} +\ No newline at end of file ++} diff --git a/textproc/opensearch-dashboards/files/pkg-deinstall.in b/textproc/opensearch-dashboards/files/pkg-deinstall.in new file mode 100644 index 000000000000..0699ab559805 --- /dev/null +++ b/textproc/opensearch-dashboards/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-dashboards/pkg-descr b/textproc/opensearch-dashboards/pkg-descr new file mode 100644 index 000000000000..ce3407de3b68 --- /dev/null +++ b/textproc/opensearch-dashboards/pkg-descr @@ -0,0 +1,5 @@ +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. + +WWW: http://opensearch.org diff --git a/textproc/opensearch/Makefile b/textproc/opensearch/Makefile index e3b39068adf0..01641ecdd90e 100644 --- a/textproc/opensearch/Makefile +++ b/textproc/opensearch/Makefile @@ -24,7 +24,11 @@ SHEBANG_FILES= bin/opensearch bin/opensearch-cli \ bin/opensearch-env bin/opensearch-env-from-file \ bin/opensearch-keystore bin/opensearch-node \ bin/opensearch-plugin bin/opensearch-shard \ - bin/performance-analyzer-agent-cli + bin/performance-analyzer-agent-cli \ + plugins/opensearch-security/tools/audit_config_migrater.sh \ + plugins/opensearch-security/tools/hash.sh \ + plugins/opensearch-security/tools/install_demo_configuration.sh \ + plugins/opensearch-security/tools/securityadmin.sh NO_BUILD= yes WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION} @@ -70,6 +74,7 @@ do-install: do-install-PLUGINS-on: (cd ${WRKSRC}/ && ${COPYTREE_SHARE} "plugins" ${STAGEDIR}${PREFIX}/lib/opensearch/) + (cd ${WRKSRC}/plugins/opensearch-security/tools && ${COPYTREE_BIN} "*.sh" ${STAGEDIR}${PREFIX}/lib/opensearch/plugins/opensearch-security/tools) post-install: .for f in ${CONFIG_FILES}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109191935.18JJZQLk033939>