From 1e45e988e84ce4b3a944c52366ce436306c82a1f Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Mon, 8 Jun 2020 14:25:27 -0500 Subject: [PATCH] [deb/rpm] manage pid folder (#68262) * [deb/rpm] manage pid folder This adds a tmpfiles.d configuration file for systemd users, and changes the path for both systemd and sysv to /var/run/kibana/kibana.pid. pid file generation is left unmodified for a future pr. * cleanup Co-authored-by: Elastic Machine --- src/dev/build/tasks/os_packages/run_fpm.js | 6 +++--- .../systemd/usr/lib/tmpfiles.d/kibana.conf | 1 + .../service_templates/sysv/etc/init.d/kibana | 12 ++++-------- 3 files changed, 8 insertions(+), 11 deletions(-) create mode 100644 src/dev/build/tasks/os_packages/service_templates/systemd/usr/lib/tmpfiles.d/kibana.conf diff --git a/src/dev/build/tasks/os_packages/run_fpm.js b/src/dev/build/tasks/os_packages/run_fpm.js index c49ff01b24086..0496bcf08fb91 100644 --- a/src/dev/build/tasks/os_packages/run_fpm.js +++ b/src/dev/build/tasks/os_packages/run_fpm.js @@ -123,9 +123,9 @@ export async function runFpm(config, log, build, type, pkgSpecificFlags) { // copy the data directory at /var/lib/kibana `${resolveWithTrailingSlash(fromBuild('data'))}=/var/lib/kibana/`, - // copy the generated pleaserun services for systemd and sysv into /etc/ - `${resolveWithTrailingSlash(__dirname, 'service_templates/sysv/etc')}=/etc/`, - `${resolveWithTrailingSlash(__dirname, 'service_templates/systemd/etc')}=/etc/`, + // copy package configurations + `${resolveWithTrailingSlash(__dirname, 'service_templates/sysv/')}=/`, + `${resolveWithTrailingSlash(__dirname, 'service_templates/systemd/')}=/`, ]; log.debug('calling fpm with args:', args); diff --git a/src/dev/build/tasks/os_packages/service_templates/systemd/usr/lib/tmpfiles.d/kibana.conf b/src/dev/build/tasks/os_packages/service_templates/systemd/usr/lib/tmpfiles.d/kibana.conf new file mode 100644 index 0000000000000..b5422df52fe11 --- /dev/null +++ b/src/dev/build/tasks/os_packages/service_templates/systemd/usr/lib/tmpfiles.d/kibana.conf @@ -0,0 +1 @@ +d /var/run/kibana 0755 kibana kibana - - \ No newline at end of file diff --git a/src/dev/build/tasks/os_packages/service_templates/sysv/etc/init.d/kibana b/src/dev/build/tasks/os_packages/service_templates/sysv/etc/init.d/kibana index ce29fd12b8e3c..d935dc6e31f80 100755 --- a/src/dev/build/tasks/os_packages/service_templates/sysv/etc/init.d/kibana +++ b/src/dev/build/tasks/os_packages/service_templates/sysv/etc/init.d/kibana @@ -17,7 +17,7 @@ name=kibana program=/usr/share/kibana/bin/kibana -pidfile="/var/run/$name.pid" +pidfile="/var/run/kibana/$name.pid" [ -r /etc/default/$name ] && . /etc/default/$name [ -r /etc/sysconfig/$name ] && . /etc/sysconfig/$name @@ -37,17 +37,13 @@ emit() { } start() { - - # Ensure the log directory is setup correctly. [ ! -d "/var/log/kibana/" ] && mkdir "/var/log/kibana/" chown "$user":"$group" "/var/log/kibana/" chmod 755 "/var/log/kibana/" - - # Setup any environmental stuff beforehand - - - # Run the program! + [ ! -d "/var/run/kibana/" ] && mkdir "/var/run/kibana/" + chown "$user":"$group" "/var/run/kibana/" + chmod 755 "/var/run/kibana/" chroot --userspec "$user":"$group" "$chroot" sh -c "