Skip to content

Commit

Permalink
Drop support for Valkey in favor of the libvmod-valkey project
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosabalde committed Dec 17, 2024
1 parent 66384e1 commit cf27f85
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 37 deletions.
18 changes: 2 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ jobs:

strategy:
matrix:
db_engine:
- redis
- valkey
cc:
- gcc
- clang
Expand All @@ -22,8 +19,7 @@ jobs:
configure_flags:
- ''
include:
- db_engine: redis
cc: gcc
- cc: gcc
make_target: lcov
configure_flags: --enable-code-coverage

Expand Down Expand Up @@ -69,22 +65,12 @@ jobs:
sudo ldconfig
popd
- name: Install Valkey
run: |
wget --no-check-certificate https://github.com/valkey-io/valkey/archive/refs/tags/8.0.1.tar.gz -O valkey-8.0.1.tar.gz
tar zxvf valkey-*.tar.gz
pushd valkey-*/
make BUILD_TLS=yes
sudo make BUILD_TLS=yes PREFIX='/usr/local' USE_REDIS_SYMLINKS=no install
sudo ldconfig
popd
- name: Build & test VMOD
run: |
./autogen.sh
CC='${{ matrix.cc }}' ./configure --prefix=/usr ${{ matrix.configure_flags }}
make -j4
DB_ENGINE='${{ matrix.db_engine }}' make ${{ matrix.make_target }} -j1
make ${{ matrix.make_target }} -j1
- name: Push code coverage
if: ${{ matrix.make_target == 'lcov' }}
Expand Down
9 changes: 0 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,5 @@ RUN cd /tmp \
&& make BUILD_TLS=yes PREFIX='/usr/local' install \
&& ldconfig

RUN cd /tmp \
&& wget --no-check-certificate https://github.com/valkey-io/valkey/archive/refs/tags/8.0.1.tar.gz -O valkey-8.0.1.tar.gz \
&& tar zxvf valkey-*.tar.gz \
&& rm -f valkey-*.tar.gz \
&& cd valkey-* \
&& make BUILD_TLS=yes \
&& make BUILD_TLS=yes PREFIX='/usr/local' USE_REDIS_SYMLINKS=no install \
&& ldconfig

COPY ./docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
:alt: Codecov badge
:target: https://codecov.io/gh/carlosabalde/libvmod-redis

VMOD using the `synchronous hiredis library API <https://github.com/redis/hiredis>`_ to access Redis servers from VCL.
VMOD using the `synchronous hiredis library API <https://github.com/redis/hiredis>`_ to access Redis servers from VCL. For a libvalkey + Valkey alternative, please, chec the `libvmod-redis VMOD <https://github.com/carlosabalde/libvmod-valkey>`_ project.

Highlights:

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# $ ./autogen.sh
# $ ./configure
# $ make
# $ DB_ENGINE=valkey make check
# $ make check
# $ docker compose down --volumes --remove-orphans
#

Expand Down
19 changes: 9 additions & 10 deletions src/tests/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
##
IPV6=0

DB_ENGINE=${DB_ENGINE:-redis}
DB_STANDALONE_MASTER_SERVERS=2
DB_STANDALONE_SLAVE_SERVERS=2
DB_STANDALONE_SENTINEL_SERVERS=3
Expand Down Expand Up @@ -64,8 +63,8 @@ trap "cleanup $TMP" EXIT
##
## Check CLI is available & get DB version. Fail test if DB is not available.
##
if [ -x "$(command -v $DB_ENGINE-cli)" ]; then
VERSION=$($DB_ENGINE-cli --version | sed "s/^$DB_ENGINE-cli \([^ ]*\).*$/\1/" | awk -F. '{ printf("%d%03d%03d\n", $1, $2, $3) }')
if [ -x "$(command -v redis-cli)" ]; then
VERSION=$(redis-cli --version | sed "s/^redis-cli \([^ ]*\).*$/\1/" | awk -F. '{ printf("%d%03d%03d\n", $1, $2, $3) }')
CONTEXT="\
$CONTEXT \
-Dredis_version=$VERSION \
Expand Down Expand Up @@ -116,7 +115,7 @@ EOF
enable-debug-command local
EOF
fi
$DB_ENGINE-server "$TMP/db-master$MASTER_INDEX.conf"
redis-server "$TMP/db-master$MASTER_INDEX.conf"
CONTEXT="\
$CONTEXT \
-Dredis_master${MASTER_INDEX}_ip=$MASTER_IP \
Expand Down Expand Up @@ -145,7 +144,7 @@ EOF
tls-ca-cert-file $ROOT/assets/tls-ca-certificate.crt
EOF
fi
$DB_ENGINE-server "$TMP/db-slave${MASTER_INDEX}_$SLAVE_INDEX.conf"
redis-server "$TMP/db-slave${MASTER_INDEX}_$SLAVE_INDEX.conf"
CONTEXT="\
$CONTEXT \
-Dredis_slave${MASTER_INDEX}_${SLAVE_INDEX}_ip=$SLAVE_IP \
Expand Down Expand Up @@ -184,7 +183,7 @@ EOF
tls-ca-cert-file $ROOT/assets/tls-ca-certificate.crt
EOF
fi
$DB_ENGINE-server "$TMP/db-sentinel$INDEX.conf" --sentinel
redis-server "$TMP/db-sentinel$INDEX.conf" --sentinel
CONTEXT="\
$CONTEXT \
-Dredis_sentinel${INDEX}_ip=$SENTINEL_IP \
Expand Down Expand Up @@ -224,7 +223,7 @@ EOF
tls-ca-cert-file $ROOT/assets/tls-ca-certificate.crt
EOF
fi
$DB_ENGINE-server "$TMP/db-server$INDEX.conf"
redis-server "$TMP/db-server$INDEX.conf"
CONTEXT="\
$CONTEXT \
-Dredis_server${INDEX}_ip=$IP \
Expand All @@ -237,15 +236,15 @@ EOF
# Wait for all nodes to bootstrap and then set up the cluster.
sleep 1
if [ "$VERSION" -ge '5000000' ]; then
yes yes | $DB_ENGINE-cli --cluster create $SERVERS --cluster-replicas $DB_CLUSTER_REPLICAS > /dev/null
yes yes | redis-cli --cluster create $SERVERS --cluster-replicas $DB_CLUSTER_REPLICAS > /dev/null
else
yes yes | redis-trib.rb create --replicas $DB_CLUSTER_REPLICAS $SERVERS > /dev/null
fi

# Wait for cluster formation in a rudementary way.
[[ $IPV6 = 1 ]] && HOST=::1 || HOST=127.0.0.1
[[ $IPV6 = 1 ]] && PATTERN=::1 || PATTERN=127[.]0[.]0[.]
while [ $($DB_ENGINE-cli -h $HOST -p $((DB_CLUSTER_START_PORT+1)) CLUSTER SLOTS | grep "$PATTERN" | wc -l) -lt $DB_CLUSTER_SERVERS ]; do
while [ $(redis-cli -h $HOST -p $((DB_CLUSTER_START_PORT+1)) CLUSTER SLOTS | grep "$PATTERN" | wc -l) -lt $DB_CLUSTER_SERVERS ]; do
sleep 1
done
sleep 1
Expand All @@ -263,7 +262,7 @@ EOF
-Dredis_master${INDEX}_port=$(echo $LINE | cut -f 2 -d ' ' | cut -f 1 -d '@' | rev | cut -f 1 -d ':' | rev) \
-Dredis_key_in_master${INDEX}=$(grep "^$(echo $LINE | cut -f 9 -d ' ' | cut -f 1 -d '-'): " $ROOT/assets/hashslot-keys.txt | cut -f 2 -d ' ')"
INDEX=$(( INDEX + 1 ))
done <<< "$($DB_ENGINE-cli -h $HOST -p $((DB_CLUSTER_START_PORT+1)) CLUSTER NODES | grep master | sort -k 9 -n)"
done <<< "$(redis-cli -h $HOST -p $((DB_CLUSTER_START_PORT+1)) CLUSTER NODES | grep master | sort -k 9 -n)"
fi

##
Expand Down

0 comments on commit cf27f85

Please sign in to comment.