Explorar el Código

Merge branch 'next' of https://gitee.com/zuohuaijun/Admin.NET into next

zuohuaijun hace 1 año
padre
commit
829b23f041
Se han modificado 4 ficheros con 65 adiciones y 0 borrados
  1. 1 0
      docker/README.md
  2. 35 0
      docker/app/Configuration/Cache.json
  3. 14 0
      docker/docker-compose.yml
  4. 15 0
      docker/redis/redis.conf

+ 1 - 0
docker/README.md

@@ -12,6 +12,7 @@
 2.  *app/Configuration/App.json* 主要配置了api端口5050,如果你的端口也是这个可以覆盖
 2.  *Web/.env.production* 文件配置接口地址配置为 VITE\_API\_URL = '/prod-api'
 3.  nginx,mysql配置文件无需修改
+4.  redis/redis.conf 中配置密码,如果不设密码REDIS_PASSWORD置空,app/Configuration/Cache.json中server=redis:6379,password没有的话置空
 
 ***
 

+ 35 - 0
docker/app/Configuration/Cache.json

@@ -0,0 +1,35 @@
+{
+  "$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
+
+  "Cache": {
+    "Prefix": "adminnet_", // 全局缓存前缀
+    "CacheType": "Redis", // Memory、Redis
+    "Redis": {
+      "Configuration": "server=redis:6379;password=123456;db=5;", // Redis连接字符串
+      "Prefix": "adminnet_", // Redis前缀(目前没用)
+      "MaxMessageSize": "1048576" // 最大消息大小 默认1024 * 1024
+    }
+  },
+  "Cluster": { // 集群配置
+    "Enabled": true, // 启用集群:前提开启Redis缓存模式
+    "ServerId": "adminnet", // 服务器标识
+    "ServerIp": "", // 服务器IP
+    "SignalR": {
+      "RedisConfiguration": "redis:6379,ssl=false,password=123456,defaultDatabase=5",
+      "ChannelPrefix": "signalrPrefix_"
+    },
+    "DataProtecteKey": "AdminNet:DataProtection-Keys",
+    "IsSentinel": false, // 是否哨兵模式
+    "SentinelConfig": {
+      "DefaultDb": "4",
+      "EndPoints": [ // 哨兵端口
+        // "10.10.0.124:26380"
+      ],
+      "MainPrefix": "adminNet:",
+      "Password": "123456",
+      "SentinelPassword": "adminNet",
+      "ServiceName": "adminNet",
+      "SignalRChannelPrefix": "signalR:"
+    }
+  }
+}

+ 14 - 0
docker/docker-compose.yml

@@ -38,6 +38,19 @@ services:
     volumes:
       - ./mysql/mysql:/var/lib/mysql
       - ./mysql/mysql.cnf:/etc/mysql/conf.d/mysql.cnf
+  redis:
+    image: 'redis:latest' # 使用最新版本的 Redis 镜像,也可以指定特定版本如 'redis:6.2.7'
+    container_name: my-redis # 自定义容器名称
+    ports:
+      - '5379:6379' # 映射宿主机的 6379 端口到容器的 6379 端口
+    volumes: # 持久化数据
+      - ./redis/redis.conf:/usr/local/etc/redis/redis.conf
+      - ./redis/data:/data:rw
+      - ./redis/logs:/logs
+    #command: ['redis-server', '--appendonly', 'yes'] # 启用AOF持久化
+    command: ['redis-server','/usr/local/etc/redis/redis.conf']
+    environment: # 设置环境变量,例如密码
+      - REDIS_PASSWORD=123456
   adminNet:
     image: mcr.microsoft.com/dotnet/aspnet:6.0
     ports:
@@ -50,4 +63,5 @@ services:
     command: ["/app/wait-for-it.sh", "mysql:3306", "-t", "120", "--","dotnet", "Admin.NET.Web.Entry.dll"]
     depends_on:
       - mysql
+      - redis
 

+ 15 - 0
docker/redis/redis.conf

@@ -0,0 +1,15 @@
+bind 0.0.0.0
+protected-mode no
+port 6379
+timeout 0
+save 900 1 # 900s内至少一次写操作则执行bgsave进行RDB持久化
+save 300 10
+save 60 10000
+rdbcompression yes
+dbfilename dump.rdb
+# dir data
+# 开启数据持久化[aof]
+appendonly yes
+appendfsync everysec
+# 开启密码验证
+requirepass 123456