aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorYth - Arnaud <yth@ythogtha.org>2024-04-04 11:04:19 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2024-04-04 15:10:14 +0700
commit5f4ed12c1a639f6500413fc49288b00f5ac25621 (patch)
tree574f48c0b74c9b75d5eae898ebd5c45799e91dd3 /system
parentd9cfbff954cfa48677d32b14d89f610a26ad109d (diff)
system/valkey: Added (Fork of redis).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system')
-rw-r--r--system/valkey/README27
-rw-r--r--system/valkey/doinst.sh28
-rw-r--r--system/valkey/rc.valkey.new61
-rw-r--r--system/valkey/slack-desc19
-rw-r--r--system/valkey/valkey.SlackBuild159
-rw-r--r--system/valkey/valkey.info10
-rw-r--r--system/valkey/valkey.logrotate9
7 files changed, 313 insertions, 0 deletions
diff --git a/system/valkey/README b/system/valkey/README
new file mode 100644
index 000000000000..c722723c1034
--- /dev/null
+++ b/system/valkey/README
@@ -0,0 +1,27 @@
+Valkey 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.
+These 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.
+Valkey supports different kinds of sorting abilities.
+
+Valkey is a fork of Redis after licence went proprietary.
+
+Default port for starting the instance can be set with
+VALKEY_PORT=16379
+Defaults remains the Redis port at 6379, hence making it incompatible
+out-of-the-package with a parallel Redis instance running.
+
+valkey-cli is (for now) fully compatible with redis-cli, and defaults
+to redis port 6379.
+
+Valkey still uses, by default, redis binary names, but this script
+replaces them with valkey names: valkey-server, valkey-cli and
+valkey-benchmark, for having it installed alongside Redis.
+Data are also moved to /var/lib/valkey
+This can be reversed by setting the VALKEY_BIN environment variable to
+anything but ON.
+Logs will always be in /var/log/valkey, and RC script is always
+/etc/rc.d/rc.valkey
diff --git a/system/valkey/doinst.sh b/system/valkey/doinst.sh
new file mode 100644
index 000000000000..e4271147e9ba
--- /dev/null
+++ b/system/valkey/doinst.sh
@@ -0,0 +1,28 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+config etc/valkey/valkey.conf.new
+config etc/valkey/sentinel.conf.new
+config etc/logrotate.d/valkey.new
+preserve_perms etc/rc.d/rc.valkey.new
diff --git a/system/valkey/rc.valkey.new b/system/valkey/rc.valkey.new
new file mode 100644
index 000000000000..aca97e59a77d
--- /dev/null
+++ b/system/valkey/rc.valkey.new
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Valkey startup script for Slackware Linux
+
+PORT=6379
+SERV=/usr/bin/valkey-server
+CLI=/usr/bin/valkey-cli
+PIDFILE=/var/run/valkey_${PORT}.pid
+CONF=/etc/valkey/valkey.conf
+
+valkey_start() {
+ if [ ! -r $CONF ]; then
+ echo "$CONF does not appear to exist. Abort."
+ exit 1
+ fi
+
+ if [ -s $PIDFILE ]; then
+ echo "Valkey appears to be already running?"
+ exit 1
+ fi
+
+ echo "Starting Valkey server..."
+ $SERV $CONF
+}
+
+valkey_stop() {
+ if [ ! -s $PIDFILE ]; then
+ echo "$PIDFILE does not exist or is empty."
+ exit 1
+ fi
+
+ PID=$(cat $PIDFILE)
+ echo -n "Stopping Valkey server..."
+ $CLI -p $PORT shutdown
+ while [ -d /proc/$PID ]; do
+ sleep 1
+ echo -n "."
+ done
+ echo " done"
+}
+
+valkey_restart() {
+ valkey_stop
+ sleep 3
+ valkey_start
+}
+
+case "$1" in
+ start)
+ valkey_start
+ ;;
+ stop)
+ valkey_stop
+ ;;
+ restart)
+ valkey_restart
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+esac
diff --git a/system/valkey/slack-desc b/system/valkey/slack-desc
new file mode 100644
index 000000000000..ee7692036dbb
--- /dev/null
+++ b/system/valkey/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+valkey: valkey (Key-Value Store)
+valkey:
+valkey: Valkey is an advanced key-value store. It is similar to memcached but
+valkey: the dataset is not volatile, and values can be strings, exactly like
+valkey: in memcached, but also lists, sets, and ordered sets. These data
+valkey: types can be manipulated with atomic operations to push/pop elements,
+valkey: add/remove elements, perform server side union, intersection,
+valkey: Records are organized in hash table, B+ tree, or a fixed-length array.
+valkey: Valkey supports different kinds of sorting abilities.
+valkey:
+valkey: Homepage: https://valkey.io/
diff --git a/system/valkey/valkey.SlackBuild b/system/valkey/valkey.SlackBuild
new file mode 100644
index 000000000000..63574c1a944d
--- /dev/null
+++ b/system/valkey/valkey.SlackBuild
@@ -0,0 +1,159 @@
+#!/bin/bash
+
+# Slackware build script for valkey
+
+# Copyright 2024 Yth | Pont-en-Royans, France | yth@ythogtha.org
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=valkey
+VERSION=${VERSION:-7.2.4}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+elif [ "$ARCH" = "aarch64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+# Use our CFLAGS.
+sed -i "s|-O3||" deps/Makefile deps/hiredis/Makefile
+
+# No ./configure necessary.
+#
+# http://lists.slackbuilds.org/pipermail/slackbuilds-users/2013-January/010042.html
+( unset ARCH ; CFLAGS="$SLKCFLAGS" make )
+make install PREFIX=$PKG/usr
+# By default, valkey uses redis binary names
+# We change it to valkey names, but this is optional
+if [ "${VALKEY_BIN:-ON}" == "ON" ]; then
+ pushd $PKG/usr/bin
+ mv redis-benchmark valkey-benchmark
+ mv redis-cli valkey-cli
+ mv redis-server valkey-server
+ rm -f redis-check-aof redis-check-rdb redis-sentinel
+ ln -sf valkey-server valkey-check-aof
+ ln -sf valkey-server valkey-check-rdb
+ ln -sf valkey-server valkey-sentinel
+ popd
+else
+ sed -i 's#bin/valkey#bin/redis#' $CWD/rc.valkey.new
+fi
+
+find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+# Use sample config and set some sane defaults.
+install -D -m 0644 redis.conf $PKG/etc/valkey/valkey.conf.new
+sed -i \
+ -e 's|^daemonize no|daemonize yes|' \
+ -e 's|^dir \.|dir /var/lib/valkey|' \
+ -e 's|^logfile ""|logfile /var/log/valkey/valkey.log|' \
+ $PKG/etc/valkey/valkey.conf.new
+install -D -m 0644 sentinel.conf $PKG/etc/valkey/sentinel.conf.new
+
+# Create data directory.
+mkdir -p $PKG/var/lib/valkey
+chmod 0700 $PKG/var/lib/valkey
+
+# Create log directory.
+mkdir -p $PKG/var/log/valkey
+
+# Install init script.
+mkdir -p $PKG/etc/rc.d
+cat $CWD/rc.valkey.new > $PKG/etc/rc.d/rc.valkey.new
+
+# Install logrotate script.
+mkdir -p $PKG/etc/logrotate.d
+cat $CWD/valkey.logrotate > $PKG/etc/logrotate.d/valkey.new
+
+# Specify default port number
+if [ ! -z "$VALKEY_PORT" ]; then
+ sed -i 's/6379/'$VALKEY_PORT'/' $PKG/etc/rc.d/rc.valkey.new
+ sed -i 's/6379/'$VALKEY_PORT'/' $PKG/etc/valkey/valkey.conf.new
+ sed -i 's/default is '$VALKEY_PORT'/default is 6379/' $PKG/etc/valkey/valkey.conf.new
+ sed -i 's/6379/'$VALKEY_PORT'/' $PKG/etc/valkey/sentinel.conf.new
+fi
+# Final touches on Valkey names
+if [ "${VALKEY_BIN:-ON}" == "ON" ]; then
+ sed -i 's#redis#valkey#g' $PKG/etc/valkey/valkey.conf.new
+fi
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ *RELEASENOTES* BUGS* CONTRIBUTING* COPYING* MANIFESTO* README* CODE_OF_CONDUCT* SECURITY* TLS* \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/system/valkey/valkey.info b/system/valkey/valkey.info
new file mode 100644
index 000000000000..3a31b3ad1f87
--- /dev/null
+++ b/system/valkey/valkey.info
@@ -0,0 +1,10 @@
+PRGNAM="valkey"
+VERSION="7.2.4"
+HOMEPAGE="https://valkey.io/"
+DOWNLOAD="https://github.com/valkey-io/valkey/archive/refs/tags/7.2.4/valkey-7.2.4.tar.gz"
+MD5SUM="1bb29b39d5ab6dc131d0763203676a72"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Yth - Arnaud"
+EMAIL="yth@ythogtha.org"
diff --git a/system/valkey/valkey.logrotate b/system/valkey/valkey.logrotate
new file mode 100644
index 000000000000..6db035354056
--- /dev/null
+++ b/system/valkey/valkey.logrotate
@@ -0,0 +1,9 @@
+/var/log/valkey/valkey.log {
+ daily
+ rotate 7
+ copytruncate
+ delaycompress
+ compress
+ notifempty
+ missingok
+}