Software title: Redis

This commit is contained in:
Igor Pecovnik
2025-04-28 18:25:51 +02:00
committed by Igor
parent 67954dcc10
commit 75c675fecf
6 changed files with 159 additions and 0 deletions

10
tests/redis.conf Normal file
View File

@@ -0,0 +1,10 @@
ENABLED=true
RELEASE="noble"
TESTNAME="Redis install"
testcase() {(
set -e
./bin/armbian-config --api module_redis remove
./bin/armbian-config --api module_redis install
./bin/armbian-config --api module_redis status
)}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@@ -0,0 +1,15 @@
=== "Access to the service"
Redis server is accessible on port **6379**:
- Host: `redis://<your.IP>:6379`
=== "Directories"
- Data directory: `/armbian/redis/data`
=== "View logs"
```sh
docker logs -f redis
```

View File

@@ -0,0 +1,11 @@
Redis is an open-source, in-memory data structure store, used as a database, cache, and message broker.
It supports a variety of data structures such as strings, hashes, lists, sets, and sorted sets.
**Key Features:**
- Extremely fast performance with in-memory storage
- Persistence options (snapshotting and AOF)
- Pub/Sub messaging capabilities
- Built-in replication and high availability
- Simple API and wide client support
Redis is widely used for real-time applications, caching layers, session stores, and lightweight queues across industries and platforms.

View File

@@ -1116,6 +1116,40 @@
"author": "@armbian",
"condition": "module_mariadb status"
},
{
"id": "REDIS1",
"description": "Redis install",
"short": "Redis",
"about": "This operation will install Redis, a powerful in-memory key-value database",
"command": [
"module_redis install"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "! module_redis status"
},
{
"id": "REDIS2",
"description": "Redis remove",
"about": "This operation will remove Redis container",
"command": [
"module_redis remove"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "module_redis status"
},
{
"id": "REDIS3",
"description": "Redis purge with data folder",
"about": "This operation will purge Redis data and remove the container",
"command": [
"module_redis purge"
],
"status": "Stable",
"author": "@igorpecovnik",
"condition": "module_redis status"
},
{
"id": "MYA001",
"description": "phpMyAdmin web interface manager",

View File

@@ -0,0 +1,89 @@
module_options+=(
["module_redis,author"]=""
["module_redis,maintainer"]="@igorpecovnik"
["module_redis,feature"]="module_redis"
["module_redis,example"]="install remove purge status help"
["module_redis,desc"]="Install Redis in a container (In-Memory Data Store)"
["module_redis,status"]="Active"
["module_redis,doc_link"]="https://redis.io/docs/"
["module_redis,group"]="Database"
["module_redis,port"]="6379"
["module_redis,arch"]="x86-64 arm64"
)
#
# Module redis
#
function module_redis () {
local title="redis"
local condition=$(which "$title" 2>/dev/null)
if pkg_installed docker-ce; then
local container=$(docker container ls -a | mawk '/redis?( |$)/{print $1}')
local image=$(docker image ls -a | mawk '/redis?( |$)/{print $3}')
fi
local commands
IFS=' ' read -r -a commands <<< "${module_options["module_redis,example"]}"
REDIS_BASE="${SOFTWARE_FOLDER}/redis"
case "$1" in
"${commands[0]}")
pkg_installed docker-ce || module_docker install
[[ -d "$REDIS_BASE" ]] || mkdir -p "$REDIS_BASE" || { echo "Couldn't create storage directory: $REDIS_BASE"; exit 1; }
docker run -d \
--name=redis \
--net=lsio \
-p 6379:6379 \
-v "${REDIS_BASE}/data:/data" \
--restart unless-stopped \
redis:alpine
for i in $(seq 1 20); do
if docker inspect -f '{{ index .Config.Labels "org.opencontainers.image.version" }}' redis >/dev/null 2>&1 ; then
break
else
sleep 3
fi
if [ $i -eq 20 ]; then
echo -e "\nTimed out waiting for ${title} to start, consult your container logs for more info (\`docker logs redis\`)"
exit 1
fi
done
;;
"${commands[1]}")
if [[ -n "${container}" ]]; then
docker container rm -f "$container" >/dev/null
fi
if [[ -n "${image}" ]]; then
docker image rm "$image" >/dev/null
fi
;;
"${commands[2]}")
${module_options["module_redis,feature"]} ${commands[1]}
if [[ -n "${REDIS_BASE}" && "${REDIS_BASE}" != "/" ]]; then
rm -rf "${REDIS_BASE}"
fi
;;
"${commands[3]}")
if [[ "${container}" && "${image}" ]]; then
return 0
else
return 1
fi
;;
"${commands[4]}")
echo -e "\nUsage: ${module_options["module_redis,feature"]} <command>"
echo -e "Commands: ${module_options["module_redis,example"]}"
echo "Available commands:"
echo -e "\tinstall\t- Install $title."
echo -e "\tremove\t- Remove $title."
echo -e "\tpurge\t- Purge $title data folder."
echo -e "\tstatus\t- Installation status $title."
echo
;;
*)
${module_options["module_redis,feature"]} ${commands[4]}
;;
esac
}