File redis.spec of Package redis
Summary: Persistent key-value database with network interface (metapackage)
Name: redis
Version: 6.0.16
Release: 1
Group: Productivity/Networking
License: BSD-3-Clause
URL: https://redis.io
Packager: uib GmbH <info@uib.de>
Source0: redis_%{version}.orig.tar.gz
Source1: redis_%{version}-1.debian.tar.xz
Source2: redis.te
BuildRoot: %{_tmppath}/redis-%{version}-build
BuildArch: x86_64
BuildRequires: gcc
BuildRequires: cmake
BuildRequires: openssl-devel
BuildRequires: systemd
BuildRequires: systemd-devel
BuildRequires: systemd-rpm-macros
BuildRequires: (jemalloc-devel or libjemalloc-dev)
AutoReqProv: no
Requires: checkpolicy
Requires: redis-tools
Requires: redis-server
%description
Redis is an advanced key-value store. It is often referred to as a data
structure server since keys can contain strings, hashes, lists, sets and
sorted sets.
You can run atomic operations on these types, like appending to a string;
incrementing the value in a hash; pushing to a list; computing set
intersection, union and difference; or getting the member with highest
ranking in a sorted set.
In order to achieve its outstanding performance, Redis works with an
in-memory dataset. Depending on your use case, you can persist it either
by dumping the dataset to disk every once in a while, or by appending
each command to a log.
Redis also supports trivial-to-setup master-slave replication, with very
fast non-blocking first synchronization, auto-reconnection on net split
and so forth.
Other features include Transactions, Pub/Sub, Lua scripting, Keys with a
limited time-to-live, and configuration settings to make Redis behave like
a cache.
You can use Redis from most programming languages also.
%package tools
Group: Productivity/Networking
Summary: Persistent key-value database with network interface (client)
%description tools
Redis is a key-value database in a similar vein to memcache but the dataset
is non-volatile. Redis additionally provides native support for atomically
manipulating and querying data structures such as lists and sets.
This package contains the command line client and other tools.
%package server
Group: Productivity/Networking
Summary: Persistent key-value database with network interface
Requires: redis-tools
%description server
Redis is a key-value database in a similar vein to memcache but the dataset
is non-volatile. Redis additionally provides native support for atomically
manipulating and querying data structures such as lists and setsredis.te.
The dataset is stored entirely in memory and periodically flushed to disk.
%package sentinel
Group: Productivity/Networking
Summary: Persistent key-value database with network interface (monitoring)
Requires: redis-tools
%description sentinel
Redis is a key-value database in a similar vein to memcache but the dataset
is non-volatile. Redis additionally provides native support for atomically
manipulating and querying data structures such as lists and sets.
This package contains the Redis Sentinel monitoring software.
%clean
%prep
%if 0%{?rhel_version} >= 800 || 0%{?centos_version} >= 800
cp %{_topdir}/SOURCES/redis.te %{_topdir}/BUILD/redis.te
%endif
%setup
%setup -a 1
for p in debian/patches/*.patch; do
patch -p1 $p
done
./debian/bin/generate-systemd-service-files
ls -la 1>&2
mv deps/lua/COPYRIGHT COPYRIGHT-lua
mv deps/hiredis/COPYING COPYING-hiredis
# Configuration file changes
sed -i -e 's|^logfile .*$|logfile /var/log/redis/redis-server.log|g' redis.conf
sed -i -e 's|^logfile .*$|logfile /var/log/redis/redis-sentinel.log|g' sentinel.conf
sed -i -e 's|^dir .*$|dir /var/lib/redis|g' redis.conf
%global make_flags DEBUG="" V="echo" LDFLAGS="%{?__global_ldflags}" CFLAGS+="%{optflags} -fPIC" INSTALL="install -p" PREFIX=%{buildroot}%{_prefix} BUILD_WITH_SYSTEMD=yes BUILD_TLS=yes
%build
make %{?_smp_mflags} %{make_flags} all
%install
make %{make_flags} install
mkdir -p %{buildroot}/var/log/redis
mkdir -p %{buildroot}/var/lib/redis
install -p -D -m 644 debian/redis-server.logrotate %{buildroot}/etc/logrotate.d/redis-server.logrotate
install -p -D -m 644 debian/redis-sentinel.logrotate %{buildroot}/etc/logrotate.d/redis-sentinel.logrotate
install -p -D -m 640 redis.conf %{buildroot}/etc/redis/redis.conf
install -p -D -m 640 sentinel.conf %{buildroot}/etc/redis/redis-sentinel.conf
# Systemd
install -p -D -m 0644 debian/redis-server.service %{buildroot}%{_unitdir}/redis-server.service
install -p -D -m 0644 debian/redis-sentinel.service %{buildroot}%{_unitdir}/redis-sentinel.service
%if 0%{?rhel_version} >= 800 || 0%{?centos_version} >= 800
install -p -D -m 755 ../redis.te %{buildroot}/etc/redis/redis.te
%endif
%files tools
/usr/bin/redis-benchmark
/usr/bin/redis-check-aof
/usr/bin/redis-check-rdb
/usr/bin/redis-cli
%files server
/usr/bin/redis-server
%config(noreplace) /etc/logrotate.d/redis-server.logrotate
%attr(0640, redis, root) %config(noreplace) /etc/redis/redis.conf
%{_unitdir}/redis-server.service
%dir %attr(0755, root, root) /etc/redis
%dir %attr(0750, redis, redis) /var/log/redis
%dir %attr(0755, redis, redis) /var/lib/redis
%if 0%{?rhel_version} >= 800 || 0%{?centos_version} >= 800
%attr(0755, root, root) /etc/redis/redis.te
%endif
%files sentinel
/usr/bin/redis-sentinel
%config(noreplace) /etc/logrotate.d/redis-sentinel.logrotate
%attr(0640, redis, root) %config(noreplace) /etc/redis/redis-sentinel.conf
%{_unitdir}/redis-sentinel.service
%dir %attr(0755, root, root) /etc/redis
%dir %attr(0750, redis, redis) /var/log/redis
%dir %attr(0755, redis, redis) /var/lib/redis
%pre server
getent group redis >/dev/null 1>&2 || \
groupadd -r redis
getent passwd redis >/dev/null 1>&2 || \
useradd -r -g redis -d /var/lib/redis -s /sbin/nologin \
-c 'Redis Database Server' redis
%post server
%if 0%{?rhel_version} >= 800 || 0%{?centos_version} >= 800
checkmodule -M -m -o /etc/redis/redis.mod /etc/redis/redis.te
semodule_package -o /etc/redis/redis.pp -m /etc/redis/redis.mod
semodule -i /etc/redis/redis.pp
restorecon -R -v /var/log/redis
restorecon -R -v /var/lib/redis
restorecon -R -v /var/run/redis
%endif
%systemd_post redis-server.service
echo "enable redis-server.service"
systemctl enable redis-server.service
%post sentinel
%systemd_post redis-sentinel.service
echo "enable redis-sentinel.service"
systemctl enable redis-sentinel.service
%preun server
%systemd_preun redis-server.service
%preun sentinel
%systemd_preun redis-sentinel.service
%postun server
%systemd_postun_with_restart redis-server.service
%postun sentinel
%systemd_postun_with_restart redis-sentinel.service