Commit 39df7c49c74cfe2dcf609c9eb662e21548c076c5

Authored by YunaiV
1 parent 058223f3

docs(infra): 补充 RustFS S3 接入说明与 MySQL 示例

补充文件客户端的 RustFS 配置注释,沿用现有 S3 存储类型。
新增非主的 RustFS MySQL 示例配置,使用占位密钥和私有桶访问。
sql/mysql/ruoyi-vue-pro.sql
... ... @@ -316,6 +316,7 @@ INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `c
316 316 INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (30, 'SFTP 存储(示例)', 12, '', b'0', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.sftp.SftpFileClientConfig\",\"basePath\":\"/upload\",\"domain\":\"http://127.0.0.1:48080\",\"host\":\"127.0.0.1\",\"port\":2222,\"username\":\"foo\",\"password\":\"pass\"}', '1', '2025-05-02 16:34:10', '1', '2026-07-02 15:35:07', b'0');
317 317 INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (34, '七牛云存储【私有】(示例)', 20, '请换成你自己的密钥!!!', b'0', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"s3.cn-south-1.qiniucs.com\",\"domain\":\"http://t151glocd.hn-bkt.clouddn.com\",\"bucket\":\"ruoyi-vue-pro-private\",\"accessKey\":\"3TvrJ70gl2Gt6IBe7_IZT1F6i_k0iMuRtyEv4EyS\",\"accessSecret\":\"wd0tbVBYlp0S-ihA8Qg2hPLncoP83wyrIq24OZuY\",\"enablePathStyleAccess\":false,\"enablePublicAccess\":false}', '1', '2025-08-17 21:22:00', '1', '2026-07-02 15:35:07', b'0');
318 318 INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (35, '1', 20, '1', b'0', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"http://www.baidu.com\",\"domain\":\"http://www.xxx.com\",\"bucket\":\"1\",\"accessKey\":\"2\",\"accessSecret\":\"3\",\"enablePathStyleAccess\":false,\"enablePublicAccess\":false,\"region\":\"1\"}', '1', '2025-10-02 14:32:12', '1', '2026-07-02 15:35:07', b'0');
  319 +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (36, 'RustFS 存储(示例)', 20, '请先部署 RustFS、创建存储桶,并替换成你自己的地址和密钥!!!', b'0', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"http://127.0.0.1:9000\",\"domain\":\"http://127.0.0.1:9000/ruoyi-vue-pro\",\"bucket\":\"ruoyi-vue-pro\",\"accessKey\":\"your-access-key\",\"accessSecret\":\"your-secret-key\",\"enablePathStyleAccess\":true,\"enablePublicAccess\":false,\"region\":\"us-east-1\"}', '1', '2026-10-25 23:01:12', '1', '2026-10-25 23:01:12', b'0');
319 320 COMMIT;
320 321  
321 322 -- ----------------------------
... ...
yudao-module-infra/pom.xml
... ... @@ -104,7 +104,7 @@
104 104 <groupId>com.github.mwiede</groupId>
105 105 <artifactId>jsch</artifactId> <!-- 文件客户端:解决 sftp 连接 -->
106 106 </dependency>
107   - <!-- 文件客户端:解决阿里云、腾讯云、minio 等 S3 连接 -->
  107 + <!-- 文件客户端:解决阿里云、腾讯云、minio、rustfs 等 S3 连接 -->
108 108 <dependency>
109 109 <groupId>software.amazon.awssdk</groupId>
110 110 <artifactId>s3</artifactId>
... ...
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/s3/S3FileClient.java
... ... @@ -26,7 +26,7 @@ import java.net.URL;
26 26 import java.time.Duration;
27 27  
28 28 /**
29   - * 基于 S3 协议的文件客户端,实现 MinIO、阿里云、腾讯云、七牛云、华为云等云服务
  29 + * 基于 S3 协议的文件客户端,实现 MinIO、RustFS、阿里云、腾讯云、七牛云、华为云等云服务
30 30 *
31 31 * @author 芋道源码
32 32 */
... ... @@ -156,7 +156,7 @@ public class S3FileClient extends AbstractFileClient&lt;S3FileClientConfig&gt; {
156 156 * @return Domain 地址
157 157 */
158 158 private String buildDomain() {
159   - // 如果已经是 http 或者 https,则不进行拼接.主要适配 MinIO
  159 + // 如果已经是 http 或者 https,则不进行拼接.主要适配 MinIO、RustFS
160 160 if (HttpUtil.isHttp(config.getEndpoint()) || HttpUtil.isHttps(config.getEndpoint())) {
161 161 return StrUtil.format("{}/{}", config.getEndpoint(), config.getBucket());
162 162 }
... ... @@ -265,7 +265,7 @@ public class S3FileClient extends AbstractFileClient&lt;S3FileClientConfig&gt; {
265 265 }
266 266 }
267 267  
268   - // 3.4 其他情况(MinIO、七牛云等)使用默认值
  268 + // 3.4 其他情况(MinIO、RustFS、七牛云等)使用默认值
269 269 return "us-east-1";
270 270 }
271 271  
... ...
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/core/client/s3/S3FileClientConfig.java
... ... @@ -30,6 +30,7 @@ public class S3FileClientConfig implements FileClientConfig {
30 30 * 4. 七牛云:https://developer.qiniu.com/kodo/4088/s3-access-domainname
31 31 * 5. 华为云:https://console.huaweicloud.com/apiexplorer/#/endpoint/OBS
32 32 * 6. 火山云:https://www.volcengine.com/docs/6349/107356
  33 + * 7. RustFS:https://docs.rustfs.com/en/administration/protocols/s3/ 。例如说,http://127.0.0.1:9000(S3 API 端口,不是 9001 控制台端口)
33 34 */
34 35 @NotNull(message = "endpoint 不能为空")
35 36 private String endpoint;
... ... @@ -41,6 +42,7 @@ public class S3FileClientConfig implements FileClientConfig {
41 42 * 4. 七牛云:https://developer.qiniu.com/kodo/8556/set-the-custom-source-domain-name
42 43 * 5. 华为云:https://support.huaweicloud.com/usermanual-obs/obs_03_0032.html
43 44 * 6. 火山云:https://www.volcengine.com/docs/6349/128983
  45 + * 7. RustFS:不填写时为 endpoint/bucket;PathStyle 访问时需带上 /bucket,例如说 http://127.0.0.1:9000/ruoyi-vue-pro,且需前端可访问
44 46 */
45 47 @URL(message = "domain 必须是 URL 格式")
46 48 private String domain;
... ... @@ -58,6 +60,7 @@ public class S3FileClientConfig implements FileClientConfig {
58 60 * 4. 七牛云:https://portal.qiniu.com/user/key
59 61 * 5. 华为云:https://support.huaweicloud.com/qs-obs/obs_qs_0005.html
60 62 * 6. 火山云:https://console.volcengine.com/iam/keymanage/
  63 + * 7. RustFS:https://docs.rustfs.com/en/installation/container/docker/ 。例如说,启动时配置的 RUSTFS_ACCESS_KEY
61 64 */
62 65 @NotNull(message = "accessKey 不能为空")
63 66 private String accessKey;
... ... @@ -69,6 +72,8 @@ public class S3FileClientConfig implements FileClientConfig {
69 72  
70 73 /**
71 74 * 是否启用 PathStyle 访问
  75 + *
  76 + * MinIO、RustFS:建议 true。其中,RustFS 默认使用 PathStyle,虚拟主机风格需服务端额外配置 RUSTFS_SERVER_DOMAINS
72 77 */
73 78 @NotNull(message = "enablePathStyleAccess 不能为空")
74 79 private Boolean enablePathStyleAccess;
... ... @@ -91,6 +96,7 @@ public class S3FileClientConfig implements FileClientConfig {
91 96 * 5. 七牛云:不需要填写,会自动识别
92 97 * 6. 华为云:不需要填写,会自动识别
93 98 * 7. 火山云:不需要填写,会自动识别
  99 + * 8. RustFS:需与服务端的 RUSTFS_REGION 一致,默认 us-east-1;不填写时,也使用 us-east-1
94 100 */
95 101 private String region;
96 102  
... ...
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/framework/file/package-info.java
... ... @@ -5,7 +5,7 @@
5 5 * 2. ftp:FTP 服务器
6 6 * 3. sftp:SFTP 服务器
7 7 * 4. db:数据库
8   - * 5. s3:支持 S3 协议的云存储服务,例如说 MinIO、阿里云、华为云、腾讯云、七牛云等等
  8 + * 5. s3:支持 S3 协议的云存储服务,例如说 MinIO、RustFS、阿里云、华为云、腾讯云、七牛云等等
9 9 *
10 10 * @author 芋道源码
11 11 */
... ...