diff --git a/redis-2.8.11-redis-conf-location-variables.patch b/redis-2.8.11-redis-conf.patch similarity index 62% rename from redis-2.8.11-redis-conf-location-variables.patch rename to redis-2.8.11-redis-conf.patch index 47e70f3..9c1c0c6 100644 --- a/redis-2.8.11-redis-conf-location-variables.patch +++ b/redis-2.8.11-redis-conf.patch @@ -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. diff --git a/redis-sentinel.service b/redis-sentinel.service index f71e33a..b58ccae 100644 --- a/redis-sentinel.service +++ b/redis-sentinel.service @@ -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 diff --git a/redis-server.init b/redis.init similarity index 74% rename from redis-server.init rename to redis.init index 0a3d318..14fad01 100644 --- a/redis-server.init +++ b/redis.init @@ -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() { diff --git a/redis-server.service b/redis.service similarity index 70% rename from redis-server.service rename to redis.service index a8411b1..4001e2d 100644 --- a/redis-server.service +++ b/redis.service @@ -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 + diff --git a/redis.spec b/redis.spec index a3a2207..c59f570 100644 --- a/redis.spec +++ b/redis.spec @@ -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 - 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 - 2.8.13-2 - Fix detection of EL7: systemd unit was missing - Fix detection of EL5