112 lines
3.2 KiB
Bash
112 lines
3.2 KiB
Bash
#!/bin/bash
|
|
|
|
minio_local_path=/var/lib/docker/minio-pv/pv1
|
|
harbor_host=10.129.80.218:8033
|
|
inner_master_ip=10.129.80.218
|
|
minio_host_ip=10.129.80.223
|
|
|
|
install_minio(){
|
|
|
|
echo "start to create minio local path !"
|
|
mkdir -p ${minio_local_path}
|
|
chmod -R 777 ${minio_local_path}
|
|
mkdir -p /root/wdd/install/
|
|
|
|
cat > /root/wdd/install/minio-docker-compose.yaml <<EOF
|
|
version: '2'
|
|
|
|
services:
|
|
minio1:
|
|
ports:
|
|
- "9000:9000"
|
|
- "9001:9001"
|
|
image: '${harbor_host}/cmii/minio:2022.5.4'
|
|
environment:
|
|
- MINIO_ROOT_USER=cmii
|
|
- MINIO_ROOT_PASSWORD=B#923fC7mk
|
|
restart: always
|
|
volumes:
|
|
- ${minio_local_path}:/data
|
|
EOF
|
|
|
|
echo "start minio container !"
|
|
docker-compose -f /root/wdd/install/minio-docker-compose.yaml up -d
|
|
echo ""
|
|
|
|
}
|
|
|
|
install_docker_compose(){
|
|
curl https://oss.demo.uavcmlc.com/cmlc-installation/downloadfile/amd/docker-compose-amd64 -o /usr/local/bin/docker-compose
|
|
chmod +x /usr/local/bin/docker-compose
|
|
}
|
|
|
|
init_minio(){
|
|
echo "start to download mc!"
|
|
if [[ ! -f /usr/local/bin/mc ]]; then
|
|
curl https://oss.demo.uavcmlc.com/cmlc-installation/downloadfile/amd/mc -o /usr/local/bin/mc
|
|
chmod +x /usr/local/bin/mc
|
|
fi
|
|
|
|
# curl https://dl.min.io/client/mc/release/linux-amd64/mc -o /usr/local/bin/mc
|
|
|
|
echo ""
|
|
sleep 5
|
|
|
|
export tenant_name=outside
|
|
mc alias set ${tenant_name} http://${minio_host_ip}:9000 cmii B#923fC7mk
|
|
|
|
mc mb ${tenant_name}/jadenq ${tenant_name}/tus ${tenant_name}/thumbnail ${tenant_name}/pub-cms ${tenant_name}/live-srs-hls/ ${tenant_name}/mission/ ${tenant_name}/surveillance ${tenant_name}/playback ${tenant_name}/tower ${tenant_name}/modelprocess ${tenant_name}/srs-hls ${tenant_name}/live-cluster-hls ${tenant_name}/geodata
|
|
echo ""
|
|
|
|
echo "set rabbit mq"
|
|
mc admin config set ${tenant_name} notify_amqp:1 delivery_mode="2" exchange_type="direct" no_wait="off" queue_dir="" queue_limit="0" url="amqp://admin:nYcRN91r._hj@${inner_master_ip}:35672" auto_deleted="off" durable="on" exchange="cmii.chinamobile.minio.event" internal="off" mandatory="off" routing_key="cmii.chinamobile.material.warehouse"
|
|
echo ""
|
|
|
|
echo "sleep 5 s!"
|
|
sleep 5
|
|
|
|
mc admin service restart ${tenant_name}
|
|
|
|
echo "sleep 5 s!"
|
|
sleep 5
|
|
echo ""
|
|
|
|
|
|
echo "start to add event notification !"
|
|
|
|
mc event add ${tenant_name}/mission arn:minio:sqs::1:amqp --event put
|
|
|
|
mc event add ${tenant_name}/modelprocess arn:minio:sqs::1:amqp --event put
|
|
|
|
mc event add ${tenant_name}/live-srs-hls arn:minio:sqs::1:amqp --event put
|
|
|
|
mc event add ${tenant_name}/playback arn:minio:sqs::1:amqp --event put
|
|
|
|
mc event add ${tenant_name}/live-cluster-hls arn:minio:sqs::1:amqp --event put
|
|
|
|
mc event add ${tenant_name}/geodata arn:minio:sqs::1:amqp --event put
|
|
|
|
mc event add ${tenant_name}/surveillance arn:minio:sqs::1:amqp --event put
|
|
|
|
mc event add ${tenant_name}/tus arn:minio:sqs::1:amqp --event delete
|
|
|
|
mc ilm add --expiry-days "1" ${tenant_name}/tus
|
|
|
|
echo ""
|
|
echo "done of init !"
|
|
|
|
}
|
|
|
|
#install_docker_compose
|
|
|
|
install_minio
|
|
|
|
if [[ $(docker inspect -f '{{.State.Running}}' install-minio1-1) -eq "true" ]]; then
|
|
echo "minio is running now! start to init minio!"
|
|
init_minio
|
|
fi
|
|
|
|
#init_minio
|
|
|
|
|