mirror of
https://github.com/clearlinux/dockerfiles.git
synced 2026-04-28 11:03:45 +00:00
Replace redis with valkey
Signed-off-by: William Douglas <william.douglas@intel.com>
This commit is contained in:
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
@@ -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
|
||||
|
||||
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -30,8 +30,8 @@ jobs:
|
||||
- postgres
|
||||
- python
|
||||
- rabbitmq
|
||||
- redis
|
||||
- ruby
|
||||
- valkey
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: install
|
||||
|
||||
@@ -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".
|
||||
|
||||
@@ -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".
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/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 redis-server --detach clearlinux/redis
|
||||
run check_container_status redis-server
|
||||
[ "$status" -eq 0 ]
|
||||
run Test_1191 clearlinux/redis
|
||||
[ "$output" == "pass" ]
|
||||
|
||||
# stop the container
|
||||
docker rm -f redis-server
|
||||
sleep 3
|
||||
run check_container_status redis-server
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "1195 test" {
|
||||
# start container first
|
||||
docker run --name redis-server --detach clearlinux/redis
|
||||
run check_container_status redis-server
|
||||
[ "$status" -eq 0 ]
|
||||
run Test_1195 clearlinux/redis
|
||||
[ "$output" == "pass" ]
|
||||
|
||||
# stop the container
|
||||
docker rm -f redis-server
|
||||
sleep 3
|
||||
run check_container_status redis-server
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "1215 test" {
|
||||
# start container first
|
||||
docker run --name redis-server --detach --security-opt=no-new-privileges clearlinux/redis
|
||||
run check_container_status redis-server
|
||||
[ "$status" -eq 0 ]
|
||||
run Test_1215 clearlinux/redis
|
||||
[ "$output" == "pass" ]
|
||||
|
||||
# stop the container
|
||||
docker rm -f redis-server
|
||||
sleep 3
|
||||
run check_container_status redis-server
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
#!/usr/bin/env bats
|
||||
# Copyright (C) 2018 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
load ../utils
|
||||
|
||||
@test "Redis LPUSH test" {
|
||||
# start tje container first
|
||||
docker run --name redis-server --rm -d clearlinux/redis redis-server --protected-mode no
|
||||
sleep 5
|
||||
run check_container_status redis-server
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# get ip address
|
||||
run get_container_ip redis-server
|
||||
[ "$status" -eq 0 ]
|
||||
ipaddr="$output"
|
||||
|
||||
# push two integers
|
||||
docker run --rm clearlinux/redis redis-cli -h $ipaddr lpush mylist x
|
||||
docker run --rm clearlinux/redis redis-cli -h $ipaddr lpush mylist y
|
||||
|
||||
# stop the container
|
||||
docker stop redis-server
|
||||
sleep 3
|
||||
run check_container_status redis-server
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "Redis LRANGE test" {
|
||||
# start tje container first
|
||||
docker run --name redis-server --rm -d clearlinux/redis redis-server --protected-mode no
|
||||
sleep 5
|
||||
run check_container_status redis-server
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# get ip address
|
||||
run get_container_ip redis-server
|
||||
[ "$status" -eq 0 ]
|
||||
ipaddr="$output"
|
||||
|
||||
# push two integers
|
||||
docker run --rm clearlinux/redis redis-cli -h $ipaddr lrange mylist 0 -1
|
||||
|
||||
# stop the container
|
||||
docker stop redis-server
|
||||
sleep 3
|
||||
run check_container_status redis-server
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
53
tests/valkey/valkey-security.bats
Executable file
53
tests/valkey/valkey-security.bats
Executable file
@@ -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
tests/valkey/valkey.bats
Executable file
51
tests/valkey/valkey.bats
Executable file
@@ -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 ]
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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.
|
||||
@@ -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 -->
|
||||
@@ -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
|
||||
```
|
||||
|
||||
@@ -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.
|
||||
@@ -4,11 +4,11 @@ set -e
|
||||
# first arg is `-f` or `--some-option`
|
||||
# or first arg is `something.conf`
|
||||
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
|
||||
set -- redis-server "$@"
|
||||
set -- valkey-server "$@"
|
||||
fi
|
||||
|
||||
# change to redis user to run
|
||||
if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then
|
||||
if [ "$1" = 'valkey-server' -a "$(id -u)" = '0' ]; then
|
||||
exec su-exec redis "$BASH_SOURCE" "$@"
|
||||
fi
|
||||
|
||||
@@ -11,23 +11,23 @@ data:
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: redis-deployment
|
||||
name: valkey-deployment
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
name: redis-deployment
|
||||
name: valkey-deployment
|
||||
labels:
|
||||
app: redis
|
||||
app: valkey
|
||||
spec:
|
||||
volumes:
|
||||
- name: config-volume
|
||||
configMap:
|
||||
name: redis-config
|
||||
name: valkey-config
|
||||
containers:
|
||||
- image: docker.io/clearlinux/redis
|
||||
name: redis
|
||||
command: ["redis-server"]
|
||||
- image: ghcr.io/clearlinux/valkey
|
||||
name: valkey
|
||||
command: ["valkey-server"]
|
||||
args: ["/etc/redis.conf","--protected-mode no"]
|
||||
volumeMounts:
|
||||
- name: config-volume
|
||||
@@ -38,7 +38,7 @@ spec:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: redis-svc
|
||||
name: valkey-svc
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
@@ -46,4 +46,4 @@ spec:
|
||||
targetPort: 6379
|
||||
nodePort: 30001
|
||||
selector:
|
||||
app: redis
|
||||
app: valkey
|
||||
@@ -1,24 +1,24 @@
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: redis-deployment
|
||||
name: valkey-deployment
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
name: redis-deployment
|
||||
name: valkey-deployment
|
||||
labels:
|
||||
app: redis
|
||||
app: valkey
|
||||
spec:
|
||||
containers:
|
||||
- image: docker.io/clearlinux/redis
|
||||
name: redis
|
||||
- image: ghcr.io/clearlinux/valkey
|
||||
name: valkey
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: redis-svc
|
||||
name: valkey-svc
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
@@ -26,5 +26,5 @@ spec:
|
||||
targetPort: 6379
|
||||
nodePort: 30001
|
||||
selector:
|
||||
app: redis
|
||||
app: valkey
|
||||
|
||||
Reference in New Issue
Block a user