diff --git a/redis-limit-init b/redis-limit-init deleted file mode 100644 index 2986bfd..0000000 --- a/redis-limit-init +++ /dev/null @@ -1,6 +0,0 @@ -# If you need to change max open file limit -# for example, when you change maxclient in configuration -# you can change the value below -# see "man limits.conf" for information -redis soft nofile 10240 -redis hard nofile 10240 diff --git a/redis-sentinel.init b/redis-sentinel.init deleted file mode 100644 index 382d45d..0000000 --- a/redis-sentinel.init +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/sh -# -# redis init file for starting up the redis-sentinel daemon -# -# chkconfig: - 21 79 -# description: Starts and stops the redis-sentinel daemon. -# -### BEGIN INIT INFO -# Provides: redis-sentinel -# Required-Start: $local_fs $remote_fs $network -# Required-Stop: $local_fs $remote_fs $network -# Short-Description: start and stop Sentinel server -# Description: A persistent key-value database -### END INIT INFO - -# Source function library. -. /etc/rc.d/init.d/functions - -name="redis-sentinel" -exec="/usr/bin/$name" -shut="/usr/libexec/redis-shutdown" -pidfile="/var/run/redis/sentinel.pid" -SENTINEL_CONFIG="/etc/redis-sentinel.conf" - -[ -e /etc/sysconfig/redis-sentinel ] && . /etc/sysconfig/redis-sentinel - -lockfile=/var/lock/subsys/redis - -start() { - [ -f $SENTINEL_CONFIG ] || exit 6 - [ -x $exec ] || exit 5 - echo -n $"Starting $name: " - daemon --user ${REDIS_USER-redis} "$exec $SENTINEL_CONFIG --daemonize yes --pidfile $pidfile" - retval=$? - echo - [ $retval -eq 0 ] && touch $lockfile - return $retval -} - -stop() { - echo -n $"Stopping $name: " - [ -x $shut ] && $shut $name - retval=$? - if [ -f $pidfile ] - then - # shutdown haven't work, try old way - killproc -p $pidfile $name - retval=$? - else - success "$name shutdown" - fi - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval -} - -restart() { - stop - start -} - -rh_status() { - status -p $pidfile $name -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - - -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}" - exit 2 -esac -exit $? diff --git a/redis-sentinel.service b/redis-sentinel.service index d5eeb98..a055cf5 100644 --- a/redis-sentinel.service +++ b/redis-sentinel.service @@ -5,8 +5,8 @@ After=network-online.target Wants=network-online.target [Service] -ExecStart=/usr/bin/redis-sentinel /etc/redis-sentinel.conf --daemonize no --supervised systemd -ExecStop=/usr/libexec/redis-shutdown redis-sentinel +ExecStart=/usr/bin/redis-sentinel /etc/redis/sentinel.conf --daemonize no --supervised systemd +ExecStop=/usr/libexec/redis-shutdown sentinel Type=notify User=redis Group=redis diff --git a/redis-shutdown b/redis-shutdown index 53b9f09..1a4335a 100644 --- a/redis-shutdown +++ b/redis-shutdown @@ -12,7 +12,7 @@ if [ -z "$SERVICE_NAME" ]; then fi # Get the proper config file based on service name -CONFIG_FILE="/etc/$SERVICE_NAME.conf" +CONFIG_FILE="/etc/redis/$SERVICE_NAME.conf" # Use awk to retrieve host, port from config file HOST=`awk '/^[[:blank:]]*bind/ { print $2 }' $CONFIG_FILE | tail -n1` diff --git a/redis.init b/redis.init deleted file mode 100644 index 7f1ef6a..0000000 --- a/redis.init +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/sh -# -# redis init file for starting up the redis daemon -# -# chkconfig: - 20 80 -# description: Starts and stops the redis daemon. -# -### BEGIN INIT INFO -# Provides: redis-server -# Required-Start: $local_fs $remote_fs $network -# Required-Stop: $local_fs $remote_fs $network -# Short-Description: start and stop Redis server -# Description: A persistent key-value database -### END INIT INFO - -# Source function library. -. /etc/rc.d/init.d/functions - -name="redis-server" -exec="/usr/bin/$name" -shut="/usr/libexec/redis-shutdown" -pidfile="/var/run/redis/redis.pid" -REDIS_CONFIG="/etc/redis.conf" - -[ -e /etc/sysconfig/redis ] && . /etc/sysconfig/redis - -lockfile=/var/lock/subsys/redis - -start() { - [ -f $REDIS_CONFIG ] || exit 6 - [ -x $exec ] || exit 5 - echo -n $"Starting $name: " - daemon --user ${REDIS_USER-redis} "$exec $REDIS_CONFIG --daemonize yes --pidfile $pidfile" - retval=$? - echo - [ $retval -eq 0 ] && touch $lockfile - return $retval -} - -stop() { - echo -n $"Stopping $name: " - [ -x $shut ] && $shut - retval=$? - if [ -f $pidfile ] - then - # shutdown haven't work, try old way - killproc -p $pidfile $name - retval=$? - else - success "$name shutdown" - fi - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval -} - -restart() { - stop - start -} - -rh_status() { - status -p $pidfile $name -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - - -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}" - exit 2 -esac -exit $? diff --git a/redis.service b/redis.service index 074d8ec..4e59720 100644 --- a/redis.service +++ b/redis.service @@ -5,7 +5,7 @@ After=network-online.target Wants=network-online.target [Service] -ExecStart=/usr/bin/redis-server /etc/redis.conf --daemonize no --supervised systemd +ExecStart=/usr/bin/redis-server /etc/redis/redis.conf --daemonize no --supervised systemd ExecStop=/usr/libexec/redis-shutdown Type=notify User=redis diff --git a/redis.spec b/redis.spec index 9f69d99..4dfe5bd 100644 --- a/redis.spec +++ b/redis.spec @@ -20,7 +20,7 @@ Name: redis Version: 6.0.9 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A persistent key-value database # redis, jemalloc, linenoise, lzf, hiredis are BSD # lua is MIT @@ -30,11 +30,8 @@ Source0: https://download.redis.io/releases/%{name}-%{version}.tar.gz Source1: %{name}.logrotate Source2: %{name}-sentinel.service Source3: %{name}.service -Source4: %{name}-sentinel.init -Source5: %{name}.init Source6: %{name}-shutdown Source7: %{name}-limit-systemd -Source8: %{name}-limit-init Source9: macros.%{name} Source10: https://github.com/antirez/%{name}-doc/archive/%{doc_commit}/%{name}-doc-%{short_doc_commit}.tar.gz @@ -169,8 +166,8 @@ install -d %{buildroot}%{redis_modules_dir} install -pDm644 %{S:1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} # Install configuration files. -install -pDm640 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}.conf -install -pDm640 sentinel.conf %{buildroot}%{_sysconfdir}/%{name}-sentinel.conf +install -pDm640 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf +install -pDm640 sentinel.conf %{buildroot}%{_sysconfdir}/%{name}/sentinel.conf # Install systemd unit files. mkdir -p %{buildroot}%{_unitdir} @@ -228,6 +225,25 @@ useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin \ exit 0 %post +if [ -f %{_sysconfdir}/%{name}.conf ]; then + if [ -f %{_sysconfdir}/%{name}/%{name}.conf.rpmnew ]; then + rm %{_sysconfdir}/%{name}/%{name}.conf.rpmnew + fi + if [ -f %{_sysconfdir}/%{name}/%{name}.conf ]; then + mv %{_sysconfdir}/%{name}/%{name}.conf %{_sysconfdir}/%{name}/%{name}.conf.rpmnew + fi + mv %{_sysconfdir}/%{name}.conf %{_sysconfdir}/%{name}/%{name}.conf + echo -e "\nWarning: %{name} configuration is now in %{_sysconfdir}/%{name} directory\n" +fi +if [ -f %{_sysconfdir}/%{name}-sentinel.conf ]; then + if [ -f %{_sysconfdir}/%{name}/sentinel.conf.rpmnew ]; then + rm %{_sysconfdir}/%{name}/sentinel.conf.rpmnew + fi + if [ -f %{_sysconfdir}/%{name}/sentinel.conf ]; then + mv %{_sysconfdir}/%{name}/sentinel.conf %{_sysconfdir}/%{name}/sentinel.conf.rpmnew + fi + mv %{_sysconfdir}/%{name}-sentinel.conf %{_sysconfdir}/%{name}/sentinel.conf +fi %systemd_post %{name}.service %systemd_post %{name}-sentinel.service @@ -246,8 +262,9 @@ exit 0 %license COPYING-jemalloc %license COPYING-hiredis %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} -%attr(0640, redis, root) %config(noreplace) %{_sysconfdir}/%{name}.conf -%attr(0640, redis, root) %config(noreplace) %{_sysconfdir}/%{name}-sentinel.conf +%attr(0750, redis, root) %dir %{_sysconfdir}/%{name} +%attr(0640, redis, root) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf +%attr(0640, redis, root) %config(noreplace) %{_sysconfdir}/%{name}/sentinel.conf %dir %attr(0750, redis, redis) %{_libdir}/%{name} %dir %attr(0750, redis, redis) %{redis_modules_dir} %dir %attr(0750, redis, redis) %{_sharedstatedir}/%{name} @@ -281,6 +298,10 @@ exit 0 %changelog +* Mon Nov 23 2020 Remi Collet - 6.0.9-2 +- move configuration in /etc/redis per upstream recommendation + see https://github.com/redis/redis/issues/8051 + * Tue Oct 27 2020 Remi Collet - 6.0.9-1 - Upstream 6.0.9 release.