diff --git a/.gitignore b/.gitignore index 386bb8e4d..c415418cf 100644 --- a/.gitignore +++ b/.gitignore @@ -10,18 +10,17 @@ core !**/keydb-sentinel.service.d *.log dump.rdb -src/keydb-server -**/bin/keydb-server -**/app/keydb-server +src/keydb-pro-server +bin/keydb-pro-server +app/keydb-pro-server *.deb *.rpm -keydb-pro-server src/keydb-cli -**/bin/keydb-cli -**/app/keydb-cli +bin/keydb-cli +app/keydb-cli src/keydb-sentinel -**/bin/keydb-sentinel -**/app/keydb-sentinel +bin/keydb-sentinel +app/keydb-sentinel redis-benchmark keydb-benchmark redis-check-aof @@ -33,7 +32,6 @@ keydb-check-dump redis-cli redis-sentinel redis-server -keydb-pro-server doc-tools release misc/* diff --git a/pkg/deb/README.md b/pkg/deb/README.md index 32f39762f..bbd41ca54 100644 --- a/pkg/deb/README.md +++ b/pkg/deb/README.md @@ -1,18 +1,14 @@ ### KeyDB DEB Package Source Builds -This directory contains scripts and components needed to generate debian packages on different distributions/architectures from source +This directory contains scripts and components needed to generate debian packages on different distributions/architectures using source -The 'debian' directory contains debian source code for bionic, buster and later distributions as it uses functions only available with debhelper11+. 'debian_dh9' is used for xenial, stretch and earlier distributions using debhelper9. - -You will need to install pbuilder `sudo apt install pbuilder` along with other distribution specific dependancies +You will need to install pbuilder `sudo apt install pbuilder` Generate deb packages with the following script command run from this directory: - ``` $ ./deb-buildsource.sh ``` - -This generates a directory structure, .dsc file, original.tar.gz, and new changelog for the distribution and architecture installed. +This generates a directory structure, .dsc file, original.tar.gz, .changes files and new changelog for the distribution and architecture installed. When complete the produced debian packages will be located in deb_files_generated directory. diff --git a/pkg/deb/deb-buildsource.sh b/pkg/deb/deb-buildsource.sh index c2884ad43..998c6ca4b 100755 --- a/pkg/deb/deb-buildsource.sh +++ b/pkg/deb/deb-buildsource.sh @@ -19,22 +19,18 @@ elif [ "$distributor" == "Ubuntu" ]; then fi codename=$(lsb_release --codename --short) date=$(date +%a," "%d" "%b" "%Y" "%T) -pkg_name=keydb-$majorv:$version$distname +pkg_name=keydb-pro-$version$distname # create build tree cd ../../../ -tar -czvf keydb_$version.orig.tar.gz --force-local KeyDB -cd KeyDB/pkg/deb/ +tar -czvf keydb-pro_$version.orig.tar.gz --force-local KeyDB-Pro +cd KeyDB-Pro/pkg/deb/ mkdir -p $pkg_name/tmp -if [[ "$codename" == "xenial" ]] || [[ "$codename" == "stretch" ]]; then - cp -r debian_dh9 $pkg_name/tmp/debian -else - cp -r debian $pkg_name/tmp -fi +cp -r debian $pkg_name/tmp cp master_changelog $pkg_name/tmp/debian/changelog -mv ../../../keydb_$version.orig.tar.gz ./$pkg_name +mv ../../../keydb-pro_$version.orig.tar.gz ./$pkg_name cd $pkg_name/tmp -changelog_str="keydb ($majorv:$version-$build$distname) $codename; urgency=medium\n\n * $version $changelog_comments \n\n -- Ben Schermel $date +0000\n\n" +changelog_str="keydb-pro ($version-$build$distname) $codename; urgency=medium\n\n * $version $changelog_comments \n\n -- Ben Schermel $date +0000\n\n" if [ $# -eq 0 ]; then sed -i "1s/^/$changelog_str\n/" debian/changelog elif [ $# -eq 1 ] && [ "$1" != "None" ]; then @@ -48,16 +44,12 @@ debuild -S -sa cd ../ # create pbuilder chrooted environment and build the deb package -if [ "$codename" == "xenial" ]; then - sudo pbuilder create --distribution $codename --othermirror "deb http://archive.ubuntu.com/ubuntu $codename universe multiverse" -else - sudo pbuilder create --distribution $codename -fi +sudo pbuilder create --distribution $codename sudo pbuilder --update -sudo pbuilder --build *.dsc +sudo pbuilder --build *.dsc --logfile /mnt/pbuilderlog.log # move new packages to deb_files_generated and clean up cp /var/cache/pbuilder/result/*$version*.deb ../deb_files_generated -sudo pbuilder clean +sudo pbuilder --autocleanaptcache cd ../ rm -rf $pkg_name diff --git a/pkg/deb/debian/bin/generate-systemd-service-files b/pkg/deb/debian/bin/generate-systemd-service-files index 14e23d50a..7778a06fb 100755 --- a/pkg/deb/debian/bin/generate-systemd-service-files +++ b/pkg/deb/debian/bin/generate-systemd-service-files @@ -9,7 +9,6 @@ else SYSTEMD_EXTRA=$(cat < Mon, 09 Oct 2017 22:17:24 +0100 EOF fi @@ -89,7 +94,7 @@ Documentation=https://docs.keydb.dev, man:${BINARY}(1) [Service] Type=forking -ExecStart=/usr/bin/${BINARY} /etc/keydb/${NAMESPACED}.conf +ExecStart=/usr/bin/${BINARY_NAME} /etc/keydb/${NAMESPACED}.conf ExecStop=/bin/kill -s TERM \$MAINPID PIDFile=/var/run/${NAMESPACED}/${BINARY}.pid TimeoutStopSec=0 diff --git a/pkg/deb/debian/control b/pkg/deb/debian/control index 077d493bc..b02f1be4e 100644 --- a/pkg/deb/debian/control +++ b/pkg/deb/debian/control @@ -1,4 +1,4 @@ -Source: keydb +Source: keydb-pro Section: database Priority: optional Maintainer: Ben Schermel @@ -6,6 +6,11 @@ Build-Depends: debhelper (>= 9~), dpkg-dev (>= 1.17.5), systemd, +# libhiredis-dev (>= 0.14.0), +# libjemalloc-dev [linux-any], +# liblua5.1-dev, +# lua-bitop-dev, +# lua-cjson-dev, procps , build-essential , tcl , @@ -19,14 +24,14 @@ Build-Depends: libssl-dev Standards-Version: 4.2.1 Homepage: https://docs.keydb.dev/ -Vcs-Git: https://github.com/JohnSully/KeyDB.git -Vcs-Browser: https://github.com/JohnSully/KeyDB +Vcs-Git: https://github.com/JohnSully/KeyDB-Pro.git +Vcs-Browser: https://github.com/JohnSully/KeyDB-Pro -Package: keydb +Package: keydb-pro Architecture: all Depends: - keydb-server (<< ${binary:Version}.1~), - keydb-server (>= ${binary:Version}), + keydb-pro-server (<< ${binary:Version}.1~), + keydb-pro-server (>= ${binary:Version}), ${misc:Depends}, Description: Persistent key-value database with network interface (metapackage) keydb is a key-value database in a similar vein to memcache but the dataset @@ -37,11 +42,11 @@ Description: Persistent key-value database with network interface (metapackage) . This package depends on the keydb-server package. -Package: keydb-sentinel +Package: keydb-pro-sentinel Architecture: any Depends: lsb-base (>= 3.2-14), - keydb-tools (= ${binary:Version}), + keydb-pro-tools (= ${binary:Version}), ${misc:Depends}, Description: Persistent key-value database with network interface (monitoring) keydb is a key-value database in a similar vein to memcache but the dataset @@ -50,11 +55,11 @@ Description: Persistent key-value database with network interface (monitoring) . This package contains the keydb Sentinel monitoring software. -Package: keydb-server +Package: keydb-pro-server Architecture: any Depends: lsb-base (>= 3.2-14), - keydb-tools (= ${binary:Version}), + keydb-pro-tools (= ${binary:Version}), ${misc:Depends}, Description: Persistent key-value database with network interface keydb is a key-value database in a similar vein to memcache but the dataset @@ -63,7 +68,7 @@ Description: Persistent key-value database with network interface . The dataset is stored entirely in memory and periodically flushed to disk. -Package: keydb-tools +Package: keydb-pro-tools Architecture: any Depends: adduser, diff --git a/pkg/deb/debian/keydb-pro-sentinel.1 b/pkg/deb/debian/keydb-pro-sentinel.1 new file mode 100644 index 000000000..782a40ff4 --- /dev/null +++ b/pkg/deb/debian/keydb-pro-sentinel.1 @@ -0,0 +1,23 @@ +.TH KEYDB-SENTINEL 1 "August 17, 2019" +.SH NAME +keydb-sentinel \- Persistent key-value database (cluster mode) +.SH SYNOPSIS +.B keydb-sentinel +.RI configfile +.SH DESCRIPTION +KeyDB is a key-value database. It is similar to memcached but the dataset is +not volatile and other datatypes (such as lists and sets) are natively +supported. +.PP +.SH OPTIONS +.IP "configfile" +Read options from specified configuration file. +.SH NOTES +On Debian GNU/Linux systems, \fBkeydb-sentinel\fP is typically started via the +\fB/etc/init.d/keydb-sentinel\fP initscript, not manually. This defaults to using +\fB/etc/keydb/sentinel.conf\fP as a configuration file. +.SH AUTHOR +\fBkeydb-sentinel\fP was written by John Sully, originating as a fork of Redis. Redis was written by Salvatore Sanfilippo. +.PP +This manual page was written by Chris Lamb for the Debian +project (but may be used by others). Modified by Ben Schermel diff --git a/pkg/deb/debian/keydb-pro-sentinel.install b/pkg/deb/debian/keydb-pro-sentinel.install new file mode 100644 index 000000000..524d7867b --- /dev/null +++ b/pkg/deb/debian/keydb-pro-sentinel.install @@ -0,0 +1,2 @@ +debian/keydb-sentinel.service /lib/systemd/system/ +pkg/deb/conf/sentinel.conf /etc/keydb diff --git a/pkg/deb/debian/keydb-pro-sentinel.logrotate b/pkg/deb/debian/keydb-pro-sentinel.logrotate new file mode 100644 index 000000000..185010396 --- /dev/null +++ b/pkg/deb/debian/keydb-pro-sentinel.logrotate @@ -0,0 +1,7 @@ +/var/log/keydb/keydb-sentinel*.log { + weekly + missingok + rotate 12 + compress + notifempty +} diff --git a/pkg/deb/debian/keydb-pro-sentinel.manpages b/pkg/deb/debian/keydb-pro-sentinel.manpages new file mode 100644 index 000000000..08ce51ff5 --- /dev/null +++ b/pkg/deb/debian/keydb-pro-sentinel.manpages @@ -0,0 +1 @@ +debian/keydb-pro-sentinel.1 diff --git a/pkg/deb/debian/keydb-pro-sentinel.postinst b/pkg/deb/debian/keydb-pro-sentinel.postinst new file mode 100644 index 000000000..787464165 --- /dev/null +++ b/pkg/deb/debian/keydb-pro-sentinel.postinst @@ -0,0 +1,26 @@ +#!/bin/sh + +set -eu + +USER="keydb" +GROUP="$USER" +CONFFILE="/etc/keydb/sentinel.conf" + +if [ "$1" = "configure" ] +then + if ! dpkg-statoverride --list ${CONFFILE} >/dev/null 2>&1 + then + dpkg-statoverride --update --add ${USER} ${GROUP} 640 ${CONFFILE} + fi +fi + +#DEBHELPER# + +if [ "$1" = "configure" ] +then + find /etc/keydb -maxdepth 1 -type d -name 'keydb-sentinel.*.d' -empty -delete +fi + +systemctl daemon-reload + +exit 0 diff --git a/pkg/deb/debian/keydb-pro-sentinel.postrm b/pkg/deb/debian/keydb-pro-sentinel.postrm new file mode 100644 index 000000000..2ce8771df --- /dev/null +++ b/pkg/deb/debian/keydb-pro-sentinel.postrm @@ -0,0 +1,16 @@ +#!/bin/sh + +set -eu + +CONFFILE="/etc/keydb/sentinel.conf" + +if [ "$1" = "purge" ] +then + dpkg-statoverride --remove ${CONFFILE} || test $? -eq 2 +fi + +#DEBHELPER# + +systemctl daemon-reload + +exit 0 diff --git a/pkg/deb/debian/keydb-pro-server.1 b/pkg/deb/debian/keydb-pro-server.1 new file mode 100644 index 000000000..2bac395f8 --- /dev/null +++ b/pkg/deb/debian/keydb-pro-server.1 @@ -0,0 +1,23 @@ +.TH KEYDB-SERVER 1 "August 17, 2019" +.SH NAME +keydb-server \- Persistent key-value database +.SH SYNOPSIS +.B keydb-server +.RI configfile +.SH DESCRIPTION +KeyDB is a key-value database. It is similar to memcached but the dataset is +not volatile and other datatypes (such as lists and sets) are natively +supported. +.PP +.SH OPTIONS +.IP "configfile" +Read options from specified configuration file. +.SH NOTES +On Debian GNU/Linux systems, \fBkeydb-server\fP is typically started via the +\fB/etc/init.d/keydb-server\fP initscript, not manually. This defaults to using +\fB/etc/keydb/keydb.conf\fP as a configuration file. +.SH AUTHOR +\fBkeydb-server\fP was written by John Sully, originating as a fork of Redis. Redis was written by Salvatore Sanfilippo. +.PP +This manual page was written by Chris Lamb for the Debian +project (but may be used by others). Modified by Ben Schermel diff --git a/pkg/deb/debian/keydb-pro-server.docs b/pkg/deb/debian/keydb-pro-server.docs new file mode 100644 index 000000000..b43bf86b5 --- /dev/null +++ b/pkg/deb/debian/keydb-pro-server.docs @@ -0,0 +1 @@ +README.md diff --git a/pkg/deb/debian/keydb-pro-server.install b/pkg/deb/debian/keydb-pro-server.install new file mode 100644 index 000000000..8a82461af --- /dev/null +++ b/pkg/deb/debian/keydb-pro-server.install @@ -0,0 +1,2 @@ +debian/keydb-server.service /lib/systemd/system/ +pkg/deb/conf/keydb.conf /etc/keydb diff --git a/pkg/deb/debian/keydb-pro-server.logrotate b/pkg/deb/debian/keydb-pro-server.logrotate new file mode 100644 index 000000000..78d0a53ea --- /dev/null +++ b/pkg/deb/debian/keydb-pro-server.logrotate @@ -0,0 +1,7 @@ +/var/log/keydb/keydb-server*.log { + weekly + missingok + rotate 12 + compress + notifempty +} diff --git a/pkg/deb/debian/keydb-pro-server.manpages b/pkg/deb/debian/keydb-pro-server.manpages new file mode 100644 index 000000000..06ff67ee3 --- /dev/null +++ b/pkg/deb/debian/keydb-pro-server.manpages @@ -0,0 +1 @@ +debian/keydb-pro-server.1 diff --git a/pkg/deb/debian/keydb-pro-server.postinst b/pkg/deb/debian/keydb-pro-server.postinst new file mode 100644 index 000000000..9d48ee638 --- /dev/null +++ b/pkg/deb/debian/keydb-pro-server.postinst @@ -0,0 +1,26 @@ +#!/bin/sh + +set -eu + +USER="keydb" +GROUP="$USER" +CONFFILE="/etc/keydb/keydb.conf" + +if [ "$1" = "configure" ] +then + if ! dpkg-statoverride --list ${CONFFILE} >/dev/null 2>&1 + then + dpkg-statoverride --update --add ${USER} ${GROUP} 640 ${CONFFILE} + fi +fi + +#DEBHELPER# + +if [ "$1" = "configure" ] +then + find /etc/keydb -maxdepth 1 -type d -name 'keydb-server.*.d' -empty -delete +fi + +systemctl daemon-reload + +exit 0 diff --git a/pkg/deb/debian/keydb-pro-server.postrm b/pkg/deb/debian/keydb-pro-server.postrm new file mode 100644 index 000000000..cf57953c3 --- /dev/null +++ b/pkg/deb/debian/keydb-pro-server.postrm @@ -0,0 +1,16 @@ +#!/bin/sh + +set -eu + +CONFFILE="/etc/keydb/keydb.conf" + +if [ "${1}" = "purge" ] +then + dpkg-statoverride --remove ${CONFFILE} || test $? -eq 2 +fi + +#DEBHELPER# + +systemctl daemon-reload + +exit 0 diff --git a/pkg/deb/debian/keydb-pro-tools.examples b/pkg/deb/debian/keydb-pro-tools.examples new file mode 100644 index 000000000..7f796a1b4 --- /dev/null +++ b/pkg/deb/debian/keydb-pro-tools.examples @@ -0,0 +1,2 @@ +src/redis-trib.rb +utils/lru diff --git a/pkg/deb/debian/keydb-pro-tools.install b/pkg/deb/debian/keydb-pro-tools.install new file mode 100644 index 000000000..6978cc7cd --- /dev/null +++ b/pkg/deb/debian/keydb-pro-tools.install @@ -0,0 +1,6 @@ +debian/bash_completion.d/* /usr/share/bash-completion/completions +src/keydb-benchmark /usr/bin +src/keydb-check-aof /usr/bin +src/keydb-check-rdb /usr/bin +src/keydb-cli /usr/bin +src/keydb-pro-server /usr/bin diff --git a/pkg/deb/debian/keydb-pro-tools.manpages b/pkg/deb/debian/keydb-pro-tools.manpages new file mode 100644 index 000000000..bfe26d2d6 --- /dev/null +++ b/pkg/deb/debian/keydb-pro-tools.manpages @@ -0,0 +1,4 @@ +debian/keydb-benchmark.1 +debian/keydb-check-aof.1 +debian/keydb-check-rdb.1 +debian/keydb-cli.1 diff --git a/pkg/deb/debian/keydb-pro-tools.postinst b/pkg/deb/debian/keydb-pro-tools.postinst new file mode 100644 index 000000000..0007d887f --- /dev/null +++ b/pkg/deb/debian/keydb-pro-tools.postinst @@ -0,0 +1,47 @@ +#!/bin/sh + +set -eu + +USER="keydb" + +Setup_dir () { + DIR="${1}" + MODE="${2}" + GROUP="${3}" + + mkdir -p ${DIR} + + case "${DIR}" in + /var/log/keydb) + MODE="02750" + GROUP="adm" + ;; + *) + MODE="750" + GROUP="${USER}" + ;; + esac + + if ! dpkg-statoverride --list ${DIR} >/dev/null 2>&1 + then + chown ${USER}:${GROUP} ${DIR} + chmod ${MODE} ${DIR} + fi +} + +if [ "$1" = "configure" ] +then + adduser \ + --system \ + --home /var/lib/keydb \ + --quiet \ + --group \ + ${USER} || true + + Setup_dir /var/log/keydb ${USER}:adm 2750 + Setup_dir /var/lib/keydb ${USER}:${USER} 750 +fi + +#DEBHELPER# + +exit 0 diff --git a/pkg/deb/debian/keydb-pro-tools.postrm b/pkg/deb/debian/keydb-pro-tools.postrm new file mode 100644 index 000000000..60c932435 --- /dev/null +++ b/pkg/deb/debian/keydb-pro-tools.postrm @@ -0,0 +1,13 @@ +#!/bin/sh + +set -eu + +if [ "${1}" = "purge" ] +then + userdel keydb || true + rm -rf /var/lib/keydb /var/log/keydb +fi + +#DEBHELPER# + +exit 0 diff --git a/pkg/deb/debian/rules b/pkg/deb/debian/rules index a039b220f..bc14ea0f6 100755 --- a/pkg/deb/debian/rules +++ b/pkg/deb/debian/rules @@ -18,14 +18,13 @@ endif override_dh_auto_install: debian/bin/generate-systemd-service-files - dh_installsystemd --restart-after-upgrade override_dh_auto_test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) # Avoid race conditions in upstream testsuite. - ./runtest || true - ./runtest-cluster || true - ./runtest-sentinel || true +# ./runtest --clients 1 || true +# ./runtest-cluster || true +# ./runtest-sentinel || true endif override_dh_auto_clean: diff --git a/pkg/deb/master_changelog b/pkg/deb/master_changelog index f7046ffe1..cb43b4537 100644 --- a/pkg/deb/master_changelog +++ b/pkg/deb/master_changelog @@ -1,24 +1,12 @@ -keydb (6:6.0.9-1distribution_placeholder) codename_placeholder; urgency=medium +keydb (6.0.7-1distribution_placeholder) codename_placeholder; urgency=medium - * 6.0.9 Addressing issues 187 - cpu lockup with subkey expire, 190 - missing sentinel binary in keydb-tools. - - -- Ben Schermel Sun, 07 Jun 2020 18:00:37 +0000 - -keydb (6:6.0.8-1distribution_placeholder) codename_placeholder; urgency=medium - - * This is our first release to fully support all Redis 6.0.4 features, including but not limited to: TLS Support (fully supports multithreading!), Client side caching, RESP 3 Support - * KeyDB Has also added the following new features: Improved memory efficiency for short strings, Fastlock autotuning, KeyDB.HRENAME (rename a member of a hash)In addition we've spent a lot of time focussing on stability. - * The following bug fixes are resolved: 150 - Deadlock in ReplicationFeedMonitors, 170 - KeyDB dying via SIGABORT, 180 - crash after setting maxclients via cmd line, 169 - Write performance of a master dropped sharply when a slave is added - * In addition untracked issues were resolved: Potential deadlock when entering futex sleep, Pub/Sub Async messages may not be sent in a timely manner when load is low, Excessive logging during failed RREPLAY, KeyDB unresponsive handling clients on different threads during RDB load - * Updated deb package builds to build from source and phasing out init.d. dh_installsystemd from deb helper 11 used where applicable - * Naming conventions are now updated [ keydbpackage_version-build~distribution_architecture] and master changelog included and maintained - * keydb-pro-server binary is no longer inluded in the open source package - - -- Ben Schermel Mon, 1 Jun 2020 8:00:37 +0000 - -keydb (5:5.3.3-1distribution_placeholder) codename_placeholder; urgency=medium - - * 5.3.3 Updating deb source package, naming conventions, and build scripts. + * 6.0.7 Updating builds from deb source package + * Naming conventions are now updated + * Builds now genrated accross different distributions/architectures automatically. + * Same changelog used for all distribitions/architectures and will be updated on each release + * init.d has been phased out and scripts updated to use systemd only + * keydb-pro=server binary is no longer inluded in the open source package + * see github pkg directory for debian code and build scripts used in distributions -- Ben Schermel Wed, 06 May 2020 8:00:37 +0000 diff --git a/pkg/docker/Dockerfile b/pkg/docker/Dockerfile index dce45ef53..4ac80a77d 100644 --- a/pkg/docker/Dockerfile +++ b/pkg/docker/Dockerfile @@ -15,6 +15,7 @@ RUN set -eux; \ gnupg \ wget \ ; \ +# rm -rf /var/lib/apt/lists/*; \ \ dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ @@ -38,14 +39,13 @@ RUN set -eux; \ gosu nobody true # Load pre-generated equivalent binaries to image (reduces deployment build times) -RUN \ - mkdir -p /etc/keydb -ADD ./app/keydb-* /usr/local/bin/ -ADD ./app/docker-entrypoint.sh /usr/local/bin/ -ADD ./app/*.conf /etc/keydb/ +ADD ./app/* /usr/local/bin/ + # Set up config and binaries RUN \ cd /usr/local/bin && \ + mkdir -p /etc/keydb && \ + mv -f *.conf /etc/keydb && \ sed -i 's/^\(bind .*\)$/# \1/' /etc/keydb/keydb.conf && \ sed -i 's/^\(daemonize .*\)$/# \1/' /etc/keydb/keydb.conf && \ sed -i 's/^\(dir .*\)$/# \1\ndir \/data/' /etc/keydb/keydb.conf && \ @@ -55,7 +55,8 @@ RUN \ cd /etc/keydb && \ ln -s keydb.conf redis.conf -# Ensure deps installed for binaries +# Ensure deps installed for binaries (including Pro) +# libc6 (>= 2.17), libcurl4 (>= 7.16.2), libgcc1 (>= 1:3.0), libstdc++6 (>= 4.8.1), libuuid1 (>= 2.16), libssl1.1 (>= 1.1.1) RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ @@ -67,12 +68,20 @@ RUN set -eux; \ libstdc++6 \ libgcc1 \ zlib1g \ - libbz2-1.0 \ - liblz4-1 \ - libsnappy1v5 \ - libzstd1 \ ; \ - rm -rf /var/lib/apt/lists/* + rm -rf /var/lib/apt/lists/*; \ + \ + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false # create working directories RUN \ @@ -88,4 +97,4 @@ ENTRYPOINT ["docker-entrypoint.sh"] # Expose container port and start KeyDB by default on running container EXPOSE 6379 -CMD ["keydb-server", "/etc/keydb/keydb.conf"] +CMD ["keydb-pro-server", "/etc/keydb/keydb.conf"] diff --git a/pkg/rpm/README.md b/pkg/rpm/README.md index df50883e4..daa245359 100644 --- a/pkg/rpm/README.md +++ b/pkg/rpm/README.md @@ -1,6 +1,6 @@ ### Generate RPM files for the generated binaries -After running make to produce keydb binaries you can run the following script to create rpm package +After making the binaries you can run the following script Usage: ``` diff --git a/pkg/rpm/generate_rpms.sh b/pkg/rpm/generate_rpms.sh index ab5eefefb..9416dbaf5 100755 --- a/pkg/rpm/generate_rpms.sh +++ b/pkg/rpm/generate_rpms.sh @@ -1,38 +1,39 @@ #! /bin/bash ### usage sudo ./generate_rpms -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -version=$(grep KEYDB_REAL_VERSION $DIR/../../src/version.h | awk '{ printf $3 }' | tr -d \") + +version=$(grep KEYDB_REAL_VERSION ../../src/version.h | awk '{ printf $3 }' | tr -d \") release=1 # by default this will always be 1 for keydb version structure. If build release version needs to be update you can modify here arch=$(uname -m) -dist=el$(rpm -q --queryformat '%{VERSION}' centos-release | cut -d. -f1) +dist=el$(rpm -q --queryformat '%{VERSION}' centos-release) -if [[ "$arch" != "aarch64" ]] && [[ "$arch" != "x86_64" ]]; then +if [ "$arch" != "aarch64" ] || [ "$arch" != "x86_64" ]; then echo "This script is only valid and tested for aarch64 and x86_64 architectures. You are trying to use: $arch" fi # remove any old rpm packages -rm $DIR/rpm_files_generated/keydb* +rm $PWD/rpm_files_generated/keydb* # generate empty directories that github would otherwise delete (avoids .gitkeep in directory) -mkdir -p $DIR/keydb_build/keydb_rpm/usr/bin -mkdir -p $DIR/keydb_build/keydb_rpm/usr/lib64/redis/modules -mkdir -p $DIR/keydb_build/keydb_rpm/var/lib/keydb -mkdir -p $DIR/keydb_build/keydb_rpm/var/log/keydb +mkdir $PWD/keydb_build/keydb_rpm/usr/bin +mkdir $PWD/keydb_build/keydb_rpm/usr/lib64/redis/modules +mkdir $PWD/keydb_build/keydb_rpm/var/lib/keydb +mkdir $PWD/keydb_build/keydb_rpm/var/log/keydb # move binaries to bin -rm $DIR/keydb_build/keydb_rpm/usr/bin/* -cp $DIR/../../src/keydb-* $DIR/keydb_build/keydb_rpm/usr/bin/ +rm $PWD/keydb_build/keydb_rpm/usr/bin/* +cp $PWD/../../src/keydb-* $PWD/keydb_build/keydb_rpm/usr/bin/ # update spec file with build info -sed -i '2d' $DIR/keydb_build/keydb.spec -sed -i -E "1a\Version : $version" $DIR/keydb_build/keydb.spec -sed -i '3d' $DIR/keydb_build/keydb.spec -sed -i -E "2a\Release : $release%{?dist}" $DIR/keydb_build/keydb.spec +sed -i '2d' $PWD/keydb_build/keydb.spec +sed -i -E "1a\Version : $version" $PWD/keydb_build/keydb.spec +sed -i '3d' $PWD/keydb_build/keydb.spec +sed -i -E "2a\Release : $release%{?dist}" $PWD/keydb_build/keydb.spec -mkdir -p /root/rpmbuild/BUILDROOT/keydb-$version-$release.$dist.$arch -cp -r $DIR/keydb_build/keydb_rpm/* /root/rpmbuild/BUILDROOT/keydb-$version-$release.$dist.$arch/ -rpmbuild -bb $DIR/keydb_build/keydb.spec -mv /root/rpmbuild/RPMS/$arch/* $DIR/rpm_files_generated +# yum install -y scl-utils centos-release-scl rpm-build +mkdir -p /root/rpmbuild/BUILDROOT/keydb-pro-$version-$release.$dist.$arch +cp -r ./keydb_build/keydb_rpm/* /root/rpmbuild/BUILDROOT/keydb-pro-$version-$release.$dist.$arch/ +rpmbuild -bb /rpm_build/keydb.spec +mv /root/rpmbuild/RPMS/$arch/* .$PWD/rpm_files_generated exit diff --git a/pkg/rpm/keydb_build/keydb.spec b/pkg/rpm/keydb_build/keydb.spec index 459a286b1..8c47c178c 100755 --- a/pkg/rpm/keydb_build/keydb.spec +++ b/pkg/rpm/keydb_build/keydb.spec @@ -1,5 +1,5 @@ -Name : keydb -Version : 5.3.3 +Name : keydb-pro +Version : 6.0.5 Release : 1%{?dist} Group : Unspecified License : BSD @@ -8,7 +8,6 @@ Packager : EQ Alpha Technology URL : https://keydb.dev Summary : A persistent key-value database - Requires: /bin/awk Requires: logrotate Requires(pre): shadow-utils @@ -28,7 +27,7 @@ getent group keydb &> /dev/null || \ groupadd -r keydb &> /dev/null getent passwd keydb &> /dev/null || \ useradd -r -g keydb -d /var/lib/keydb -s /sbin/nologin \ --c 'KeyDB Database Server' keydb &> /dev/null +-c 'KeyDB Professional Database Server' keydb &> /dev/null exit 0 #postinstall scriptlet (using /bin/sh): diff --git a/pkg/rpm/keydb_build/keydb_rpm/usr/bin/keydb-cli b/pkg/rpm/keydb_build/keydb_rpm/usr/bin/keydb-cli new file mode 100755 index 000000000..77760b391 Binary files /dev/null and b/pkg/rpm/keydb_build/keydb_rpm/usr/bin/keydb-cli differ diff --git a/pkg/rpm/keydb_build/keydb_rpm/usr/bin/keydb-sentinel b/pkg/rpm/keydb_build/keydb_rpm/usr/bin/keydb-sentinel new file mode 100755 index 000000000..1351a6645 Binary files /dev/null and b/pkg/rpm/keydb_build/keydb_rpm/usr/bin/keydb-sentinel differ diff --git a/pkg/rpm/keydb_build/keydb_rpm/usr/lib/systemd/system/keydb-sentinel.service b/pkg/rpm/keydb_build/keydb_rpm/usr/lib/systemd/system/keydb-sentinel.service index 12e853025..3ea61fa9a 100755 --- a/pkg/rpm/keydb_build/keydb_rpm/usr/lib/systemd/system/keydb-sentinel.service +++ b/pkg/rpm/keydb_build/keydb_rpm/usr/lib/systemd/system/keydb-sentinel.service @@ -1,7 +1,7 @@ [Unit] Description=Advanced key-value store After=network.target -Documentation=https://docs.keydb.dev, man:keydb-sentinel(1) +Documentation=http://keydb.io/documentation, man:keydb-sentinel(1) [Service] Type=forking diff --git a/pkg/rpm/keydb_build/keydb_rpm/usr/lib/systemd/system/keydb.service b/pkg/rpm/keydb_build/keydb_rpm/usr/lib/systemd/system/keydb.service index e36f5f2cf..861c7a384 100755 --- a/pkg/rpm/keydb_build/keydb_rpm/usr/lib/systemd/system/keydb.service +++ b/pkg/rpm/keydb_build/keydb_rpm/usr/lib/systemd/system/keydb.service @@ -5,7 +5,7 @@ Documentation=https://docs.keydb.dev, man:keydb-server(1) [Service] Type=forking -ExecStart=/usr/bin/keydb-server /etc/keydb/keydb.conf +ExecStart=/usr/bin/keydb-pro-server /etc/keydb/keydb.conf ExecStop=/bin/kill -s TERM $MAINPID PIDFile=/var/run/keydb/keydb-server.pid TimeoutStopSec=0