Minio对象存储 COS
当前,以演示站点域名moredoc.mnt.ltd和对象存储绑定的域名static.moredoc.mnt.ltd来作为配置演示,其他配置项仅作为参考。
注意:如果您配置了minio的ssl,则endpoint需要加上https,如https://192.168.0.102:8889,否则用不带http协议的方式进行配置,如:192.168.0.102:8889!!!
步骤
1. 搭建minio服务
请根据下载地址,自行搭建Minio服务,以及绑定域名。当前演示,minio监听 8889 端口,IP地址为:192.168.0.102,minio的管理后台端口为 62242。
2. 创建私有 Bucket
地址:http://192.168.0.102:62242/buckets

直接创建的,即是私有bucket。
3. 设置公共只读目录
在 Buckets 列表,点击进入刚创建的bucket moredoc-private,创建只读目录_/。注意,务必是_/!!!
如图:

4 创建访问密钥
地址:http://192.168.0.102:62242/access-keys

如已有访问密钥,则可跳过创建
5. 配置
注意 强烈建议对minio服务绑定域名!!!
修改 app.toml 下的cloudStore。
[cloudStore]# 存储类型,填minio,即Minio对象存储storeType = "minio"# 存储绑定的域名,带 http:// 或 https://domain = "https://static.moredoc.mnt.ltd"# Minio的 Access KeyaccessKey = "Access Key Id"# Minio的 Secret KeysecretKey = "Secret Key"# 对象存储的bucketbucket = "moredoc-private"# 对象存储 endpoint。# 注意:如果您配置了minio的ssl,则endpoint需要加上https,如https://192.168.0.102:8889,否则用类似以下的方式进行配置!!!endpoint = "192.168.0.102:8889"
6. 迁移与重启
迁移本地的 uploads和 documents 到对象存储
./moredoc migrateCloudstore
重启文库程序。
配置参考
完整配置参考示例如下:
# 程序运行级别:debug、info、warn、error,生产环境使用 info及其以上级别level = "debug"# 日志编码方式,支持:json、consolelogEncoding = "console"# 程序运行端口port = "8880"# 数据库配置[database]driver = "mysql"dsn = "root:root@tcp(localhost:3306)/moredoc?charset=utf8mb4&loc=Local&parseTime=true"showSQL = truemaxOpen = 10maxIdle = 10# JSON Web Token 配置[jwt]# 生成 token 的密钥,请务必修改!!!secret = "moredoc"# token 过期时间expireDays = 365[cloudStore]# 存储类型,填minio,即Minio对象存储storeType = "minio"# 存储绑定的域名,带 http:// 或 https://domain = "https://static.moredoc.mnt.ltd"# Minio的 Access KeyaccessKey = "Access Key Id"# Minio的 Secret KeysecretKey = "Secret Key"# 对象存储的bucketbucket = "moredoc-private"# 对象存储 endpointendpoint = "192.168.0.102:8889