# ARCHIVED
Please refer to [pberkel/caddy-storage-redis](https://github.com/pberkel/caddy-storage-redis) for updated version
Reason: work reason, and having outside hobby than code
# Caddy Cluster / Certmagic TLS cluster support for Redis
This plugin is based on [similar plugin using Consul](https://github.com/pteich/caddy-tlsconsul/).
Most of the aspect is also similar, I pretty much copy the crypto implementation.
The reason I use [Redis](https://redis.io/) is because it easier to setup.
For now, this will support redis as single instance, or with replica, but NOT the cluster.
This plugin utilize [go-redis/redis](https://github.com/go-redis/redis) for its client access and [redislock](https://github.com/bsm/redislock)
for it's locking mechanism. See [distlock](https://redis.io/topics/distlock) for the lock algorithm.
This plugin currently work with versions of Caddy v2, for the previous version of Caddy use [caddy-v1](https://github.com/gamalan/caddy-tlsredis/tree/caddy-v1) branch.
## Configuration
You enable Redis storage with Caddy by setting the storage module used, for example
```
{
//all value is optional, here is the default
storage redis {
host "127.0.0.1"
port 6379
address "127.0.0.1:6379" // no default, but is build from host+":"+port, if set, then host and port is ignored
username ""
password ""
db 1
key_prefix "caddytls"
value_prefix "caddy-storage-redis"
timeout 5
tls_enabled "false"
tls_insecure "true"
aes_key "redistls-01234567890-caddytls-32" // optional, but must have 32 length
}
// because the option are set using env, there are no need for additional option value
}
:443 {
}
```
JSON example
```
{
"admin": {
"listen": "0.0.0.0:2019"
},
"storage": {
"address": "redis:6379",
"aes_key": "redistls-01234567890-caddytls-32",
"db": 1,
"host": "redis",
"key_prefix": "caddytls",
"module": "redis",
"password": "",
"port": "6379",
"timeout": 5,
"tls_enabled": false,
"tls_insecure": true,
"value_prefix": "caddy-storage-redis"
}
}
```
There are additional environment variable for this plugin:
- `CADDY_CLUSTERING_REDIS_HOST` defines Redis Host, default is `127.0.0.1`
- `CADDY_CLUSTERING_REDIS_PORT` defines Redis Port, default is 6379
- `CADDY_CLUSTERING_REDIS_USERNAME` defines Redis username, default is empty
- `CADDY_CLUSTERING_REDIS_PASSWORD` defines Redis password, default is empty
- `CADDY_CLUSTERING_REDIS_DB` defines Redis DB, default is 0
- `CADDY_CLUSTERING_REDIS_TIMEOUT` defines Redis Dial,Read,Write timeout, default is set to 5 for 5 seconds
- `CADDY_CLUSTERING_REDIS_AESKEY` defines your personal AES key to use when encrypting data. It needs to be 32 characters long.
- `CADDY_CLUSTERING_REDIS_KEYPREFIX` defines the prefix for the keys. Default is `caddytls`
- `CADDY_CLUSTERING_REDIS_VALUEPREFIX` defines the prefix for the values. Default is `caddy-storage-redis`
- `CADDY_CLUSTERING_REDIS_TLS` defines whether use Redis TLS Connection or not
- `CADDY_CLUSTERING_REDIS_TLS_INSECURE` defines whether verify Redis TLS Connection or not
## TODO
- Add Redis Cluster or Sentinel support (probably need to update the distlock implementation first)
没有合适的资源?快使用搜索试试~ 我知道了~
用于 Caddy TLS 数据的 Redis 存储.zip
共11个文件
go:4个
txt:2个
sum:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 83 浏览量
2024-12-04
12:30:46
上传
评论
收藏 77KB ZIP 举报
温馨提示
用于 Caddy TLS 数据的 Redis 存储已归档请参阅pberkel/caddy-storage-redis以获取更新版本原因工作原因,以及有代码之外的爱好Caddy Cluster / Certmagic TLS 集群支持 Redis此插件基于使用 Consul 的类似插件。大部分方面也类似,我几乎复制了加密实现。我使用Redis的原因是它更容易设置。目前,这将支持 redis 作为单个实例或副本,但不支持集群。此插件利用go-redis/redis进行客户端访问,并利用redislock 进行锁定机制。请参阅distlock了解锁定算法。该插件目前适用于 Caddy v2 版本,对于以前版本的 Caddy 使用caddy-v1分支。配置您可以通过设置使用的存储模块来启用 Caddy 的 Redis 存储,例如{ //all value is optional, here is the default storage redis { host "127.0.0.1" port
资源推荐
资源详情
资源评论
收起资源包目录
用于 Caddy TLS 数据的 Redis 存储.zip (11个子文件)
crypto_test.go 609B
storageredis_test.go 7KB
go.mod 277B
标签.txt 2B
go.sum 174KB
LICENSE 11KB
crypto.go 2KB
资源内容.txt 909B
storageredis.go 19KB
.gitignore 20B
README.md 3KB
共 11 条
- 1
资源评论
徐浪老师
- 粉丝: 8315
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 毕业设计基于改进神经网络的风电功率预测系统.zip
- 新建 Microsoft Word 文档
- 毕业设计基于STM32的智能停车场设计.zip
- 毕业设计基于Cesium时空数据可视化后台Java SSM框架.zip
- 毕业设计代码,基于ElasticFusion的双目实时重建.zip
- Ubuntu大数据环境搭建:包括Hadoop、hbase、mongodb、eclipse安装搭建
- 毕业设计之SpringCloud-B2C平台电子商务App端.zip
- 卡西欧计算机fx-991CN CW 模拟器PC版
- 毕业设计主机安全装载系统.zip
- DEAP效率计算软件,自动进行线性规,可以计算DEA数据包络方法中CCR和BCC模型下的最优解
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功