git: 4fc5b7999a4a - main - textproc/kibana7: Fix restart and stop
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 26 Oct 2021 14:04:32 UTC
The branch main has been updated by otis:
URL: https://cgit.FreeBSD.org/ports/commit/?id=4fc5b7999a4a28d337226c6529f18ea00167122d
commit 4fc5b7999a4a28d337226c6529f18ea00167122d
Author: Juraj Lutter <otis@FreeBSD.org>
AuthorDate: 2021-10-26 06:24:56 +0000
Commit: Juraj Lutter <otis@FreeBSD.org>
CommitDate: 2021-10-26 13:53:23 +0000
textproc/kibana7: Fix restart and stop
Kibana now spawns two processes instead of one. The scenario looks like:
P1 /usr/sbin/daemon
P2 ${PREFIX}/bin/node ...
P3 ${PREFIX}/bin/node ...
It is not enough to kill P1 or P2, process P3 must be sent TERM signal.
Instruct process P3 to write its pid to a file specified by pid.file
config parameter.
Write P1's pid to /var/run/${name}-daemon.pid and instruct kibana to
write its the proper (P3) pid into /var/run/kibana.pid and also
check for proper process name.
And while here, also install a symlink for Node.js binary to
allow kibana utilities to work.
---
textproc/kibana7/Makefile | 3 +++
textproc/kibana7/files/kibana.in | 7 ++++++-
textproc/kibana7/files/patch-config_kibana.yml | 11 +++++++++++
.../patch-src_setup__node__env_node__version__validator.js | 4 ++--
4 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/textproc/kibana7/Makefile b/textproc/kibana7/Makefile
index 458c16489f25..ad61fc51bb79 100644
--- a/textproc/kibana7/Makefile
+++ b/textproc/kibana7/Makefile
@@ -3,6 +3,7 @@
PORTNAME= kibana
PORTVERSION= 7.15.1
DISTVERSIONSUFFIX= -darwin-x86_64
+PORTREVISION= 1
CATEGORIES= textproc www
MASTER_SITES= https://artifacts.elastic.co/downloads/kibana/ \
http://artifacts.elastic.co/downloads/kibana/
@@ -91,6 +92,8 @@ do-install:
${COPYTREE_SHARE} . ${STAGEDIR}${WWWDIR} && \
${COPYTREE_BIN} bin ${STAGEDIR}${WWWDIR})
${INSTALL} -lrs ${STAGEDIR}${ETCDIR} ${STAGEDIR}${WWWDIR}/config
+ ${MKDIR} ${STAGEDIR}${WWWDIR}/node/bin
+ ${LN} -s ${LOCALBASE}/bin/node ${STAGEDIR}${WWWDIR}/node/bin/node
${RM} ${STAGEDIR}${WWWDIR}/node_modules/re2/build/Release/re2.node
${INSTALL_LIB} ${_RE2DIR}/build/Release/re2.node \
${STAGEDIR}${WWWDIR}/node_modules/re2/build/Release/re2.node
diff --git a/textproc/kibana7/files/kibana.in b/textproc/kibana7/files/kibana.in
index b61f10699d53..7b8fb1bbee65 100644
--- a/textproc/kibana7/files/kibana.in
+++ b/textproc/kibana7/files/kibana.in
@@ -40,10 +40,12 @@ fi
NODE="%%LOCALBASE%%/bin/node"
required_files="${kibana_config}"
+_dpidfile="/var/run/${name}-daemon.pid"
pidfile="/var/run/${name}.pid"
+procname="${NODE}"
command="/usr/sbin/daemon"
-command_args="-f ${kibana_syslog_output_flags} -P ${pidfile} -t ${name} \
+command_args="-f ${kibana_syslog_output_flags} -P ${_dpidfile} -t ${name} \
/usr/bin/env BABEL_DISABLE_CACHE=1 NODE_ENV=production ${kibana_env} \
${NODE} --no-warnings --max-http-header-size=65536 \
%%WWWDIR%%/src/cli/dist serve \
@@ -52,6 +54,9 @@ command_args="-f ${kibana_syslog_output_flags} -P ${pidfile} -t ${name} \
kibana_start_precmd()
{
+ if [ ! -e "${_dpidfile}" ]; then
+ install -m 0600 -o ${kibana_user} -g ${kibana_group} /dev/null ${_dpidfile}
+ fi
if [ ! -e "${pidfile}" ]; then
install -m 0600 -o ${kibana_user} -g ${kibana_group} /dev/null ${pidfile}
fi
diff --git a/textproc/kibana7/files/patch-config_kibana.yml b/textproc/kibana7/files/patch-config_kibana.yml
new file mode 100644
index 000000000000..88cac6039757
--- /dev/null
+++ b/textproc/kibana7/files/patch-config_kibana.yml
@@ -0,0 +1,11 @@
+--- config/kibana.yml.orig 2021-10-26 12:51:47 UTC
++++ config/kibana.yml
+@@ -91,7 +91,7 @@
+ #elasticsearch.logQueries: false
+
+ # Specifies the path where Kibana creates the process ID file.
+-#pid.file: /run/kibana/kibana.pid
++pid.file: /var/run/kibana/kibana.pid
+
+ # Enables you to specify a file where Kibana stores log output.
+ #logging.dest: stdout
diff --git a/textproc/kibana7/files/patch-src_setup__node__env_node__version__validator.js b/textproc/kibana7/files/patch-src_setup__node__env_node__version__validator.js
index b92478b5acc4..1bf9870031e9 100644
--- a/textproc/kibana7/files/patch-src_setup__node__env_node__version__validator.js
+++ b/textproc/kibana7/files/patch-src_setup__node__env_node__version__validator.js
@@ -1,6 +1,6 @@
---- src/setup_node_env/node_version_validator.js.orig 2020-11-15 15:12:50 UTC
+--- src/setup_node_env/node_version_validator.js.orig 2021-10-07 21:19:53 UTC
+++ src/setup_node_env/node_version_validator.js
-@@ -25,11 +25,11 @@ var pkg = require('../../package.json'); // Note: This
+@@ -14,11 +14,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;