optimize #73 update docker compose support minio deploy

pull/73/head
alimy 3 years ago
parent ab9d77690a
commit fe0412252b

@ -12,8 +12,8 @@ Server: # 服务设置
ReadTimeout: 60 ReadTimeout: 60
WriteTimeout: 60 WriteTimeout: 60
Features: Features:
Default: ["Alipay", "Zinc", "MySQL", "Redis", "AliOSS", "LoggerZinc"] Default: ["Alipay", "Zinc", "MySQL", "Redis", "MinIO", "LoggerFile"]
Develop: ["Sms", "Zinc", "MySQL", "MinIO", "LoggerFile"] Develop: ["Sms", "Zinc", "MySQL", "AliOSS", "LoggerZinc"]
Slim: ["Zinc", "MySQL", "Redis", "MinIO", "LoggerFile"] Slim: ["Zinc", "MySQL", "Redis", "MinIO", "LoggerFile"]
Sms: "SmsJuhe" Sms: "SmsJuhe"
SmsJuhe: SmsJuhe:
@ -47,18 +47,20 @@ AliOSS: # 阿里云OSS存储配置
AccessKeySecret: AccessKeySecret:
Bucket: Bucket:
Domain: Domain:
MinIO: # MinIO OSS存储配置 MinIO: # MinIO 存储配置
AccessKey: Q3AM3UQ867SPQQA43P2F AccessKey: Q3AM3UQ867SPQQA43P2F
SecretKey: zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG SecretKey: zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG
Secure: False Secure: False
Endpoint: play.min.io Endpoint: minio:9000
Bucket: paopao Bucket: paopao
S3: # S3 OSS存储配置 Domain: 127.0.0.1:9000
S3: # Amazon S3 存储配置
AccessKey: "YOUR-ACCESSKEYID" AccessKey: "YOUR-ACCESSKEYID"
SecretKey: "YOUR-SECRETACCESSKEY" SecretKey: "YOUR-SECRETACCESSKEY"
Secure: True Secure: True
Endpoint: s3.amazonaws.com Endpoint: s3.amazonaws.com
Bucket: paopao Bucket: paopao
Domain:
MySQL: # MySQL数据库 MySQL: # MySQL数据库
Username: paopao Username: paopao
Password: paopao Password: paopao

@ -25,6 +25,21 @@ services:
networks: networks:
- paopao-network - paopao-network
minio:
image: bitnami/minio:latest
restart: always
environment:
MINIO_ROOT_USER: minio-root-user
MINIO_ROOT_PASSWORD: minio-root-password
MINIO_DEFAULT_BUCKETS: paopao:public
ports:
- 127.0.0.1:9000:9000
- 127.0.0.1:9001:9001
volumes:
- ./data/minio/data:/data
networks:
- paopao-network
zinc: zinc:
image: public.ecr.aws/prabhat/zinc:latest image: public.ecr.aws/prabhat/zinc:latest
restart: always restart: always
@ -47,12 +62,13 @@ services:
- db - db
- redis - redis
- zinc - zinc
- minio
# modify below to reflect your custom configure # modify below to reflect your custom configure
volumes: volumes:
- ./config.yaml.sample:/app/paopao-ce/config.yaml - ./config.yaml.sample:/app/paopao-ce/config.yaml
- ./data/paopao-ce/data:/app/paopao-ce/data - ./data/paopao-ce/data:/app/paopao-ce/data
ports: ports:
- 8008:8008 - 127.0.0.1:8008:8008
networks: networks:
- paopao-network - paopao-network

@ -5,20 +5,20 @@ import (
) )
func getOssDomain() string { func getOssDomain() string {
uri := "https://"
if global.CfgIf("AliOSS") { if global.CfgIf("AliOSS") {
return "https://" + global.AliOSSSetting.Domain + "/" return uri + global.AliOSSSetting.Domain + "/"
} else if global.CfgIf("MinIO") { } else if global.CfgIf("MinIO") {
domain := "http://" if !global.MinIOSetting.Secure {
if global.MinIOSetting.Secure { uri = "http://"
domain = "http://"
} }
return domain + global.MinIOSetting.Endpoint + "/" + global.MinIOSetting.Bucket + "/" return uri + global.MinIOSetting.Domain + "/" + global.MinIOSetting.Bucket + "/"
} else if global.CfgIf("S3") { } else if global.CfgIf("S3") {
domain := "http://" if !global.S3Setting.Secure {
if global.S3Setting.Secure { uri = "http://"
domain = "https://"
} }
return domain + global.S3Setting.Endpoint + "/" + global.S3Setting.Bucket + "/" // TODO: will not work well need test in real world
return uri + global.S3Setting.Domain + "/" + global.S3Setting.Bucket + "/"
} }
return "" return ""
} }

@ -87,6 +87,7 @@ type MinIOSettingS struct {
Secure bool Secure bool
Endpoint string Endpoint string
Bucket string Bucket string
Domain string
} }
type S3SettingS struct { type S3SettingS struct {
@ -95,6 +96,7 @@ type S3SettingS struct {
Secure bool Secure bool
Endpoint string Endpoint string
Bucket string Bucket string
Domain string
} }
type AliOSSSettingS struct { type AliOSSSettingS struct {

Loading…
Cancel
Save