Single Node
Deploy File Service
-
Download the Image
- Server Supports Internet Access
- Server Does Not Support Internet Access
docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-file:2.1.0
# Offline image package download link. Upload to the deployment server after download completion.
https://pdpublic.mingdao.com/private-deployment/offline/mingdaoyun-file-linux-amd64-2.1.0.tar.gz
# Load the offline image on the server using docker load -i command
docker load -i mingdaoyun-file-linux-amd64-2.1.0.tar.gz -
Create Data Directories
mkdir -p /data/file/volume/{cache,data,fetchtmp,multitmp,tmp}
-
Create Configuration File Directory
mkdir -p /usr/local/MDPrivateDeployment/clusterMode/config
-
Create
s3-config.json
File for Storage Integration, Template Belowcat > /usr/local/MDPrivateDeployment/clusterMode/config/s3-config.json << EOF
{
"mode": 1,
"accessKeyID": "your_accessKey",
"secretAccessKey": "your_secretKey",
"bucketEndPoint": "http://192.168.0.11:9011",
"bucketName": {
"mdmedia": "mdmedia",
"mdpic": "mdpic",
"mdpub": "mdpub",
"mdoc": "mdoc"
},
"region": "1",
"addressingModel": 1
}
EOF- For self-hosted MinIO object storage, replace
accessKeyID
andsecretAccessKey
with MinIO serviceMINIO_ROOT_USER
andMINIO_ROOT_PASSWORD
variable values - Self-hosted MinIO object storage typically does not define
region
, so a random value of 1 can be filled - Self-hosted MinIO object storage is usually accessed via IP. The
"addressingModel": 1
parameter should be included to prevent the bucket from being automatically prefixed to the IP and forming an incorrect endpoint address
- For self-hosted MinIO object storage, replace
-
Create file.yaml File
cat > /usr/local/MDPrivateDeployment/clusterMode/file.yaml <<EOF
version: '3'
services:
file:
image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-file:2.1.0
volumes:
- /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
- /data/file/volume:/data/storage
- /usr/local/MDPrivateDeployment/clusterMode/config/s3-config.json:/usr/local/file/s3-config.json
ports:
- "9000:9000"
environment:
ENV_ACCESS_KEY_FILE: storage
ENV_SECRET_KEY_FILE: 12345678910
ENV_MINGDAO_PROTO: "http"
ENV_MINGDAO_HOST: "hap.domain.com"
ENV_MINGDAO_PORT: "80"
# Redis master-slave mode
ENV_FILE_CACHE: "redis://:123456@192.168.10.13:6379"
# Redis sentinel mode
#ENV_REDIS_SENTINEL_ENDPOINTS: "192.168.10.13:26379,192.168.10.14:26379,192.168.10.15:26379"
#ENV_REDIS_SENTINEL_MASTER: "mymaster"
#ENV_REDIS_SENTINEL_PASSWORD: "password"
ENV_FILECACHE_EXPIRE: "false"
ENV_FILE_ID: "file1"
ENV_FILE_DOMAIN: "http://file:9000"
command: ["./main", "server", "/data/storage/data"]
EOF- Make sure to replace the variable-specified access addresses with the actual main system address during deployment
- Replace Redis connection information with the actual password and IP during actual deployment
- In multi-node deployments,
ENV_FILE_ID
should have unique values for each instance, such asfile1
,file2
,file3
, etc. - Note that in file v2 version,
MINIO_ACCESS_KEY
andMINIO_SECRET_KEY
variables are deprecated. UseENV_ACCESS_KEY_FILE
andENV_SECRET_KEY_FILE
instead to validate microservice to file service authentication - The
ENV_FILE_DOMAIN
variable value must be consistent with ENV_FILE_ENDPOINTS in the microservice configuration file, but with an added http://
-
Create Start and Stop Scripts
cat > /usr/local/MDPrivateDeployment/clusterMode/start.sh <<EOF
docker stack deploy -c /usr/local/MDPrivateDeployment/clusterMode/file.yaml file
EOF
cat > /usr/local/MDPrivateDeployment/clusterMode/stop.sh <<EOF
docker stack rm file
EOF
chmod +x /usr/local/MDPrivateDeployment/clusterMode/start.sh
chmod +x /usr/local/MDPrivateDeployment/clusterMode/stop.sh -
Initialize swarm (can be ignored if this node is already initialized)
docker swarm init
-
Start Service
bash /usr/local/MDPrivateDeployment/clusterMode/start.sh
-
Add to Startup
echo "bash /usr/local/MDPrivateDeployment/clusterMode/start.sh" >> /etc/rc.local
chmod +x /etc/rc.local -
After Deployment, Upload Prefabricated Files to MinIO Object Storage