diff --git a/README.SUSE b/README.SUSE new file mode 100644 index 0000000..18b7b10 --- /dev/null +++ b/README.SUSE @@ -0,0 +1,29 @@ + README.SUSE +------------- + +1. copy /etc/redis/default.conf.example to /etc/redis/default.conf (or + /etc/redis/otherapp.conf and so on) For the example we will use + otherapp.conf + +2. change at least pidfile, logfile and dir setting +# the pid file *has* to match your config filename without the ".conf" +pidfile /var/run/redis/otherapp.pid +logfile /var/log/redis/otherapp.log +dir /var/lib/redis/otherapp/ + +If you want to run more than one instance you also have to change the +socket path and/or the ip:port combination. + +Also make sure if you copy configurations from somewhere, that "daemonize" +should be set to "no". + +3. create the database dir: +$ install -d -m redis -g redis -m 0750 /var/lib/redis/otherapp/ + +4. systemctl start redis@otherapp +5. systemctl enable redis@otherapp + +6. to interact with all instances at the same time use: + +systemctl restart redis.target +systemctl stop redis.target diff --git a/redis-2.8.18.tar.gz b/redis-2.8.18.tar.gz deleted file mode 100644 index e334085..0000000 --- a/redis-2.8.18.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:aa86eab586e4133728396273b671efae35dd70bdcc746e4e3f986e7600d0050d -size 1254077 diff --git a/redis-2.8.19.tar.gz b/redis-2.8.19.tar.gz new file mode 100644 index 0000000..2d0def2 --- /dev/null +++ b/redis-2.8.19.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29bb08abfc3d392b2f0c3e7f48ec46dd09ab1023f9a5575fc2a93546f4ca5145 +size 1254857 diff --git a/redis.changes b/redis.changes index f7dcfc6..ba44667 100644 --- a/redis.changes +++ b/redis.changes @@ -1,3 +1,48 @@ +------------------------------------------------------------------- +Wed Apr 1 16:31:16 UTC 2015 - mrueckert@suse.de + +- make sure we do not daemonize + +------------------------------------------------------------------- +Wed Apr 1 15:57:59 UTC 2015 - mrueckert@suse.de + +- finished systemd support + +------------------------------------------------------------------- +Mon Mar 30 19:16:52 UTC 2015 - mrueckert@suse.de + +- update to 2.8.19 + - Don't log admin commands in MONITOR. (antirez) + - List of commands flagged as admin commands modified. (antirez) + - Lua cmsgpack lib updated to latest version. (antirez) + - Add symlink to redis-sentinel during make install (Rhommel + Lamas) + - SORT: Don't sort Set elements if not needed. (antirez) + - Fix zero-ordering SORT when called against lists (Matt + Stancliff) + - Update redis_init_script.tpl (Ben Dowling) + - FIXED redis-benchmark's idle mode.With idle mode shouldn't + create write event (zhanghailei) + - zipmap.c: update comments above (Sun He) + - replaced // comments #2150 (Deepak Verma) + - redis-benchmark AUTH command to be discarded after the first + send #2150 (azure provisioned user) + - sds.c: Correct two spelling mistakes in comments (Sun He) + - sds.c/sdscatvprintf: set va_end to finish va_list cpy (Sun He) + - sds.c: Correct some comments (Sun He) + - Update whatisdoing.sh (Serghei Iakovlev) + - Include stropts only if __sun is defined. (antirez) + - Fix implicit declaration of ioctl on Solaris (Jan-Erik Rediger) + - Silence _BSD_SOURCE warnings in glibc 2.20 and forward (Johan + Bergström) + - Mark whatisdoing.sh as deprecated in top-comment. (antirez) + - getting pid fixes (Serghei Iakovlev) + - sparkline.c: AddSample skip Empty label (Sun He) + - sparkline.c: mov label-ini into the AddSample Function (Sun He) + - Only ignore sigpipe in interactive mode (Jan-Erik Rediger) + - Simplify lua_cmsgpack macro and fix build on old Linux distros. + (antirez) + ------------------------------------------------------------------- Thu Feb 12 07:41:34 UTC 2015 - lang@b1-systems.de diff --git a/redis.spec b/redis.spec index ef676c6..7ec6d41 100644 --- a/redis.spec +++ b/redis.spec @@ -15,13 +15,18 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # +%if 0%{?suse_version} > 1230 +%bcond_without systemd +%else +%bcond_with systemd +%endif %define _data_dir %{_localstatedir}/lib/%{name} %define _log_dir %{_localstatedir}/log/%{name} %define _conf_dir %{_sysconfdir}/%{name} Name: redis -Version: 2.8.18 +Version: 2.8.19 Release: 0 Summary: Persistent key-value database License: BSD-3-Clause @@ -29,7 +34,10 @@ Group: Productivity/Databases/Servers Url: http://redis.io/ Source: http://download.redis.io/releases/redis-%{version}.tar.gz Source1: %{name}.logrotate -Source4: redis.sysconfig +Source2: redis.target +Source3: redis@.service +Source4: redis.tmpfiles.d +Source5: README.SUSE # PATCH-FIX-OPENSUSE -- openSUSE-style init script Patch0: %{name}-initscript.patch # PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines @@ -37,6 +45,12 @@ Patch1: %{name}-conf.patch Patch2: redis-enable-bactrace-on-x86-and-ia64-only.patch BuildRequires: procps BuildRequires: tcl +%if %{with systemd} +BuildRequires: pkgconfig(systemd) +%{?systemd_requires} +%else +PreReq: %{insserv_prereq} %{fillup_prereq} +%endif Requires: logrotate Requires: sudo BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -59,22 +73,37 @@ different kind of sorting abilities. make %{?_smp_mflags} CFLAGS="%{optflags}" V=1 %install -install -d %{buildroot}%{_log_dir} %{buildroot}%{_data_dir} %{buildroot}%{_conf_dir} -install -d %{buildroot}%{_log_dir}/default %{buildroot}%{_data_dir}/default +install -m 0750 -d \ + %{buildroot}%{_log_dir} \ + %{buildroot}%{_data_dir} \ + %{buildroot}%{_conf_dir} \ + %{buildroot}%{_log_dir}/default \ + %{buildroot}%{_data_dir}/default install -D -m 0755 src/redis-benchmark %{buildroot}%{_bindir}/redis-benchmark -install -m 0755 src/redis-cli %{buildroot}%{_bindir}/redis-cli -install -m 0755 src/redis-check-dump %{buildroot}%{_bindir}/redis-check-dump -install -m 0755 src/redis-check-aof %{buildroot}%{_bindir}/redis-check-aof +install -m 0755 src/redis-cli %{buildroot}%{_bindir}/redis-cli +install -m 0755 src/redis-check-dump %{buildroot}%{_bindir}/redis-check-dump +install -m 0755 src/redis-check-aof %{buildroot}%{_bindir}/redis-check-aof install -D -m 0755 src/redis-server %{buildroot}%{_sbindir}/redis-server +%if %{with systemd} +perl -p -i -e 's|daemonize yes|daemonize no|g' redis.conf +%endif install -D -m 0640 redis.conf %{buildroot}%{_conf_dir}/default.conf.example # # init # +%if %{with systemd} +install -D -m 0644 %{S:2} %{buildroot}%{_unitdir}/redis.target +install -D -m 0644 %{S:3} %{buildroot}%{_unitdir}/redis@.service +install -D -m 0644 %{S:4} %{buildroot}/usr/lib/tmpfiles.d/%{name}.conf +%{__ln_s} -f %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name} +cp %{S:5} README.SUSE +%else install -D -m 0755 utils/redis_init_script %{buildroot}%{_sysconfdir}/init.d/redis ln -s %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name} +%endif # # logrotate @@ -95,21 +124,36 @@ make test && true %pre /usr/sbin/groupadd -r %{name} >/dev/null 2>&1 || : /usr/sbin/useradd -g %{name} -s /bin/false -r -c "User for Redis key-value store" -d %{_data_dir} %{name} >/dev/null 2>&1 || : +%if %{with systemd} +%service_add_pre %{name}.target +%endif %post -%fillup_and_insserv %{name} -%restart_on_update %{name} +%if %{with systemd} +systemd-tmpfiles --create /usr/lib/tmpfiles.d/%{name}.conf || true +%service_add_post %{name}.target +echo "See /usr/share/doc/packages/redis/README.SUSE to continue" +%else echo "To start the database server, create your configuration" echo "starting from /etc/redis/default.conf.example, place it" echo "in /etc/redis and do: " echo " sudo rcredis start; sudo chkconfig redis on" +%endif %preun +%if %{with systemd} +%service_del_preun %{name}.target +%else %stop_on_removal %{name} +%endif %postun -%restart_on_update +%if %{with systemd} +%service_del_postun %{name}.target +%else +%restart_on_update %{name} %insserv_cleanup +%endif %files %defattr(-,root,root,-) @@ -118,11 +162,18 @@ echo " sudo rcredis start; sudo chkconfig redis on" %{_bindir}/redis-* %{_sbindir}/redis-* %{_sbindir}/rc%{name} -%config(noreplace) %{_sysconfdir}/init.d/redis -%config(noreplace) %attr(0640, %{name}, %{name}) %{_conf_dir}/default.conf.example +%if %{with systemd} +/usr/lib/tmpfiles.d/%{name}.conf +%{_unitdir}/%{name}@.service +%{_unitdir}/%{name}.target +%doc README.SUSE +%else +%config(noreplace) %{_sysconfdir}/init.d/%{name} +%endif +%config(noreplace) %attr(-, root, %{name}) %{_conf_dir}/ +# %dir %attr(0750, %{name}, %{name}) %{_data_dir} %dir %attr(0750, %{name}, %{name}) %{_data_dir}/default %dir %attr(0750, %{name}, %{name}) %{_log_dir} -%dir %attr(0750, %{name}, %{name}) %{_conf_dir} %changelog diff --git a/redis.target b/redis.target new file mode 100644 index 0000000..1980abd --- /dev/null +++ b/redis.target @@ -0,0 +1,3 @@ +[Unit] +Description=Redis target allowing to start/stop all redis@.service instances at once + diff --git a/redis.tmpfiles.d b/redis.tmpfiles.d new file mode 100644 index 0000000..ab18f25 --- /dev/null +++ b/redis.tmpfiles.d @@ -0,0 +1,2 @@ +# Type Path Mode UID GID Age Argument +d /var/run/redis/ 0755 redis redis - - diff --git a/redis@.service b/redis@.service new file mode 100644 index 0000000..d186781 --- /dev/null +++ b/redis@.service @@ -0,0 +1,20 @@ +[Unit] +Description=Redis +After=network.target +PartOf=redis.target + +[Service] +Type=simple +User=redis +Group=redis +PrivateTmp=true +PIDFile=/var/run/redis/%i.pid +ExecStart=/usr/sbin/redis-server /etc/redis/%i.conf +Restart=on-failure + +#ExecStart=/usr/sbin/openvpn --daemon --suppress-timestamps --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --config %i.conf +#ExecReload=/sbin/killproc -p /var/run/openvpn/%i.pid -HUP /usr/sbin/openvpn + +[Install] +WantedBy=multi-user.target redis.target +