Commit 1d3f8beb authored by Henrik Triem's avatar Henrik Triem
Browse files

Starting point from Suse Build

parents
Index: redis.conf
===================================================================
--- redis.conf.orig
+++ redis.conf
@@ -133,7 +133,7 @@ tcp-keepalive 300
# 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
# If you run Redis from upstart or systemd, Redis can interact with your
# supervision tree. Options:
@@ -144,7 +144,7 @@ daemonize no
# UPSTART_JOB or NOTIFY_SOCKET environment variables
# Note: these supervision methods only signal "process is ready."
# They do not enable continuous liveness pings back to your supervisor.
-supervised no
+supervised systemd
# If a pid file is specified, Redis writes it where specified at startup
# and removes it at exit.
@@ -155,7 +155,7 @@ supervised no
#
# 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
# Specify the server verbosity level.
# This can be one of:
@@ -168,7 +168,8 @@ loglevel notice
# 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
-logfile ""
+# logfile ""
+logfile /var/log/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.
@@ -260,7 +261,7 @@ dbfilename dump.rdb
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
-dir ./
+dir /var/lib/redis/default/
################################# REPLICATION #################################
Index: sentinel.conf
===================================================================
--- sentinel.conf.orig
+++ sentinel.conf
@@ -1,4 +1,8 @@
# Example sentinel.conf
+#
+pidfile /var/run/redis/sentinel-default.pid
+loglevel notice
+logfile /var/log/redis/sentinel-default.log
# *** IMPORTANT ***
#
--- tests/test_helper.tcl.orig 2018-04-17 18:04:29.778303392 +0200
+++ tests/test_helper.tcl 2018-04-17 18:04:46.688365379 +0200
@@ -40,7 +40,6 @@ set ::all_tests {
integration/aof
integration/rdb
integration/convert-zipmap-hash-on-load
- integration/logging
integration/psync2
integration/psync2-reg
unit/pubsub
Index: src/config.h
===================================================================
--- src/config.h.orig
+++ src/config.h
@@ -65,8 +65,10 @@
#if defined(__APPLE__) || (defined(__linux__) && defined(__GLIBC__)) || \
defined(__FreeBSD__) || (defined(__OpenBSD__) && defined(USE_BACKTRACE))\
|| defined(__DragonFly__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) || defined (__arm__)
#define HAVE_BACKTRACE 1
#endif
+#endif
/* MSG_NOSIGNAL. */
#ifdef __linux__
Index: utils/redis_init_script
===================================================================
--- utils/redis_init_script.orig
+++ utils/redis_init_script
@@ -1,50 +1,133 @@
#!/bin/sh
-#
-# Simple Redis init.d script conceived to work on Linux systems
-# as it does use of the /proc filesystem.
+# System startup script for Redis for OpenSUSE >= 11.4
+#
+# Author: Marcello Barnaba <m.barnaba@ifad.org>
+# Tue Jul 31 17:32:27 CEST 2012
+#
+# LSB-compatible service control script; see http://www.linuxbase.org/spec/
+# Install it in /etc/init.d/redis and run insserv /etc/init.d/redis
+# Define configurations in /etc/init.d/redis/NAME.conf
+#
+# Source: https://gist.github.com/804026
+#
### BEGIN INIT INFO
-# Provides: redis_6379
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Redis data structure server
-# Description: Redis data structure server. See https://redis.io
+# Provides: 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
+# 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
+USER=redis
+STATE=/var/run/redis
+CONF=/etc/redis
+
+. /etc/rc.status
+
+if [ ! -d $STATE ]; then
+ install -d $state -o $USER -g $USER -m 0755 $STATE
+fi
+
+_get_env() {
+ INSTANCE=$1
+ PIDFILE=${STATE}/${INSTANCE}.pid
+ CONFIG=${CONF}/${INSTANCE}.conf
+}
+
+_foreach_config() {
+ command=$1
+
+ if [ -n "$2" ]; then
+ $command $2
+ else
+ for file in /etc/redis/*.conf; do
+ $command `basename "$file" .conf`
+ done
+ fi
+}
+
+start() {
+ _get_env $1
+
+ echo -n "Starting Redis server '${INSTANCE}'... "
+
+ if [ ! -f ${CONFIG} ]; then
+ echo "$CONFIG not found"
+ rc_failed
+
+ elif [ -f ${PIDFILE} ] && [ -x /proc/`cat ${PIDFILE}` ]; then
+ echo -n "already running (PID `cat ${PIDFILE}`)"
+
+ else
+ rm -f ${PIDFILE}
+ sudo -u $USER $EXEC $CONFIG
+ fi
+ rc_status -v
+}
+
+stop() {
+ _get_env $1
+
+ echo -n "Stopping Redis server '${INSTANCE}' ... "
+
+ if [ ! -f $PIDFILE ]; then
+ echo -n "not running"
+ else
+ PID=`cat $PIDFILE`
+ CLI='/usr/bin/redis-cli'
+ PASS=`grep ^requirepass $CONFIG | awk '{print $2}'`
+ PORT=`grep ^port $CONFIG | awk '{print $2}'`
+ BIND=`grep ^bind $CONFIG | awk '{print $2}'`
+
+ CLI="$CLI -p $PORT"
+ [ -n "$PASS" ] && CLI="$CLI -a $PASS"
+ [ -n "$BIND" ] && CLI="$CLI -h $BIND"
+
+ $CLI shutdown
+ echo -n "Waiting... "
+
+ while [ -x /proc/${PID} ]; do
+ sleep 1
+ echo -n '.'
+ done
+ rm -f ${PIDFILE}
+ fi
+ rc_status -v
+}
+
+status() {
+ _get_env $1
+
+ echo -n "Checking for redis '${INSTANCE}'"
+ /sbin/checkproc -p $PIDFILE $EXEC
+ rc_status -v
+}
-PIDFILE=/var/run/redis_${REDISPORT}.pid
-CONF="/etc/redis/${REDISPORT}.conf"
case "$1" in
start)
- if [ -f $PIDFILE ]
- then
- echo "$PIDFILE exists, process is already running or crashed"
- else
- echo "Starting Redis server..."
- $EXEC $CONF
- fi
- ;;
+ _foreach_config start $2
+ ;;
+
stop)
- if [ ! -f $PIDFILE ]
- then
- echo "$PIDFILE does not exist, process is not running"
- else
- PID=$(cat $PIDFILE)
- echo "Stopping ..."
- $CLIEXEC -p $REDISPORT shutdown
- while [ -x /proc/${PID} ]
- do
- echo "Waiting for Redis to shutdown ..."
- sleep 1
- done
- echo "Redis stopped"
- fi
- ;;
+ _foreach_config stop $2
+ ;;
+
+ status)
+ _foreach_config status $2
+ ;;
+
+ restart)
+ $0 stop $2
+ $0 start $2
+ ;;
+
*)
- echo "Please use start or stop as first argument"
- ;;
+ echo "Usage: $0 <start|stop|restart|status>"
+ exit 1
+ ;;
esac
[Unit]
Description=Redis Sentinel target allowing to start/stop all redis-sentinel@.service instances at once
[Unit]
Description=Redis for Icinga
After=network.target
PartOf=icinga-redis-sentinel.target
[Service]
Type=notify
User=icinga-redis
Group=icinga-redis
PrivateTmp=true
PIDFile=/var/run/icinga-redis/sentinel-%i.pid
ExecStart=/usr/sbin/icinga-redis-sentinel /etc/icinga-redis/sentinel-%i.conf
LimitNOFILE=10240
Restart=on-failure
[Install]
WantedBy=multi-user.target icinga-redis.target
This diff is collapsed.
/var/log/redis/*.log {
weekly
rotate 10
copytruncate
delaycompress
compress
notifempty
missingok
su redis redis
}
#
# spec file for package redis
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define _data_dir %{_localstatedir}/lib/%{name}
%define _log_dir %{_localstatedir}/log/%{name}
%define _conf_dir %{_sysconfdir}/%{name}
Name: redis
Version: 5.0.5
Release: 0
Summary: Persistent key-value database
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
Source5: README.SUSE
Source6: %{name}.sysctl
Source7: %{name}-sentinel@.service
Source8: %{name}-sentinel.target
# PATCH-FIX-OPENSUSE -- openSUSE-style init script
Patch0: %{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
Patch4: reproducible.patch
BuildRequires: pkgconfig
BuildRequires: procps
BuildRequires: tcl
BuildRequires: pkgconfig(systemd)
Requires: logrotate
Requires: sudo
Requires(pre): shadow
%description
%{name} is an advanced key-value store. It is similar to memcached but the dataset
is not volatile, and values can be strings, exactly like in memcached,
but also lists, sets, and ordered sets. All this data types can be manipulated
with atomic operations to push/pop elements, add/remove elements, perform server
side union, intersection, difference between sets, and so forth. Redis supports
different kind of sorting abilities.
%prep
%setup -q
%patch0
%patch1
%patch2
%ifnarch %{ix86} x86_64 ia64 %{arm}
# We have no backtrace, so disable logging test
%patch3
%endif
%patch4 -p1
%build
export HOST=OBS # for reproducible builds
make %{?_smp_mflags} CFLAGS="%{optflags}" V=1
%install
install -m 0750 -d \
%{buildroot}%{_sbindir} \
%{buildroot}%{_log_dir} \
%{buildroot}%{_data_dir} \
%{buildroot}%{_conf_dir} \
%{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/%{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
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
# some sysctl stuff
install -Dm 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/sysctl.d/00-%{name}.conf
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
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
cp %{SOURCE5} README.SUSE
%check
%ifnarch ppc ppc64
cat <<EOF
---------------------------------------------------
The test suite often fails to start a server, with
'child process exited abnormally' -- sometimes it works.
---------------------------------------------------
EOF
make %{?_smp_mflags} test || true
%endif
%pre
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
%post
systemd-tmpfiles --create %{_libexecdir}/tmpfiles.d/%{name}.conf || true
%service_add_post redis.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
%postun
%service_del_postun redis.target redis@.service redis-sentinel.target redis-sentinel@.service
%files
%license COPYING
%doc 00-RELEASENOTES BUGS CONTRIBUTING README.md
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{_sysconfdir}/sysctl.d/00-%{name}.conf
%{_bindir}/%{name}-*
%{_sbindir}/%{name}-*
%{_sbindir}/rc%{name}
%{_libexecdir}/tmpfiles.d/%{name}.conf
%{_unitdir}/%{name}@.service
%{_unitdir}/%{name}.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}
%dir %attr(0750,%{name},%{name}) %{_data_dir}/default
%dir %attr(0750,%{name},%{name}) %{_log_dir}
%changelog
### remove redis Warnings about
# WARNING: The TCP backlog setting of 511 cannot be enforced because
# /proc/sys/net/core/somaxconn is set to the lower value of 128.
net.core.somaxconn=512
# WARNING overcommit_memory is set to 0! Background save may fail
# under low memory condition. To fix this issue add
# 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or
# run the command 'sysctl -w vm.overcommit_memory=1' for this to take
# effect.
vm.overcommit_memory=1
[Unit]
Description=Redis target allowing to start/stop all redis@.service instances at once
# Type Path Mode UID GID Age Argument
d /var/run/redis/ 0755 redis redis - -
[Unit]
Description=Redis
After=network.target
PartOf=redis.target
[Service]
Type=notify
User=redis
Group=redis
PrivateTmp=true
PIDFile=/var/run/redis/%i.pid
ExecStart=/usr/sbin/redis-server /etc/redis/%i.conf
LimitNOFILE=10240
Restart=on-failure
[Install]
WantedBy=multi-user.target redis.target
https://github.com/antirez/redis/pull/4390
From 8832af49fa1f4fdd8f9e152f013bb71b343d26dd Mon Sep 17 00:00:00 2001
From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
Date: Sun, 22 Oct 2017 05:20:38 +0200
Subject: [PATCH 1/2] Use RELEASENOTES date instead of build date
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good.
---
src/mkreleasehdr.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: redis-5.0.5/src/mkreleasehdr.sh
===================================================================
--- redis-5.0.5.orig/src/mkreleasehdr.sh
+++ redis-5.0.5/src/mkreleasehdr.sh
@@ -1,7 +1,7 @@
#!/bin/sh
GIT_SHA1=`(git show-ref --head --hash=8 2> /dev/null || echo 00000000) | head -n1`
GIT_DIRTY=`git diff --no-ext-diff 2> /dev/null | wc -l`
-BUILD_ID=`uname -n`"-"`date +%s`
+BUILD_ID=${HOST:-`uname -n`}"-"`date -r ../00-RELEASENOTES +%s`
if [ -n "$SOURCE_DATE_EPOCH" ]; then
BUILD_ID=$(date -u -d "@$SOURCE_DATE_EPOCH" +%s 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" +%s 2>/dev/null || date -u %s)
fi
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