Revert/clean up broken changes to allow redis to work at all on systemd.

This commit is contained in:
Warren Togami 2014-07-29 03:19:28 -10:00
parent 46ea918a98
commit 01c0789b60
5 changed files with 47 additions and 55 deletions

View File

@ -1,13 +1,7 @@
Index: redis-2.8.11/redis.conf
===================================================================
--- redis-2.8.11.orig/redis.conf
+++ redis-2.8.11/redis.conf
@@ -34,11 +34,11 @@
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
-daemonize no
+daemonize yes
diff -urN redis-2.8.13.orig/redis.conf redis-2.8.13/redis.conf
--- redis-2.8.13.orig/redis.conf 2014-07-14 05:48:14.000000000 -1000
+++ redis-2.8.13/redis.conf 2014-07-29 02:35:49.053847503 -1000
@@ -38,7 +38,7 @@
# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
# default. You can specify a custom pid file location here.
@ -16,7 +10,7 @@ Index: redis-2.8.11/redis.conf
# Accept connections on the specified port, default is 6379.
# If port 0 is specified Redis will not listen on a TCP socket.
@@ -61,7 +61,7 @@ tcp-backlog 511
@@ -61,7 +61,7 @@
# Examples:
#
# bind 192.168.1.100 10.0.0.1
@ -25,16 +19,7 @@ Index: redis-2.8.11/redis.conf
# Specify the path for the Unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen
@@ -87,7 +87,7 @@ timeout 0
# On other kernels the period depends on the kernel configuration.
#
# A reasonable value for this option is 60 seconds.
-tcp-keepalive 0
+tcp-keepalive 60
# Specify the server verbosity level.
# This can be one of:
@@ -100,7 +100,7 @@ loglevel notice
@@ -100,7 +100,7 @@
# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
@ -43,7 +28,7 @@ Index: redis-2.8.11/redis.conf
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
@@ -184,7 +184,7 @@ dbfilename dump.rdb
@@ -184,7 +184,7 @@
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.

View File

@ -3,7 +3,6 @@ Description=Redis Sentinel
After=network.target
[Service]
ExecStartPre=/usr/bin/mkdir -p /var/lib/redis
ExecStart=/usr/bin/redis-sentinel /etc/sentinel.conf
ExecStop=/usr/bin/redis-cli shutdown
User=redis

View File

@ -8,11 +8,10 @@
# Source function library.
. /etc/rc.d/init.d/functions
NAME="redis-server"
EXEC="/usr/bin/$NAME"
name="redis-server"
exec="/usr/sbin/$name"
pidfile="/var/run/redis/redis.pid"
REDIS_CONFIG="/etc/redis.conf"
RUNDIR="/var/run/redis"
PIDFILE="$RUNDIR/redis.pid"
[ -e /etc/sysconfig/redis ] && . /etc/sysconfig/redis
@ -20,13 +19,9 @@ lockfile=/var/lock/subsys/redis
start() {
[ -f $REDIS_CONFIG ] || exit 6
[ -x $EXEC ] || exit 5
echo -n $"Starting $NAME: "
mkdir -p $RUNDIR
touch $PIDFILE
chown redis:redis $RUNDIR $PIDFILE
chmod 750 $RUNDIR
daemon --user ${REDIS_USER-redis} "$EXEC $REDIS_CONFIG"
[ -x $exec ] || exit 5
echo -n $"Starting $name: "
daemon --user ${REDIS_USER-redis} "$exec $REDIS_CONFIG"
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
@ -34,8 +29,8 @@ start() {
}
stop() {
echo -n $"Stopping $NAME: "
killproc -p $PIDFILE $NAME
echo -n $"Stopping $name: "
killproc -p $pidfile $name
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
@ -52,7 +47,7 @@ reload() {
}
rh_status() {
status -p $PIDFILE $NAME
status -p $pidfile $name
}
rh_status_q() {

View File

@ -3,11 +3,10 @@ Description=Redis persistent key-value database
After=network.target
[Service]
ExecStartPre=/usr/bin/mkdir -p /var/lib/redis
ExecStart=/usr/bin/redis-server /etc/redis.conf
ExecStop=/usr/bin/redis-cli shutdown
User=redis
Group=redis
[Install]
WantedBy=multi-user.target

View File

@ -2,7 +2,9 @@
%global with_perftools 0
# Prior to redis 2.8 sentinel didn't work correctly.
# redis 2.8 sentinel is the first upstream version to work
# however as packaged here it is entirely broken
# FIXME: consider removal into a separate package
%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7
%global with_sentinel 1
%endif
@ -22,19 +24,19 @@
Name: redis
Version: 2.8.13
Release: 2%{?dist}
Release: 3%{?dist}
Summary: A persistent caching system, key-value and data structures database
License: BSD
URL: http://redis.io
Source0: http://download.redis.io/releases/%{name}-%{version}.tar.gz
Source1: %{name}.logrotate
Source2: %{name}-sentinel.service
Source3: %{name}-server.service
Source3: %{name}.service
Source4: %{name}.tmpfiles
Source5: %{name}-sentinel.init
Source6: %{name}-server.init
Source6: %{name}.init
# Update configuration for Fedora
Patch0: redis-2.8.11-redis-conf-location-variables.patch
Patch0: redis-2.8.11-redis-conf.patch
Patch1: redis-2.8.11-deps-library-fPIC-performance-tuning.patch
Patch2: redis-2.8.11-use-system-jemalloc.patch
# tests/integration/replication-psync.tcl failed on slow machines(GITHUB #1417)
@ -157,7 +159,7 @@ install -pDm644 %{S:4} %{buildroot}%{_tmpfilesdir}/%{name}.conf
%if 0%{?with_sentinel}
install -pDm755 %{S:5} %{buildroot}%{_initrddir}/%{name}-sentinel
%endif
install -pDm755 %{S:6} %{buildroot}%{_initrddir}/%{name}-server
install -pDm755 %{S:6} %{buildroot}%{_initrddir}/%{name}
%endif
# Fix non-standard-executable-perm error.
@ -183,12 +185,12 @@ exit 0
%if 0%{?with_sentinel}
%systemd_post %{name}-sentinel.service
%endif
%systemd_post %{name}-server.service
%systemd_post %{name}.service
%else
%if 0%{?with_sentinel}
chkconfig --add %{name}-sentinel
%endif
chkconfig --add %{name}-server
chkconfig --add %{name}
%endif
%preun
@ -196,15 +198,15 @@ chkconfig --add %{name}-server
%if 0%{?with_sentinel}
%systemd_preun %{name}-sentinel.service
%endif
%systemd_preun %{name}-server.service
%systemd_preun %{name}.service
%else
if [ $1 -eq 0 ] ; then
%if 0%{?with_sentinel}
service %{name}-sentinel stop &> /dev/null
chkconfig --del %{name}-sentinel &> /dev/null
%endif
service %{name}-server stop &> /dev/null
chkconfig --del %{name}-server &> /dev/null
service %{name} stop &> /dev/null
chkconfig --del %{name} &> /dev/null
%endif
%postun
@ -212,13 +214,13 @@ chkconfig --del %{name}-server &> /dev/null
%if 0%{?with_sentinel}
%systemd_postun_with_restart %{name}-sentinel.service
%endif
%systemd_postun_with_restart %{name}-server.service
%systemd_postun_with_restart %{name}.service
%else
if [ "$1" -ge "1" ] ; then
%if 0%{?with_sentinel}
service %{name}-sentinel condrestart >/dev/null 2>&1 || :
%endif
service %{name}-server condrestart >/dev/null 2>&1 || :
service %{name} condrestart >/dev/null 2>&1 || :
fi
%endif
@ -231,22 +233,34 @@ fi
%endif
%dir %attr(0750, redis, redis) %{_sharedstatedir}/%{name}
%dir %attr(0750, redis, redis) %{_localstatedir}/log/%{name}
%ghost %dir %attr(0750, redis, redis) %{_localstatedir}/run/%{name}
%dir %attr(0750, redis, redis) %{_localstatedir}/run/%{name}
%{_bindir}/%{name}-*
%if 0%{?with_systemd}
%{_tmpfilesdir}/%{name}.conf
%if 0%{?with_sentinel}
%{_unitdir}/%{name}-sentinel.service
%endif
%{_unitdir}/%{name}-server.service
%{_unitdir}/%{name}.service
%else
%if 0%{?with_sentinel}
%{_initrddir}/%{name}-sentinel
%endif
%{_initrddir}/%{name}-server
%{_initrddir}/%{name}
%endif
%changelog
* Tue Jul 29 2014 Warren Togami <warren@slickage.com> - 2.8.13-3
- Revert rename redis.service to redis-server (4 years as packaged service name).
- Revert "daemonize yes" in default redis.conf
systemd handles background and process tracking on its own, this broke systemd launch.
- Revert redis.init as it too handled daemonizing.
- Revert tcp-keepalive default to 0.
- Revert ExecStartPre hack, /var/lib/redis is owned by the package.
No %ghost directories, just own it.
- FIXME: sentinel is broken, mispackaged and quite possibly belongs in an entirely separate package
because it is not meant to be used concurrently with the ordinary systemd redis and it requires
a highly specialized custom configuration.
* Wed Jul 23 2014 Warren Togami <warren@slickage.com> - 2.8.13-2
- Fix detection of EL7: systemd unit was missing
- Fix detection of EL5