diff --git a/docker-compose.yml b/docker-compose.yml index 117104b9..34df24fd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -# Docker Compose 一键安装中间件 MySQL、Redis、MinIO、Xxl-Job +# Docker Compose 一键安装中间件 MySQL、Redis、RustFS、Xxl-Job # # 安装:docker compose up -d # 卸载:docker compose down(加 -v 同时删除数据卷) @@ -8,6 +8,7 @@ # - MySQL 首次启动时自动执行 ./sql 下初始化脚本(仅首次,数据卷已存在时跳过) # - 中间件配置全部内联于 command 参数,无需外部配置文件 # - 数据持久化使用命名卷(docker volume 统一管理),不污染项目目录 +# - RustFS 兼容 MinIO 磁盘格式与 S3 协议(MinIO 社区版已于 2026 年停止维护) name: youlai-boot @@ -41,18 +42,17 @@ services: ports: - 6379:6379 - minio: - image: minio/minio:RELEASE.2024-07-16T23-46-41Z - container_name: minio + rustfs: + image: rustfs/rustfs:latest + container_name: rustfs restart: unless-stopped - command: server /data --console-address ":9001" environment: - TZ=Asia/Shanghai - LANG=en_US.UTF-8 - - MINIO_ROOT_USER=minioadmin - - MINIO_ROOT_PASSWORD=minioadmin + - RUSTFS_ACCESS_KEY=rustfs-admin + - RUSTFS_SECRET_KEY=rustfs-admin volumes: - - youlai-minio-data:/data + - youlai-rustfs-data:/data ports: - 9000:9000 - 9001:9001 @@ -71,5 +71,5 @@ services: volumes: youlai-mysql-data: youlai-redis-data: - youlai-minio-data: + youlai-rustfs-data: youlai-xxljob-logs: diff --git a/pom.xml b/pom.xml index 96dad4c8..c1071eaa 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.youlai youlai-boot - 4.7.0 + 4.8.0 基于 Java 17 + SpringBoot 4 + Spring Security 构建的权限管理系统。 @@ -39,6 +39,7 @@ 4.12.0 + 2.54.2 3.16.3 @@ -217,7 +218,7 @@ software.amazon.awssdk s3 - 2.54.2 + ${aws-sdk-s3.version} diff --git a/src/main/java/com/youlai/boot/config/property/FileStorageProperties.java b/src/main/java/com/youlai/boot/config/property/FileStorageProperties.java index fb02715a..71a11ec0 100644 --- a/src/main/java/com/youlai/boot/config/property/FileStorageProperties.java +++ b/src/main/java/com/youlai/boot/config/property/FileStorageProperties.java @@ -10,28 +10,44 @@ import java.util.Set; import java.util.stream.Collectors; /** - * 文件存储顶层配置:存储类型与上传限制。 + * 文件存储配置。 *

- * rustfs / aliyun / local 子树由各自 {@code FileService} 实现类绑定, - * 此处仅承载 {@code type} 与 {@code upload}。 + * 绑定前缀 {@code file-storage},承载存储类型与上传限制; + * rustfs / aliyun / local 子配置由各自的 {@code FileService} 实现类绑定。 + * + * @author youlai.tech */ @Data @Component @ConfigurationProperties(prefix = "file-storage") public class FileStorageProperties { - /** 存储类型:rustfs | aliyun | local */ + /** + * 存储类型,决定激活哪个 FileService 实现。 + *

+ * 可选值:rustfs、aliyun、local。 + */ private String type; + /** 上传限制 */ private Upload upload = new Upload(); + /** + * 上传限制,绑定前缀 {@code file-storage.upload}。 + */ @Data public static class Upload { - /** 单文件大小上限,如 50MB;同时作为 spring.servlet.multipart 的上限 */ + /** + * 单文件大小上限,如 50MB。 + *

+ * 同时作为 spring.servlet.multipart 的上限,单一来源。 + */ private String maxFileSize; - /** 允许的文件扩展名白名单(置空表示不限制) */ + /** + * 允许的文件扩展名白名单,置空表示不限制。 + */ private List allowedExtensions; }