feat: add more

This commit is contained in:
Sun-ZhenXing
2025-10-06 21:48:39 +08:00
parent f330e00fa0
commit 3c609b5989
120 changed files with 7698 additions and 59 deletions

8
src/valkey/.env.example Normal file
View File

@@ -0,0 +1,8 @@
# App version
VALKEY_VERSION="8.0-alpine"
# Password for authentication
VALKEY_PASSWORD="passw0rd"
# Port to bind to on the host machine
VALKEY_PORT_OVERRIDE=6379

48
src/valkey/README.md Normal file
View File

@@ -0,0 +1,48 @@
# Valkey
[English](./README.md) | [中文](./README.zh.md)
This service deploys Valkey, an open-source alternative to Redis that began as a fork of Redis 7.2.
## Services
- `valkey`: The Valkey service.
## Environment Variables
| Variable Name | Description | Default Value |
| -------------------- | --------------------------------------------------------- | ------------- |
| VALKEY_VERSION | Valkey image version | `8.0-alpine` |
| VALKEY_PASSWORD | Password for authentication | `passw0rd` |
| VALKEY_PORT_OVERRIDE | Host port mapping (maps to Valkey port 6379 in container) | `6379` |
Please modify the `.env` file as needed for your use case.
## Volumes
- `valkey_data`: A volume for storing Valkey data with AOF (Append Only File) persistence enabled.
- `valkey.conf`: Optional custom configuration file (mount to `/etc/valkey/valkey.conf`).
## Features
Valkey is fully compatible with Redis and provides:
- In-memory data structure store
- Support for strings, hashes, lists, sets, sorted sets
- Pub/Sub messaging
- Transactions
- Persistence (RDB snapshots and AOF)
- Replication
- Lua scripting
- LRU eviction
## Notes
- AOF persistence is enabled by default for better data durability.
- For production use, consider using a custom configuration file.
- Valkey is 100% compatible with Redis clients and commands.
- This is an open-source alternative maintained by the Linux Foundation.
## License
Valkey is licensed under the BSD 3-Clause License.

48
src/valkey/README.zh.md Normal file
View File

@@ -0,0 +1,48 @@
# Valkey
[English](./README.md) | [中文](./README.zh.md)
此服务用于部署 Valkey一个开源的 Redis 替代方案,从 Redis 7.2 分叉而来。
## 服务
- `valkey`: Valkey 服务。
## 环境变量
| 变量名 | 说明 | 默认值 |
| -------------------- | --------------------------------------------- | ------------ |
| VALKEY_VERSION | Valkey 镜像版本 | `8.0-alpine` |
| VALKEY_PASSWORD | 认证密码 | `passw0rd` |
| VALKEY_PORT_OVERRIDE | 主机端口映射(映射到容器内 Valkey 端口 6379 | `6379` |
请根据实际需求修改 `.env` 文件。
## 卷
- `valkey_data`: 用于存储 Valkey 数据的卷,启用了 AOF仅追加文件持久化。
- `valkey.conf`: 可选的自定义配置文件(挂载到 `/etc/valkey/valkey.conf`)。
## 功能
Valkey 完全兼容 Redis 并提供:
- 内存数据结构存储
- 支持字符串、哈希、列表、集合、有序集合
- 发布/订阅消息传递
- 事务
- 持久化RDB 快照和 AOF
- 复制
- Lua 脚本
- LRU 驱逐
## 注意事项
- 默认启用 AOF 持久化以提高数据持久性。
- 对于生产环境,建议使用自定义配置文件。
- Valkey 与 Redis 客户端和命令 100% 兼容。
- 这是由 Linux 基金会维护的开源替代方案。
## 许可证
Valkey 使用 BSD 3-Clause 许可证授权。

View File

@@ -0,0 +1,43 @@
x-default: &default
restart: unless-stopped
volumes:
- &localtime /etc/localtime:/etc/localtime:ro
- &timezone /etc/timezone:/etc/timezone:ro
logging:
driver: json-file
options:
max-size: 100m
services:
valkey:
<<: *default
image: valkey/valkey:${VALKEY_VERSION:-8.0-alpine}
container_name: valkey
ports:
- "${VALKEY_PORT_OVERRIDE:-6379}:6379"
volumes:
- *localtime
- *timezone
- valkey_data:/data
# Use a custom valkey.conf file
# - ./valkey.conf:/etc/valkey/valkey.conf
command:
- sh
- -c
- |
if [ -n "$${VALKEY_PASSWORD}" ]; then
valkey-server --requirepass "$${VALKEY_PASSWORD}" --appendonly yes
else
valkey-server --appendonly yes
fi
deploy:
resources:
limits:
cpus: '0.50'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
volumes:
valkey_data: