summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--redis-sentinel.service14
-rw-r--r--redis.logrotate9
-rw-r--r--redis.service15
-rw-r--r--redis.spec78
-rw-r--r--sources1
6 files changed, 118 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..9822e19 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/redis-6.2.5.tar.gz
diff --git a/redis-sentinel.service b/redis-sentinel.service
new file mode 100644
index 0000000..5e8ae1c
--- /dev/null
+++ b/redis-sentinel.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Redis Sentinel
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/redis-sentinel /etc/redis-sentinel.conf --supervised systemd
+Type=notify
+User=redis
+Group=redis
+RuntimeDirectory=redis
+RuntimeDirectoryMode=0755
+
+[Install]
+WantedBy=multi-user.target
diff --git a/redis.logrotate b/redis.logrotate
new file mode 100644
index 0000000..3a3d185
--- /dev/null
+++ b/redis.logrotate
@@ -0,0 +1,9 @@
+/var/log/redis/*.log {
+ weekly
+ rotate 10
+ copytruncate
+ delaycompress
+ compress
+ notifempty
+ missingok
+}
diff --git a/redis.service b/redis.service
new file mode 100644
index 0000000..e4eff49
--- /dev/null
+++ b/redis.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Redis persistent key-value database
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/redis-server /etc/redis.conf --supervised systemd
+Type=notify
+User=redis
+Group=redis
+RuntimeDirectory=redis
+RuntimeDirectoryMode=0755
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/redis.spec b/redis.spec
new file mode 100644
index 0000000..3f63ad7
--- /dev/null
+++ b/redis.spec
@@ -0,0 +1,78 @@
+Name: redis
+Version: 6.2.5
+Release: 1
+Summary: A persistent key-value database
+License: BSD-3-Clause and MIT
+URL: https://redis.io
+Source0: http://download.redis.io/releases/%{name}-%{version}.tar.gz
+Source1: %{name}.logrotate
+Source2: %{name}-sentinel.service
+Source3: %{name}.service
+
+BuildRequires: systemd gcc
+Requires: /bin/awk
+Requires: logrotate
+Requires(pre): shadow-utils
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
+
+%description
+Redis is an advanced key-value store. It is often referred to as a dattructure server since keys can contain strings, hashes
+,lists, sets anorted sets.
+
+%prep
+%setup
+
+sed -i -e 's|^logfile .*$|logfile /var/log/redis/redis.log|g' redis.conf
+sed -i -e '$ alogfile /var/log/redis/sentinel.log' sentinel.conf
+sed -i -e 's|^dir .*$|dir /var/lib/redis|g' redis.conf
+
+%build
+make
+
+%install
+%make_install PREFIX=%{buildroot}%{_prefix}
+install -d %{buildroot}%{_sharedstatedir}/%{name}
+install -d %{buildroot}%{_localstatedir}/log/%{name}
+install -d %{buildroot}%{_localstatedir}/run/%{name}
+install -d %{buildroot}%{_libdir}/%{name}/modules
+install -pDm644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
+mkdir -p %{buildroot}%{_unitdir}
+install -pm644 %{SOURCE2} %{buildroot}%{_unitdir}
+install -pm644 %{SOURCE3} %{buildroot}%{_unitdir}
+install -pDm640 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}.conf
+install -pDm640 sentinel.conf %{buildroot}%{_sysconfdir}/%{name}-sentinel.conf
+
+%pre
+getent group %{name} &> /dev/null || \
+groupadd -r %{name} &> /dev/null
+getent passwd %{name} &> /dev/null || \
+useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin \
+-c 'Redis Database Server' %{name} &> /dev/null
+exit 0
+
+%post
+%systemd_post %{name}.service
+%systemd_post %{name}-sentinel.service
+
+%preun
+%systemd_preun %{name}.service
+%systemd_preun %{name}-sentinel.service
+
+%postun
+%systemd_postun_with_restart %{name}.service
+%systemd_postun_with_restart %{name}-sentinel.service
+
+
+%files
+%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
+%dir %attr(0750, redis, redis) %{_libdir}/%{name}
+%dir %attr(0750, redis, redis) %{_libdir}/%{name}/modules
+%dir %attr(0750, redis, redis) %{_sharedstatedir}/%{name}
+%dir %attr(0750, redis, redis) %{_localstatedir}/log/%{name}
+%{_bindir}/%{name}-*
+%{_unitdir}/%{name}.service
+%{_unitdir}/%{name}-sentinel.service
diff --git a/sources b/sources
new file mode 100644
index 0000000..530519b
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+db8a2b45eafbf1ead4353044fb70f581 redis-6.2.5.tar.gz