rebase to 7.2.6

merge limit.conf in main service files
drop /etc/sysconfig/valkey
rename compat package
fix working dir
partially enable upstream test suite

Resolves: RHEL-52975
This commit is contained in:
Remi Collet 2024-08-06 10:37:49 +02:00
parent e2bfebb9c9
commit 6eec152878
10 changed files with 109 additions and 72 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/valkey-7.2.5.tar.gz /valkey-7.2.5.tar.gz
/valkey-7.2.6.tar.gz

View File

@ -0,0 +1,26 @@
#!/bin/sh
if [ -f /etc/redis/redis.conf ]; then
cp /etc/redis/redis.conf /etc/valkey/valkey.conf
mv /etc/redis/redis.conf /etc/redis/redis.conf.rpmsave
chown valkey:root /etc/valkey/valkey.conf
sed -i 's|^dir\s.*|dir /var/lib/valkey|g' /etc/valkey/valkey.conf
echo "/etc/redis/redis.conf has been copied to /etc/valkey/valkey.conf. Manual review of valkey.conf is strongly suggested especially if you had modified redis.conf."
fi
if [ -f /etc/redis/sentinel.conf ]; then
cp /etc/redis/sentinel.conf /etc/valkey/sentinel.conf
mv /etc/redis/sentinel.conf /etc/redis/sentinel.conf.rpmsave
chown valkey:root /etc/valkey/sentinel.conf
echo "/etc/redis/sentinel.conf has been copied to /etc/valkey/sentinel.conf. Manual review of sentinel.conf is strongly suggested especially if you had modified sentinel.conf."
fi
if [ -d /var/lib/redis ]; then
# cp could take a while, and this is a one-way move anyway
mv /var/lib/redis/* /var/lib/valkey/
# don't leave garbage behind, plus we check if this dir exists when running this script
rm -rf /var/lib/redis
chown -R valkey. /var/lib/valkey
echo "On-disk redis dumps moved from /var/lib/redis/ to /var/lib/valkey"
fi
# TODO
# 1. expand logic to read current redis conf for the dir setting. same for sentinel conf. if not stock /var/lib/redis, don't do the mv. redis and sentinel may be using two different paths.

View File

@ -1,7 +0,0 @@
#!/bin/sh
cp /etc/redis/redis.conf /etc/valkey/valkey.conf
cp /etc/redis/sentinel.conf /etc/valkey/sentinel.conf
mv /var/lib/redis/* /var/lib/valkey/
echo "/etc/redis/redis.conf has been copied to /etc/valkey/valkey.conf. pidfile, logfile, and dir are overridden by the config at /etc/sysconfig/valkey. Manual review of valkey.conf is strongly suggested especially if you had modified redis.conf."
echo "/etc/redis/sentinel.conf has been copied to /etc/valkey/sentinel.conf. pidfile, logfile, and dir are overridden by the config at /etc/sysconfig/valkey-sentinel. Manual review of sentinel.conf is strongly suggested especially if you had modified sentinel.conf."
echo "On-disk redis dumps moved from /var/lib/redis/ to /var/lib/valkey"

View File

@ -1 +1 @@
SHA512 (valkey-7.2.5.tar.gz) = 0b684a5ffe045ce51bb2f4f76429928784b8b46ee4817a95b658ffd69313a90b3d0fb12e0ddbb0b4cb57a7e0c79072f603eb4524a9bcce96ecc9ae8f1a5f02c3 SHA512 (valkey-7.2.6.tar.gz) = 99005b82ecbcdfde38ff823aff149b9f8c97052641b098a3197bab9fb6804b068a3ecedce11b99ef790af4ceb04c2eea25ba3ec37e39be6bb9382319933226af

View File

@ -1,14 +0,0 @@
# If you need to change max open file limit
# for example, when you change maxclient in configuration
# you can change the LimitNOFILE value below.
# See "man systemd.exec" for more information.
# Slave nodes on large system may take lot of time to start.
# You may need to uncomment TimeoutStartSec and TimeoutStopSec
# directives below and raise their value.
# See "man systemd.service" for more information.
[Service]
LimitNOFILE=10240
#TimeoutStartSec=90s
#TimeoutStopSec=90s

View File

@ -5,10 +5,10 @@ After=network-online.target
Wants=network-online.target Wants=network-online.target
[Service] [Service]
# ensure var is set
Environment=OPTIONS=
EnvironmentFile=-/etc/sysconfig/valkey-sentinel EnvironmentFile=-/etc/sysconfig/valkey-sentinel
# moved $OPTIONS to start because the --dir option only overrides the config if it is passed before # we must keep $OPTIONS and the env file as some older installs will still be using /etc/sysconfig/valkey-sentinel
# the config to the binary. I think this is a bug and will be reporting it upstream as all other
# opts don't care about the order for the override to work
ExecStart=/usr/bin/valkey-sentinel /etc/valkey/sentinel.conf --daemonize no --supervised systemd $OPTIONS ExecStart=/usr/bin/valkey-sentinel /etc/valkey/sentinel.conf --daemonize no --supervised systemd $OPTIONS
Type=notify Type=notify
User=valkey User=valkey
@ -16,6 +16,19 @@ Group=valkey
RuntimeDirectory=valkey RuntimeDirectory=valkey
RuntimeDirectoryMode=0755 RuntimeDirectoryMode=0755
# If you need to change max open file limit
# for example, when you change maxclient in configuration
# you can change the LimitNOFILE value below.
# See "man systemd.exec" for more information.
LimitNOFILE=10240
# Slave nodes on large system may take lot of time to start.
# You may need to uncomment TimeoutStartSec and TimeoutStopSec
# directives below and raise their value.
# See "man systemd.service" for more information.
#TimeoutStartSec=90s
#TimeoutStopSec=90s
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -1 +0,0 @@
OPTIONS="--logfile /var/log/valkey/sentinel.log --unixsocket /var/run/valkey/sentinel.sock --pidfile /var/run/valkey/sentinel.pid"

View File

@ -5,10 +5,11 @@ After=network-online.target
Wants=network-online.target Wants=network-online.target
[Service] [Service]
WorkingDirectory=/var/lib/valkey
# ensure var is set
Environment=OPTIONS=
EnvironmentFile=-/etc/sysconfig/valkey EnvironmentFile=-/etc/sysconfig/valkey
# moved $OPTIONS to start because the --dir option only overrides the config if it is passed before # we must keep $OPTIONS and the env file as some older installs will still be using /etc/sysconfig/valkey
# the config to the binary. I think this is a bug and will be reporting it upstream as all other
# opts don't care about the order for the override to work
ExecStart=/usr/bin/valkey-server /etc/valkey/valkey.conf --daemonize no --supervised systemd $OPTIONS ExecStart=/usr/bin/valkey-server /etc/valkey/valkey.conf --daemonize no --supervised systemd $OPTIONS
Type=notify Type=notify
User=valkey User=valkey
@ -16,6 +17,19 @@ Group=valkey
RuntimeDirectory=valkey RuntimeDirectory=valkey
RuntimeDirectoryMode=0755 RuntimeDirectoryMode=0755
# If you need to change max open file limit
# for example, when you change maxclient in configuration
# you can change the LimitNOFILE value below.
# See "man systemd.exec" for more information.
LimitNOFILE=10240
# Slave nodes on large system may take lot of time to start.
# You may need to uncomment TimeoutStartSec and TimeoutStopSec
# directives below and raise their value.
# See "man systemd.service" for more information.
#TimeoutStartSec=90s
#TimeoutStopSec=90s
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -1,9 +1,9 @@
# Tests fail in mock, not in local build. # Tests fail in mock, not in local build.
%bcond_with tests %bcond_without tests
Name: valkey Name: valkey
Version: 7.2.5 Version: 7.2.6
Release: 4%{?dist} Release: 1%{?dist}
Summary: A persistent key-value database Summary: A persistent key-value database
# valkey: BSD-3-Clause # valkey: BSD-3-Clause
# hiredis: BSD-3-Clause # hiredis: BSD-3-Clause
@ -17,13 +17,8 @@ Source1: %{name}.logrotate
Source2: %{name}-sentinel.service Source2: %{name}-sentinel.service
Source3: %{name}.service Source3: %{name}.service
Source4: %{name}.sysusers Source4: %{name}.sysusers
# could have pulled this out of unpacked sources but
# our copy has additional options pre-programmed in
Source5: %{name}-limit-systemd
Source6: %{name}.sysconfig
Source7: %{name}-sentinel.sysconfig
Source8: macros.%{name} Source8: macros.%{name}
Source9: redisconf_to_valkeyconf.sh Source9: migrate_redis_to_valkey.sh
BuildRequires: make BuildRequires: make
BuildRequires: gcc BuildRequires: gcc
@ -36,10 +31,6 @@ BuildRequires: systemd-devel
BuildRequires: systemd-rpm-macros BuildRequires: systemd-rpm-macros
BuildRequires: openssl-devel BuildRequires: openssl-devel
Requires: logrotate Requires: logrotate
Requires(pre): shadow-utils
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
# from deps/hiredis/hiredis.h # from deps/hiredis/hiredis.h
Provides: bundled(hiredis) = 1.0.3 Provides: bundled(hiredis) = 1.0.3
# from deps/jemalloc/VERSION # from deps/jemalloc/VERSION
@ -94,16 +85,19 @@ Provides: %{name}-static = %{version}-%{release}
Header file required for building loadable Valkey modules. Header file required for building loadable Valkey modules.
%package compat %package compat-redis
Summary: Conversion script and compatibility symlinks for Redis Summary: Conversion script and compatibility symlinks for Redis
Requires: valkey Requires: valkey = %{version}-%{release}
Conflicts: redis %if 0%{?fedora} > 40 || 0%{?rhel} > 9
# if change proposal is approved Obsoletes: redis < 7.4
#%if 0%%{?fedora} > 40 Provides: redis = %{version}-%{release}
#Obsoletes: redis <= 7.2.4 %else
#%endif Conflicts: redis < 7.4
%endif
BuildArch: noarch
%description compat
%description compat-redis
%summary %summary
@ -134,6 +128,22 @@ if test "$api" != "%{valkey_modules_abi}"; then
exit 1 exit 1
fi fi
sed -i -e 's|^logfile .*$|logfile /var/log/valkey/valkey.log|g' \
-e 's|^# unixsocket .*$|unixsocket /run/valkey/valkey.sock|g' \
-e 's|^pidfile .*$|pidfile /run/valkey/valkey.pid|g' \
valkey.conf
sed -i -e 's|^logfile .*$|logfile /var/log/valkey/sentinel.log|g' \
-e 's|^pidfile .*$|pidfile /run/valkey/sentinel.pid|g' \
sentinel.conf
%if (%{defined fedora} && 0%{?fedora} < 42) || (%{defined rhel} && 0%{?rhel} < 10)
# these lines are for conditionals around sysconfig to valkey.conf porting scriptlets to avoid re-runs
echo '# valkey_rpm_conf' >> valkey.conf
echo '# valkey-sentinel_rpm_conf' >> sentinel.conf
%endif
%global make_flags DEBUG="" V="echo" PREFIX=%{buildroot}%{_prefix} BUILD_WITH_SYSTEMD=yes BUILD_TLS=yes %global make_flags DEBUG="" V="echo" PREFIX=%{buildroot}%{_prefix} BUILD_WITH_SYSTEMD=yes BUILD_TLS=yes
%build %build
@ -166,10 +176,6 @@ mkdir -p %{buildroot}%{_unitdir}
install -pm644 %{S:3} %{buildroot}%{_unitdir} install -pm644 %{S:3} %{buildroot}%{_unitdir}
install -pm644 %{S:2} %{buildroot}%{_unitdir} install -pm644 %{S:2} %{buildroot}%{_unitdir}
# Install systemd limit files
install -p -D -m 644 %{S:5} %{buildroot}%{_unitdir}/%{name}.service.d/limit.conf
install -p -D -m 644 %{S:5} %{buildroot}%{_unitdir}/%{name}-sentinel.service.d/limit.conf
# Fix non-standard-executable-perm error. # Fix non-standard-executable-perm error.
chmod 755 %{buildroot}%{_bindir}/%{name}-* chmod 755 %{buildroot}%{_bindir}/%{name}-*
@ -180,19 +186,17 @@ install -pDm644 src/%{name}module.h %{buildroot}%{_includedir}/%{name}module.h
#mkdir -p %{buildroot}%{_rpmmacrodir} #mkdir -p %{buildroot}%{_rpmmacrodir}
install -pDm644 %{S:8} %{buildroot}%{_rpmmacrodir}/macros.%{name} install -pDm644 %{S:8} %{buildroot}%{_rpmmacrodir}/macros.%{name}
# Install sysconfig files
install -Dpm 644 %{S:6} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
install -Dpm 644 %{S:7} %{buildroot}%{_sysconfdir}/sysconfig/%{name}-sentinel
# compat script # compat script
install -Dpm 755 %{S:9} %{buildroot}%{_libexecdir}/redisconf_to_valkeyconf.sh install -Dpm 755 %{S:9} %{buildroot}%{_libexecdir}/migrate_redis_to_valkey.sh
%check %check
%if %{with tests} %if %{with tests}
# https://github.com/redis/redis/issues/1417 (for "taskset -c 1") # https://github.com/redis/redis/issues/1417 (for "taskset -c 1")
taskset -c 1 make %{make_flags} test taskset -c 1 ./runtest --skiptest "Active defrag - AOF loading"
make %{make_flags} test-sentinel
# sentinel tests fail in mock, but we want the normal tests above
#./runtest-sentinel
%endif %endif
%pre %pre
@ -204,8 +208,8 @@ make %{make_flags} test-sentinel
%systemd_post %{name}-sentinel.service %systemd_post %{name}-sentinel.service
%post compat %post compat-redis
%{_libexecdir}/redisconf_to_valkeyconf.sh %{_libexecdir}/migrate_redis_to_valkey.sh
%preun %preun
@ -237,14 +241,8 @@ make %{make_flags} test-sentinel
%{_bindir}/%{name}-* %{_bindir}/%{name}-*
%{_unitdir}/%{name}.service %{_unitdir}/%{name}.service
%{_unitdir}/%{name}-sentinel.service %{_unitdir}/%{name}-sentinel.service
%dir %{_unitdir}/%{name}.service.d
%{_unitdir}/%{name}.service.d/limit.conf
%dir %{_unitdir}/%{name}-sentinel.service.d
%{_unitdir}/%{name}-sentinel.service.d/limit.conf
%dir %attr(0755, valkey, valkey) %ghost %{_localstatedir}/run/%{name} %dir %attr(0755, valkey, valkey) %ghost %{_localstatedir}/run/%{name}
%{_sysusersdir}/%{name}.conf %{_sysusersdir}/%{name}.conf
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}-sentinel
%files devel %files devel
@ -254,12 +252,20 @@ make %{make_flags} test-sentinel
%{_rpmmacrodir}/macros.%{name} %{_rpmmacrodir}/macros.%{name}
%files compat %files compat-redis
%{_libexecdir}/redisconf_to_valkeyconf.sh %{_libexecdir}/migrate_redis_to_valkey.sh
%{_bindir}/redis-* %{_bindir}/redis-*
%changelog %changelog
* Tue Aug 6 2024 Remi Collet <rcollet@redhat.com> - 7.2.6.1
- rebase to 7.2.6
- merge limit.conf in main service files
- drop /etc/sysconfig/valkey
- rename compat package
- fix working dir
- partially enable upstream test suite
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 7.2.5-4 * Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 7.2.5-4
- Bump release for June 2024 mass rebuild - Bump release for June 2024 mass rebuild

View File

@ -1 +0,0 @@
OPTIONS="--logfile /var/log/valkey/valkey.log --dir /var/lib/valkey --unixsocket /var/run/valkey/valkey.sock --pidfile /var/run/valkey/valkey.pid"