diff --git a/specs/valkey/SOURCES/sentinel-80-config.patch b/specs/valkey/SOURCES/sentinel-80-config.patch new file mode 100644 index 00000000..f46091c0 --- /dev/null +++ b/specs/valkey/SOURCES/sentinel-80-config.patch @@ -0,0 +1,27 @@ +diff --color -urN valkey-8.0.1-orig/sentinel.conf valkey-8.0.1/sentinel.conf +--- valkey-8.0.1-orig/sentinel.conf 2024-10-03 00:09:21.000000000 +0300 ++++ valkey-8.0.1/sentinel.conf 2024-12-24 15:57:14.000000000 +0300 +@@ -1,5 +1,3 @@ +-# Example sentinel.conf +- + # By default protected mode is disabled in sentinel mode. Sentinel is reachable + # from interfaces different than localhost. Make sure the sentinel instance is + # protected from the outside world via firewalling or other means. +@@ -17,7 +15,7 @@ + # When running daemonized, Valkey Sentinel writes a pid file in + # /var/run/valkey-sentinel.pid by default. You can specify a custom pid file + # location here. +-pidfile /var/run/valkey-sentinel.pid ++pidfile /var/run/valkey/sentinel.pid + + # Specify the server verbosity level. + # This can be one of: +@@ -31,7 +29,7 @@ + # Specify the log file name. Also the empty string can be used to force + # Sentinel 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 /var/log/valkey/sentinel.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. diff --git a/specs/valkey/SOURCES/valkey-80-config.patch b/specs/valkey/SOURCES/valkey-80-config.patch new file mode 100644 index 00000000..38c06913 --- /dev/null +++ b/specs/valkey/SOURCES/valkey-80-config.patch @@ -0,0 +1,57 @@ +diff --color -urN valkey-8.0.1-orig/valkey.conf valkey-8.0.1/valkey.conf +--- valkey-8.0.1-orig/valkey.conf 2024-10-03 00:09:21.000000000 +0300 ++++ valkey-8.0.1/valkey.conf 2024-12-24 15:53:44.000000000 +0300 +@@ -85,7 +85,7 @@ + # You will also need to set a password unless you explicitly disable protected + # mode. + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-bind 127.0.0.1 -::1 ++# bind 127.0.0.1 -::1 + + # By default, outgoing connections (from replica to primary, from Sentinel to + # instances, cluster bus, etc.) are not bound to a specific local address. In +@@ -337,7 +337,7 @@ + # + # Note that on modern Linux systems "/run/valkey.pid" is more conforming + # and should be used instead. +-pidfile /var/run/valkey_6379.pid ++pidfile /var/run/valkey/valkey.pid + + # Specify the server verbosity level. + # This can be one of: +@@ -351,7 +351,7 @@ + # Specify the log file name. Also the empty string can be used to force + # the server 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 /var/log/valkey/valkey.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. +@@ -376,7 +376,7 @@ + # Set the number of databases. The default database is DB 0, you can select + # a different one on a per-connection basis using SELECT where + # dbid is a number between 0 and 'databases'-1 +-databases 16 ++databases 96 + + # By default the server shows an ASCII art logo only when started to log to the + # standard output and if the standard output is a TTY and syslog logging is +@@ -452,7 +452,7 @@ + # + # You can set these explicitly by uncommenting the following line. + # +-# save 3600 1 300 100 60 10000 ++save 3600 1 300 100 60 10000 + + # By default the server will stop accepting writes if RDB snapshots are enabled + # (at least one save point) and the latest background save failed. +@@ -526,7 +526,7 @@ + # 'cluster-config-file' configuration directive is a relative path. + # + # Note that you must specify a directory here, not a file name. +-dir ./ ++dir /var/lib/valkey/ + + ################################# REPLICATION ################################# + diff --git a/specs/valkey/valkey80.spec b/specs/valkey/valkey80.spec new file mode 100644 index 00000000..e80a7fc9 --- /dev/null +++ b/specs/valkey/valkey80.spec @@ -0,0 +1,196 @@ +################################################################################ + +%global crc_check pushd ../SOURCES ; sha512sum -c %{SOURCE100} ; popd + +################################################################################ + +%{!?_without_check: %define _with_check 1} + +################################################################################ + +%define realname valkey +%define major_ver 8 +%define minor_ver 0 + +################################################################################ + +Summary: A persistent key-value database +Name: %{realname}%{major_ver}%{minor_ver} +Version: 8.0.1 +Release: 0%{?dist} +License: BSD +Group: Applications/Databases +URL: https://valkey.io + +Source0: https://github.com/valkey-io/%{realname}/archive/%{version}.tar.gz +Source1: %{realname}.logrotate +Source2: sentinel.logrotate +Source3: %{realname}.service +Source4: sentinel.service +Source5: %{realname}-limit-systemd +Source6: sentinel-limit-systemd + +Source100: checksum.sha512 + +Patch0: %{realname}-%{major_ver}%{minor_ver}-config.patch +Patch1: sentinel-%{major_ver}%{minor_ver}-config.patch + +BuildRoot: %{_tmppath}/%{realname}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: make gcc tcl systemd-devel + +Requires: %{name}-cli >= %{version} +Requires: logrotate + +Requires(pre): shadow-utils +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd + +Conflicts: redis + +Provides: %{name} = %{version}-%{release} +Provides: %{name}-server = %{version}-%{release} +Provides: %{name}-sentinel = %{version}-%{release} + +################################################################################ + +%description +Valkey is a high-performance data structure server that primarily serves +key/value workloads. It supports a wide range of native structures and an +extensible plugin system for adding new data structures and access patterns. + +################################################################################ + +%package cli + +Summary: Client for working with Valkey from console +Group: Applications/Databases + +%description cli +Client for working with Valkey from console + +################################################################################ + +%package devel + +Summary: Development header for Valkey module development +Group: Development/Libraries + +Provides: %{name}-static = %{version}-%{release} + +%description devel +Header file required for building loadable Valkey modules. + +################################################################################ + +%prep +%crc_check +%autosetup -p1 -n %{realname}-%{version} + +%build +export BUILD_WITH_SYSTEMD=yes + +%{__make} %{?_smp_mflags} MALLOC=jemalloc + +%install +rm -rf %{buildroot} + +%{__make} install PREFIX=%{buildroot}%{_prefix} + +install -dm 755 %{buildroot}%{_sysconfdir} +install -dm 755 %{buildroot}%{_sysconfdir}/logrotate.d +install -dm 755 %{buildroot}%{_sysconfdir}/sysconfig + +install -pm 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{realname} +install -pm 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/sentinel + +install -pm 640 %{realname}.conf %{buildroot}%{_sysconfdir}/ +install -pm 640 sentinel.conf %{buildroot}%{_sysconfdir}/ + +install -dm 755 %{buildroot}%{_localstatedir}/lib/%{realname} +install -dm 755 %{buildroot}%{_localstatedir}/log/%{realname} +install -dm 755 %{buildroot}%{_localstatedir}/run/%{realname} + +install -dm 755 %{buildroot}%{_unitdir} +install -dm 755 %{buildroot}%{_sysconfdir}/systemd/system/%{realname}.service.d +install -dm 755 %{buildroot}%{_sysconfdir}/systemd/system/sentinel.service.d +install -pm 644 %{SOURCE3} %{buildroot}%{_unitdir}/ +install -pm 644 %{SOURCE4} %{buildroot}%{_unitdir}/ +install -pm 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/systemd/system/%{realname}.service.d/limit.conf +install -pm 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/systemd/system/sentinel.service.d/limit.conf + +install -dm 755 %{buildroot}%{_includedir} +install -pm 644 src/redismodule.h %{buildroot}%{_includedir}/redismodule.h + +chmod 755 %{buildroot}%{_bindir}/%{realname}-* + +rm -f %{buildroot}%{_bindir}/%{realname}-sentinel + +install -dm 755 %{buildroot}%{_sbindir} + +ln -sf %{_bindir}/%{realname}-server %{buildroot}%{_bindir}/%{realname}-sentinel +ln -sf %{_bindir}/%{realname}-server %{buildroot}%{_sbindir}/%{realname}-server + +%check +%if %{?_with_check:1}%{?_without_check:0} +%{__make} %{?_smp_mflags} test +%{__make} %{?_smp_mflags} test-sentinel +%endif + +%pre +getent group %{realname} &> /dev/null || groupadd -r %{realname} &> /dev/null +getent passwd %{realname} &> /dev/null || \ +useradd -r -g %{realname} -d %{_sharedstatedir}/%{realname} -s /sbin/nologin \ + -c 'Valkey Server' %{realname} &> /dev/null + +%post +if [[ $1 -eq 1 ]] ; then + systemctl enable %{realname}.service &>/dev/null || : +fi + +%preun +if [[ $1 -eq 0 ]] ; then + systemctl --no-reload disable %{realname}.service &>/dev/null || : + systemctl --no-reload disable sentinel.service &>/dev/null || : + systemctl stop %{realname}.service &>/dev/null || : + systemctl stop sentinel.service &>/dev/null || : +fi + +%postun +systemctl daemon-reload &>/dev/null || : + +################################################################################ + +%files +%defattr(-,root,root,-) +%doc 00-RELEASENOTES COPYING README.md +%attr(-,%{realname},%{realname}) %config(noreplace) %{_sysconfdir}/*.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/%{realname} +%config(noreplace) %{_sysconfdir}/logrotate.d/sentinel +%dir %attr(0755,%{realname},root) %{_localstatedir}/lib/%{realname} +%dir %attr(0755,%{realname},root) %{_localstatedir}/log/%{realname} +%dir %attr(0755,%{realname},root) %{_localstatedir}/run/%{realname} +%{_unitdir}/%{realname}.service +%{_unitdir}/sentinel.service +%{_sysconfdir}/systemd/system/%{realname}.service.d/limit.conf +%{_sysconfdir}/systemd/system/sentinel.service.d/limit.conf +%{_bindir}/%{realname}-* +%{_bindir}/redis-* +%{_sbindir}/%{realname}-server + +%files cli +%defattr(-,root,root,-) +%doc 00-RELEASENOTES COPYING README.md +%{_bindir}/%{realname}-cli + +%files devel +%doc COPYING +%defattr(-,root,root,-) +%{_includedir}/redismodule.h + +################################################################################ + +%changelog +* Tue Dec 24 2024 Anton Novojilov - 8.0.1-0 +- https://github.com/valkey-io/valkey/blob/8.0.1/00-RELEASENOTES diff --git a/tests/valkey/valkey80.recipe b/tests/valkey/valkey80.recipe new file mode 100644 index 00000000..22ac9e21 --- /dev/null +++ b/tests/valkey/valkey80.recipe @@ -0,0 +1,90 @@ +# Bibop recipe for Valkey 8.0.x +# See more: https://kaos.sh/bibop + +pkg valkey80 valkey80-cli + +require-root yes +unsafe-actions yes + +var service_user valkey +var service_group valkey +var service_name valkey + +var valkey_config /etc/valkey.conf +var sentinel_config /etc/sentinel.conf +var valkey_logrotate /etc/logrotate.d/valkey +var sentinel_logrotate /etc/logrotate.d/sentinel + +var dump_file /var/lib/valkey/dump.rdb +var log_file /var/log/valkey/valkey.log + +command "-" "Check environment" + app valkey-server + app valkey-sentinel + app valkey-benchmark + app valkey-check-aof + app valkey-check-rdb + app valkey-cli + + service-present valkey + service-present sentinel + + user-exist {service_user} + group-exist {service_group} + + exist {valkey_config} + mode {valkey_config} 640 + exist {sentinel_config} + mode {sentinel_config} 640 + + exist {valkey_logrotate} + mode {valkey_logrotate} 644 + exist {sentinel_logrotate} + mode {sentinel_logrotate} 644 + + exist /var/lib/{service_name} + owner /var/lib/{service_name} {service_user} + + exist /var/run/{service_name} + owner /var/run/{service_name} {service_user} + + exist /var/log/{service_name} + owner /var/log/{service_name} {service_user} + +command "systemctl start {service_name}" "Start Valkey service" + wait-service {service_name} 5 + connect tcp :6379 + +command "systemctl status {service_name}" "Check status of Valkey service" + expect "active (running)" + +command "systemctl restart {service_name}" "Restart Valkey service" + wait-service {service_name} 5 + connect tcp :6379 + +command "valkey-cli SET TEST ACBD1234" "Set test key" + exit 0 + +command "valkey-cli GET TEST" "Get test key" + exit 0 + output-contains "ACBD1234" + +command "valkey-cli CONFIG GET logfile" "Check Valkey Client" + exit 0 + output-contains "{log_file}" + +command "valkey-cli SAVE" "Create database dump" + exit 0 + ++command "-" "Check created dump file" + wait-fs {dump_file} 5 + exist {dump_file} + mode {dump_file} 644 + owner {dump_file} {service_user} + +command "systemctl stop {service_name}" "Stop Valkey service" + !wait-service {service_name} 5 + !connect tcp :6379 + +command "-" "Cleanup" + remove {dump_file}