[deb/rpm] remove sysv (#74424)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Jonathan Budzenski 2020-10-29 10:37:50 -05:00 committed by GitHub
parent 995111ad8a
commit 3ee6656837
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 12 additions and 249 deletions

View file

@ -167,4 +167,14 @@ The `xpack.` prefix has been removed for all telemetry configurations.
*Impact:*
For any configurations beginning with `xpack.telemetry`, remove the `xpack` prefix. Use {kibana-ref}/telemetry-settings-kbn.html#telemetry-general-settings[`telemetry.enabled`] instead.
[float]
=== SysV init support has been removed
*Details:*
All supported operating systems support using systemd service files. Any system that doesn't already have service aliased to use kibana.service should use `systemctl start kibana.service` instead of the `service start kibana`.
*Impact:*
Any installations using `.deb` or `.rpm` packages using SysV will need to migrate to systemd.
// end::notable-breaking-changes[]

View file

@ -1,20 +0,0 @@
==== Run {kib} with SysV `init`
Use the `update-rc.d` command to configure Kibana to start automatically
when the system boots up:
[source,sh]
--------------------------------------------------
sudo update-rc.d kibana defaults 95 10
--------------------------------------------------
You can start and stop Kibana using the `service` command:
[source,sh]
--------------------------------------------
sudo -i service kibana start
sudo -i service kibana stop
--------------------------------------------
If Kibana fails to start for any reason, it will print the reason for
failure to `STDOUT`. Log files can be found in `/var/log/kibana/`.

View file

@ -160,15 +160,7 @@ https://artifacts.elastic.co/downloads/kibana/kibana-oss-{version}-amd64.deb
endif::[]
==== SysV `init` vs `systemd`
include::init-systemd.asciidoc[]
[[deb-running-init]]
include::deb-init.asciidoc[]
[[deb-running-systemd]]
include::systemd.asciidoc[]
[[deb-configuring]]

View file

@ -1,20 +0,0 @@
==== Run {kib} with SysV `init`
Use the `chkconfig` command to configure Kibana to start automatically
when the system boots up:
[source,sh]
--------------------------------------------------
sudo chkconfig --add kibana
--------------------------------------------------
You can start and stop Kibana using the `service` command:
[source,sh]
--------------------------------------------
sudo -i service kibana start
sudo -i service kibana stop
--------------------------------------------
If Kibana fails to start for any reason, it will print the reason for
failure to `STDOUT`. Log files can be found in `/var/log/kibana/`.

View file

@ -153,13 +153,6 @@ https://artifacts.elastic.co/downloads/kibana/kibana-oss-{version}-x86_64.rpm
endif::[]
==== SysV `init` vs `systemd`
include::init-systemd.asciidoc[]
[[rpm-running-init]]
include::rpm-init.asciidoc[]
[[rpm-running-systemd]]
include::systemd.asciidoc[]

View file

@ -25,25 +25,8 @@ stop and start {kib} from the command line.
include::install/windows-running.asciidoc[]
[float]
[[start-stop-deb]]
=== Debian packages
include::install/init-systemd.asciidoc[]
[float]
include::install/deb-init.asciidoc[]
[float]
include::install/systemd.asciidoc[]
[float]
[[start-stop-rpm]]
=== RPM packages
include::install/init-systemd.asciidoc[]
[float]
include::install/rpm-init.asciidoc[]
[[start-stop-deb-rpm]]
=== Debian and RPM packages
[float]
include::install/systemd.asciidoc[]

View file

@ -134,7 +134,6 @@ export async function runFpm(
`${resolveWithTrailingSlash(fromBuild('data'))}=/var/lib/kibana/`,
// copy package configurations
`${resolveWithTrailingSlash(__dirname, 'service_templates/sysv/')}=/`,
`${resolveWithTrailingSlash(__dirname, 'service_templates/systemd/')}=/`,
];

View file

@ -1,174 +0,0 @@
#!/bin/sh
# Init script for kibana
# Maintained by
# Generated by pleaserun.
# Implemented based on LSB Core 3.1:
# * Sections: 20.2, 20.3
#
### BEGIN INIT INFO
# Provides: kibana
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description:
# Description: Kibana
### END INIT INFO
#
# Source function libraries if present.
# (It improves integration with systemd)
#
# Red Hat
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
# Debian
elif [ -f /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions
# SUSE
elif [ -f /etc/rc.status ]; then
. /etc/rc.status
rc_reset
fi
name=kibana
program=/usr/share/kibana/bin/kibana
args="--logging.dest=/var/log/kibana/kibana.log"
pidfile="/var/run/kibana/$name.pid"
[ -r /etc/default/$name ] && . /etc/default/$name
[ -r /etc/sysconfig/$name ] && . /etc/sysconfig/$name
export KBN_PATH_CONF
export NODE_OPTIONS
[ -z "$nice" ] && nice=0
trace() {
logger -t "/etc/init.d/kibana" "$@"
}
emit() {
trace "$@"
echo "$@"
}
start() {
[ ! -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 "
cd \"$chdir\"
exec \"$program $args\"
" >> /var/log/kibana/kibana.log 2>&1 &
# Generate the pidfile from here. If we instead made the forked process
# generate it there will be a race condition between the pidfile writing
# and a process possibly asking for status.
echo $! > $pidfile
emit "$name started"
return 0
}
stop() {
# Try a few times to kill TERM the program
if status ; then
pid=$(cat "$pidfile")
trace "Killing $name (pid $pid) with SIGTERM"
kill -TERM $pid
# Wait for it to exit.
for i in 1 2 3 4 5 ; do
trace "Waiting $name (pid $pid) to die..."
status || break
sleep 1
done
if status ; then
if [ "$KILL_ON_STOP_TIMEOUT" -eq 1 ] ; then
trace "Timeout reached. Killing $name (pid $pid) with SIGKILL. This may result in data loss."
kill -KILL $pid
emit "$name killed with SIGKILL."
else
emit "$name stop failed; still running."
fi
else
emit "$name stopped."
fi
fi
}
status() {
if [ -f "$pidfile" ] ; then
pid=$(cat "$pidfile")
if ps -p $pid > /dev/null 2> /dev/null ; then
# process by this pid is running.
# It may not be our pid, but that's what you get with just pidfiles.
# TODO(sissel): Check if this process seems to be the same as the one we
# expect. It'd be nice to use flock here, but flock uses fork, not exec,
# so it makes it quite awkward to use in this case.
return 0
else
return 2 # program is dead but pid file exists
fi
else
return 3 # program is not running
fi
}
force_stop() {
if status ; then
stop
status && kill -KILL $(cat "$pidfile")
fi
}
case "$1" in
force-start|start|stop|force-stop|restart)
trace "Attempting '$1' on kibana"
;;
esac
case "$1" in
force-start)
PRESTART=no
exec "$0" start
;;
start)
status
code=$?
if [ $code -eq 0 ]; then
emit "$name is already running"
exit $code
else
start
exit $?
fi
;;
stop) stop ;;
force-stop) force_stop ;;
status)
status
code=$?
if [ $code -eq 0 ] ; then
emit "$name is running"
else
emit "$name is not running"
fi
exit $code
;;
restart)
stop && start
;;
*)
echo "Usage: $SCRIPTNAME {start|force-start|stop|force-start|force-stop|status|restart}" >&2
exit 3
;;
esac
exit $?