source ../environment.sh
 

if docker ps -a | grep -q ${DSP_ADMIN_NAME}; then
    echo "停止并删除已存在的 DSP_ADMIN_NAME 容器..."
    docker stop ${DSP_ADMIN_NAME} >/dev/null 2>&1
    docker rm ${DSP_ADMIN_NAME} >/dev/null 2>&1
fi


docker run --pull always -d \
--name ${DSP_ADMIN_NAME} \
--network ${NETWORK} \
--env SPRING_CLOUD_CONSUL_HOST=${CONSUL_NAME} \
--env SPRING_CLOUD_CONSUL_PORT=8500 \
--env SPRING_CLOUD_CONSUL_DISCOVERY_HOSTNAME=${DSP_ADMIN_NAME} \
--env XXL_JOB_ADMIN_ADDRESSES=http://${XXLJOB_NAME}:8080/xxl-job-admin \
--env XXL_JOB_ACCESSTOKEN=${XXLJOB_ACCESS_TOKEN} \
--env XXL_ENABLE=false \
--env SPRING_REDIS_HOST=${REDIS_NAME} \
--env SPRING_REDIS_PORT=6379 \
--env SPRING_DATASOURCE_DRUID_URL="jdbc:mysql://${MYSQL_NAME}:3306/tuoheng_dsp?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false" \
--env SPRING_DATASOURCE_DRUID_USERNAME=root \
--env SPRING_DATASOURCE_DRUID_PASSWORD=${MYSQL_ROOT_PASSWORD} \
--env SPRING_MQTT_ONLINEURL=tcp://${MQTT_NAME}:1883 \
--env SPRING_MQTT_URL=tcp://${MQTT_NAME}:1883 \
--env SPRING_MQTT_NEWURL=tcp://${MQTT_NAME}:1883 \
--env SPRING_NEWMQTT_ONLINEURL=tcp://${MQTT_NAME}:1883 \
--env SPRING_NEWMQTT_URL=tcp://${MQTT_NAME}:1883 \
--env SPRING_NEWMQTT_NEWURL=tcp://${MQTT_NAME}:1883 \
--env VIDEOSERVER_REQUESTURL=http://${STREAM_NAME}:8080 \
--env VIDEOSERVER_VIDEOPLAYURL=https://${SRS_DOMAIN}:${NGINX_HTTPS_PORT}/recording/ \
--env SPRING_KAFKA_BOOTSTRAP_SERVERS=${KAFKA_NAME}:${KAFKA_PORT} \
--env MINIO_OSS_ENDPOINT=http://${MINIO_NAME}:9000 \
--env MINIO_OSS_OUTENDPOINT=https://${MINIO_DOMAIN}:${NGINX_HTTPS_PORT} \
--env MINIO_DAJIOSS_ENDPOINT=https://${MINIO_DOMAIN}:${NGINX_HTTPS_PORT} \
--env MINIO_OSS_ACCESSKEYID=${MINIO_ACCESS_KEY} \
--env MINIO_OSS_ACCESSKEYSECRET=${MINIO_SECRET_KEY} \
--env TUOHENG_PUSH_URL=rtmp://${SRS_DOMAIN}:${SRS_RTMP_PORT}/live/ \
--env TUOHENG_PULL_URL=https://${SRS_DOMAIN}:${NGINX_HTTPS_PORT}/live/ \
--env TZ=Asia/Shanghai \
--mount type=bind,source=/etc/localtime,target=/etc/localtime,readonly \
--memory ${DSP_ADMIN_MEMORY} \
--restart unless-stopped \
${DSP_ADMIN_IMAGE}