Skip to content

Commit

Permalink
Replace redis with valkey
Browse files Browse the repository at this point in the history
Signed-off-by: William Douglas <[email protected]>
  • Loading branch information
bryteise committed Jan 7, 2025
1 parent 416e857 commit 52fb1c1
Show file tree
Hide file tree
Showing 16 changed files with 153 additions and 156 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
name: Release Matrix
strategy:
matrix:
image: ['cgit', 'golang', 'haproxy', 'iperf', 'mariadb', 'memcached', 'nginx', 'node', 'numpy-mp', 'perl', 'php', 'php-fpm', 'postgres', 'python', 'rabbitmq', 'r-base', 'redis', 'ruby', 'tesseract-ocr']
image: ['cgit', 'golang', 'haproxy', 'iperf', 'mariadb', 'memcached', 'nginx', 'node', 'numpy-mp', 'perl', 'php', 'php-fpm', 'postgres', 'python', 'rabbitmq', 'r-base', 'ruby', 'tesseract-ocr', 'valkey']
runs-on: ubuntu-latest
steps:
- name: Code Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
- postgres
- python
- rabbitmq
- redis
- ruby
- valkey
steps:
- uses: actions/checkout@v1
- name: install
Expand Down
2 changes: 1 addition & 1 deletion FaaS/OpenFaaS/template/numpy-mp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ It can leverage AVX512 advantage and set OMP_NUM_THREADS dynamically at runtime
* Put the required python packages in the "requirements.txt".
For example,

`echo "redis" >> numpy-openfaas/requirements.txt`
`echo "valkey" >> numpy-openfaas/requirements.txt`
`echo "flask" >> numpy-openfaas/requirements.txt`

* Put the required Clear Linux bundles in the "bundles.txt".
Expand Down
2 changes: 1 addition & 1 deletion FaaS/OpenFaaS/template/python3-clearlinux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This template is based on [clearlinux/python:3](https://hub.docker.com/r/clearli
* Put the required python packages in the "requirements.txt".
For example,

`echo "redis" >> hello-openfaas/requirements.txt`
`echo "valkey" >> hello-openfaas/requirements.txt`
`echo "flask" >> hello-openfaas/requirements.txt`

* Put the required Clear Linux bundles in the "bundles.txt".
Expand Down
16 changes: 8 additions & 8 deletions tests/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ The test cases are for the Containers already added in the Actions CI.
So for any Containers name defined in the matrix.node of .github/workflows/
tests.yml, the same name directory could be added in the directory "tests".
And the same name BAT script in the new added directory will be executed for
each PR/commits. For example, redis.
* First, the redis name is added in the matrix.node.
each PR/commits. For example, valkey.
* First, the valkey name is added in the matrix.node.
```
matrix:
node: ["redis"]
node: ["valkey"]
```

* Second, create the "redis" directory and BAT script under tests
* Second, create the "valkey" directory and BAT script under tests
```
dockerfiles
└── tests
└── redis
└── redis.bats
   └── redis-security.bats
└── valkey
└── valkey.bats
   └── valkey-security.bats
```

* Last, develop the redis BAT test cases in "redis.bats" and "redis-security.bats" following the above
* Last, develop the valkey BAT test cases in "valkey.bats" and "valkey-security.bats" following the above
principles.
2 changes: 1 addition & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ The dockerfiles are from [page](https://github.com/clearlinux/dockerfiles). The

To run the tests, you can simple type "make tests", it will run all the test cases.
If you want to run specific Container test, just type "make SERVICE-NAME".
For example, "make redis" to run tests for redis.
For example, "make valkey" to run tests for valkey.


53 changes: 0 additions & 53 deletions tests/redis/redis-security.bats

This file was deleted.

51 changes: 0 additions & 51 deletions tests/redis/redis.bats

This file was deleted.

53 changes: 53 additions & 0 deletions tests/valkey/valkey-security.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env bats
# Copyright (C) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

load ../utils
load ../security

@test "1191 test" {
# start container first
docker run --name valkey-server --detach ghcr.io/clearlinux/valkey
run check_container_status valkey-server
[ "$status" -eq 0 ]
run Test_1191 ghcr.io/clearlinux/valkey
[ "$output" == "pass" ]

# stop the container
docker rm -f valkey-server
sleep 3
run check_container_status valkey-server
[ "$status" -eq 1 ]
}

@test "1195 test" {
# start container first
docker run --name valkey-server --detach ghcr.io/clearlinux/valkey
run check_container_status valkey-server
[ "$status" -eq 0 ]
run Test_1195 ghcr.io/clearlinux/valkey
[ "$output" == "pass" ]

# stop the container
docker rm -f valkey-server
sleep 3
run check_container_status valkey-server
[ "$status" -eq 1 ]
}

@test "1215 test" {
# start container first
docker run --name valkey-server --detach --security-opt=no-new-privileges ghcr.io/clearlinux/valkey
run check_container_status valkey-server
[ "$status" -eq 0 ]
run Test_1215 ghcr.io/clearlinux/valkey
[ "$output" == "pass" ]

# stop the container
docker rm -f valkey-server
sleep 3
run check_container_status valkey-server
[ "$status" -eq 1 ]
}


51 changes: 51 additions & 0 deletions tests/valkey/valkey.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bats
# Copyright (C) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

load ../utils

@test "valkey LPUSH test" {
# start the container first
docker run --name valkey-server --rm -d ghcr.io/clearlinux/valkey valkey-server --protected-mode no
sleep 5
run check_container_status valkey-server
[ "$status" -eq 0 ]

# get ip address
run get_container_ip valkey-server
[ "$status" -eq 0 ]
ipaddr="$output"

# push two integers
docker run --rm ghcr.io/clearlinux/valkey redis-cli -h $ipaddr lpush mylist x
docker run --rm ghcr.io/clearlinux/valkey redis-cli -h $ipaddr lpush mylist y

# stop the container
docker stop valkey-server
sleep 3
run check_container_status valkey-server
[ "$status" -eq 1 ]
}

@test "valkey LRANGE test" {
# start tje container first
docker run --name valkey-server --rm -d ghcr.io/clearlinux/valkey valkey-server --protected-mode no
sleep 5
run check_container_status valkey-server
[ "$status" -eq 0 ]

# get ip address
run get_container_ip valkey-server
[ "$status" -eq 0 ]
ipaddr="$output"

# push two integers
docker run --rm ghcr.io/clearlinux/valkey redis-cli -h $ipaddr lrange mylist 0 -1

# stop the container
docker stop valkey-server
sleep 3
run check_container_status valkey-server
[ "$status" -eq 1 ]
}

2 changes: 1 addition & 1 deletion redis/Dockerfile → valkey/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN source /os-release && \
mkdir /install_root \
&& swupd os-install -V ${VERSION_ID} \
--path /install_root --statedir /swupd-state \
--bundles=redis-native,findutils,su-exec --no-boot-update
--bundles=valkey,findutils,su-exec --no-boot-update

# For some Host OS configuration with redirect_dir on,
# extra data are saved on the upper layer when the same
Expand Down
37 changes: 17 additions & 20 deletions redis/README.md → valkey/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Clear Linux* OS `redis` container image
# Clear Linux* OS `valkey` container image

<!-- Required -->
## What is this image?

`clearlinux/redis` is a Docker image with `redis` running on top of the
`clearlinux/valkey` is a Docker image with `valkey` running on top of the
[official clearlinux base image](https://hub.docker.com/_/clearlinux).

<!-- application introduction -->
> [Redis](https://redis.io/) is an open source (BSD licensed), in-memory data structure
> [Valkey](https://valkey.io/) is an open source (BSD licensed), in-memory data structure
> store, used as a database, cache and message broker. It supports data structures such
> as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs,
> geospatial indexes with radius queries and streams.
Expand Down Expand Up @@ -40,23 +40,20 @@ To learn more about Clear Linux* OS, visit: https://clearlinux.org.
The easiest way to get started with this image is by simply pulling it from
Docker Hub.

*Note: This container uses the same syntax as the [official redis
image](https://hub.docker.com/_/redis).


1. Pull the image from Docker Hub:
1. Pull the image from Github Container Registry:
```
docker pull clearlinux/redis
docker pull ghcr.io/clearlinux/valkey
```
2. Start a container using the examples below:
```
docker run --name some-redis --network some-network -d clearlinux/redis redis-server --protected-mode no
docker run --name some-valkey --network some-network -d ghcr.io/clearlinux/valkey valkey-server --protected-mode no
```
3. connecting via redis-cli
```
docker run -it --network some-network --rm clearlinux/redis redis-cli -h some-redis
docker run -it --network some-network --rm ghcr.io/clearlinux/valkey redis-cli -h some-valkey
```
<!-- Optional -->
Expand All @@ -71,22 +68,22 @@ This image can also be deployed on a Kubernetes cluster, such as [minikube](http
Steps to deploy redis on a Kubernetes cluster:
1. If you want to deploy `redis-deployment.yaml`
1. If you want to deploy `valkey-deployment.yaml`
```
kubectl create -f redis-deployment.yaml
kubectl create -f valkey-deployment.yaml
```
Or if you want to deploy `redis-deployment-conf.yaml`
Or if you want to deploy `valkey-deployment-conf.yaml`
```
kubectl create -f redis-deployment-conf.yaml
kubectl create -f valkey-deployment-conf.yaml
```
2. Install redis bundle and connect to the service, where 30001 is the port number defined in your service.
2. Install valkey bundle and connect to the service, where 30001 is the port number defined in your service.
```
swupd bundle-add redis-native
swupd bundle-add valkey
redis-cli -h <nodeIP> -p 30001
```
Expand All @@ -104,17 +101,17 @@ modify the container images.
2. Change to the directory of the application:
```
cd redis/
cd valkey/
```
3. Build the container image:
```
docker build -t clearlinux/redis .
docker build -t ghcr.io/clearlinux/valkey .
```
Refer to the Docker documentation for [default build arguments](https://docs.docker.com/engine/reference/builder/#arg).
Additionally:
- `swupd_args` - specifies arguments to pass to the Clear Linux* OS software
manager. See the [swupd man pages](https://github.com/clearlinux/swupd-client/blob/master/docs/swupd.1.rst#options)
for more information.
Expand Down
Loading

0 comments on commit 52fb1c1

Please sign in to comment.