Commit 4eef25f8 authored by Henrik Triem's avatar Henrik Triem
Browse files

Rename and adjust for Icinga Redis

parent 1d3f8beb
......@@ -25,7 +25,7 @@ Index: redis.conf
# Creating a pid file is best effort: if Redis is not able to create it
# nothing bad happens, the server will start and run normally.
-pidfile /var/run/redis_6379.pid
+pidfile /var/run/redis/default.pid
+pidfile /var/run/icinga-redis/default.pid
# Specify the server verbosity level.
# This can be one of:
......@@ -35,7 +35,7 @@ Index: redis.conf
# output for logging but daemonize, logs will be sent to /dev/null
-logfile ""
+# logfile ""
+logfile /var/log/redis/default.log
+logfile /var/log/icinga-redis/default.log
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
......@@ -44,7 +44,7 @@ Index: redis.conf
#
# Note that you must specify a directory here, not a file name.
-dir ./
+dir /var/lib/redis/default/
+dir /var/lib/icinga-redis/default/
################################# REPLICATION #################################
......@@ -55,9 +55,9 @@ Index: sentinel.conf
@@ -1,4 +1,8 @@
# Example sentinel.conf
+#
+pidfile /var/run/redis/sentinel-default.pid
+pidfile /var/run/icinga_redis/sentinel-default.pid
+loglevel notice
+logfile /var/log/redis/sentinel-default.log
+logfile /var/log/icinga_redis/sentinel-default.log
# *** IMPORTANT ***
#
......@@ -25,22 +25,22 @@ Index: utils/redis_init_script
-# Default-Stop: 0 1 6
-# Short-Description: Redis data structure server
-# Description: Redis data structure server. See https://redis.io
+# Provides: redis
+# Provides: Icinga-redis
+# Required-Start: $syslog $remote_fs
+# Required-Stop: $syslog $remote_fs
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 6
+# Short-Description: Redis server
+# Short-Description: Icinga Redis server
+# Description: Starts and stops the configured Redis instances
### END INIT INFO
-REDISPORT=6379
-EXEC=/usr/local/bin/redis-server
-CLIEXEC=/usr/local/bin/redis-cli
+EXEC=/usr/sbin/redis-server
+EXEC=/usr/sbin/icinga-redis-server
+USER=redis
+STATE=/var/run/redis
+CONF=/etc/redis
+STATE=/var/run/icinga-redis
+CONF=/etc/icinga-redis
+
+. /etc/rc.status
+
......@@ -60,7 +60,7 @@ Index: utils/redis_init_script
+ if [ -n "$2" ]; then
+ $command $2
+ else
+ for file in /etc/redis/*.conf; do
+ for file in /etc/icinga-redis/*.conf; do
+ $command `basename "$file" .conf`
+ done
+ fi
......@@ -94,7 +94,7 @@ Index: utils/redis_init_script
+ echo -n "not running"
+ else
+ PID=`cat $PIDFILE`
+ CLI='/usr/bin/redis-cli'
+ CLI='/usr/bin/icinga-redis-cli'
+ PASS=`grep ^requirepass $CONFIG | awk '{print $2}'`
+ PORT=`grep ^port $CONFIG | awk '{print $2}'`
+ BIND=`grep ^bind $CONFIG | awk '{print $2}'`
......
/var/log/redis/*.log {
/var/log/icinga-redis/*.log {
weekly
rotate 10
copytruncate
......
......@@ -20,7 +20,10 @@
%define _log_dir %{_localstatedir}/log/%{name}
%define _conf_dir %{_sysconfdir}/%{name}
Name: redis
%global pkg_prefix icinga-
%global src_name redis
Name: %{?pkg_prefix}%{src_name}
Version: 5.0.5
Release: 0
Summary: Persistent key-value database
......@@ -28,20 +31,20 @@ License: BSD-3-Clause
Group: Productivity/Databases/Servers
URL: https://redis.io
Source0: http://download.redis.io/releases/redis-%{version}.tar.gz
Source1: %{name}.logrotate
Source2: %{name}.target
Source3: %{name}@.service
Source4: %{name}.tmpfiles.d
Source1: %{src_name}.logrotate
Source2: %{src_name}.target
Source3: %{src_name}@.service
Source4: %{src_name}.tmpfiles.d
Source5: README.SUSE
Source6: %{name}.sysctl
Source7: %{name}-sentinel@.service
Source8: %{name}-sentinel.target
Source6: %{src_name}.sysctl
Source7: %{src_name}-sentinel@.service
Source8: %{src_name}-sentinel.target
# PATCH-FIX-OPENSUSE -- openSUSE-style init script
Patch0: %{name}-initscript.patch
Patch0: %{src_name}-initscript.patch
# PATCH-MISSING-TAG -- See https://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch1: %{name}-conf.patch
Patch2: %{name}-enable-bactrace-on-x86-ia64-and_arm32_only.patch
Patch3: %{name}-disable_integration_logging.patch
Patch1: %{src_name}-conf.patch
Patch2: %{src_name}-enable-bactrace-on-x86-ia64-and_arm32_only.patch
Patch3: %{src_name}-disable_integration_logging.patch
Patch4: reproducible.patch
BuildRequires: pkgconfig
BuildRequires: procps
......@@ -60,7 +63,7 @@ side union, intersection, difference between sets, and so forth. Redis supports
different kind of sorting abilities.
%prep
%setup -q
%setup -q -n %{src_name}-%{version}
%patch0
%patch1
%patch2
......@@ -83,21 +86,21 @@ install -m 0750 -d \
%{buildroot}%{_log_dir}/default \
%{buildroot}%{_data_dir}/default
install -Dpm 0755 src/%{name}-benchmark %{buildroot}%{_bindir}/%{name}-benchmark
install -Dpm 0755 src/%{name}-cli %{buildroot}%{_bindir}/%{name}-cli
install -Dpm 0755 src/%{name}-trib.rb %{buildroot}%{_bindir}/%{name}-trib.rb
install -Dpm 0755 src/%{src_name}-benchmark %{buildroot}%{_bindir}/%{name}-benchmark
install -Dpm 0755 src/%{src_name}-cli %{buildroot}%{_bindir}/%{name}-cli
install -Dpm 0755 src/%{src_name}-trib.rb %{buildroot}%{_bindir}/%{name}-trib.rb
install -Dpm 0755 src/%{name}-server %{buildroot}%{_sbindir}/%{name}-server
install -Dpm 0755 src/%{src_name}-server %{buildroot}%{_sbindir}/%{name}-server
ln -sfv ../sbin/redis-server %{buildroot}%{_bindir}/%{name}-check-aof
ln -sfv ../sbin/redis-server %{buildroot}%{_bindir}/%{name}-check-rdb
ln -sfv ../sbin/redis-server %{buildroot}%{_sbindir}/%{name}-check-aof
ln -sfv ../sbin/redis-server %{buildroot}%{_sbindir}/%{name}-check-rdb
ln -sfv ../sbin/redis-server %{buildroot}%{_sbindir}/%{name}-sentinel
ln -sfv ../sbin/%{name}-server %{buildroot}%{_bindir}/%{name}-check-aof
ln -sfv ../sbin/%{name}-server %{buildroot}%{_bindir}/%{name}-check-rdb
ln -sfv ../sbin/%{name}-server %{buildroot}%{_sbindir}/%{name}-check-aof
ln -sfv ../sbin/%{name}-server %{buildroot}%{_sbindir}/%{name}-check-rdb
ln -sfv ../sbin/%{name}-server %{buildroot}%{_sbindir}/%{name}-sentinel
perl -p -i -e 's|daemonize yes|daemonize no|g' %{name}.conf
install -Dm 0640 redis.conf %{buildroot}%{_conf_dir}/default.conf.example
install -Dm 0660 sentinel.conf %{buildroot}%{_conf_dir}/sentinel.conf.example
#install -Dm 0660 sentinel.conf %{buildroot}%{_conf_dir}/sentinel.conf.example
# some sysctl stuff
install -Dm 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/sysctl.d/00-%{name}.conf
......@@ -105,8 +108,8 @@ install -Dm 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
install -Dm 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.target
install -Dm 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}@.service
install -Dm 0644 %{SOURCE4} %{buildroot}%{_libexecdir}/tmpfiles.d/%{name}.conf
install -Dm 0644 %{SOURCE7} %{buildroot}%{_unitdir}/%{name}-sentinel@.service
install -Dm 0644 %{SOURCE8} %{buildroot}%{_unitdir}/%{name}-sentinel.target
#install -Dm 0644 %{SOURCE7} %{buildroot}%{_unitdir}/%{name}-sentinel@.service
#install -Dm 0644 %{SOURCE8} %{buildroot}%{_unitdir}/%{name}-sentinel.target
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
cp %{SOURCE5} README.SUSE
......@@ -119,7 +122,7 @@ The test suite often fails to start a server, with
'child process exited abnormally' -- sometimes it works.
---------------------------------------------------
EOF
make %{?_smp_mflags} test || true
#make %{?_smp_mflags} test || true
%endif
%pre
......@@ -127,18 +130,18 @@ getent group %{name} >/dev/null || %{_sbindir}/groupadd -r %{name} || :
getent passwd %{name} >/dev/null || \
%{_sbindir}/useradd -g %{name} -s /bin/false -r \
-c "User for %{name} key-value store" -d %{_data_dir} %{name} || :
%service_add_pre redis.target redis@.service redis-sentinel.target redis-sentinel@.service
%service_add_pre %{name}.target redis@.service redis-sentinel.target redis-sentinel@.service
%post
systemd-tmpfiles --create %{_libexecdir}/tmpfiles.d/%{name}.conf || true
%service_add_post redis.target redis@.service redis-sentinel.target redis-sentinel@.service
%service_add_post %{name}.target redis@.service redis-sentinel.target redis-sentinel@.service
echo "See %{_docdir}/%{name}/README.SUSE to continue"
%preun
%service_del_preun redis.target redis@.service redis-sentinel.target redis-sentinel@.service
%service_del_preun icinga-redis.target icinga-redis@.service icinga-redis-sentinel.target icinga-redis-sentinel@.service
%postun
%service_del_postun redis.target redis@.service redis-sentinel.target redis-sentinel@.service
%service_del_postun icinga-redis.target icinga-redis@.service icinga-redis-sentinel.target icigna-redis-sentinel@.service
%files
%license COPYING
......@@ -151,8 +154,8 @@ echo "See %{_docdir}/%{name}/README.SUSE to continue"
%{_libexecdir}/tmpfiles.d/%{name}.conf
%{_unitdir}/%{name}@.service
%{_unitdir}/%{name}.target
%{_unitdir}/%{name}-sentinel@.service
%{_unitdir}/%{name}-sentinel.target
#%%{_unitdir}/%%{name}-sentinel@.service
#%%{_unitdir}/%%{name}-sentinel.target
%doc README.SUSE
%config(noreplace) %attr(-,root,%{name}) %{_conf_dir}/
%dir %attr(0750,%{name},%{name}) %{_data_dir}
......
[Unit]
Description=Redis
Description=Redis for Icinga
After=network.target
PartOf=redis.target
PartOf=icinga-redis.target
[Service]
Type=notify
User=redis
Group=redis
User=icinga-redis
Group=icinga-redis
PrivateTmp=true
PIDFile=/var/run/redis/%i.pid
ExecStart=/usr/sbin/redis-server /etc/redis/%i.conf
PIDFile=/var/run/icinga-redis/%i.pid
ExecStart=/usr/sbin/icinga-redis-server /etc/icinga-redis/%i.conf
LimitNOFILE=10240
Restart=on-failure
[Install]
WantedBy=multi-user.target redis.target
WantedBy=multi-user.target icinga-redis.target
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment