From c146405ccd8b127e7a209f1ef77750b3848417b9 Mon Sep 17 00:00:00 2001 From: xuwei-fit2cloud Date: Thu, 21 Dec 2023 16:09:03 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E8=84=9A=E6=9C=AC=E6=8F=90=E7=A4=BA=20#7247?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- installer/dectl | 1 - installer/install.sh | 9 +++++---- installer/uninstall.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 installer/uninstall.sh diff --git a/installer/dectl b/installer/dectl index 2115941e6b..3ad4b7d1f5 100644 --- a/installer/dectl +++ b/installer/dectl @@ -4,7 +4,6 @@ target=$2 DE_BASE=/opt DE_RUNNING_BASE=${DE_BASE}/dataease2.0 -DE_PORT=8100 need_init_apisix=false compose_files="-f docker-compose.yml" compose_cmd="docker-compose" diff --git a/installer/install.sh b/installer/install.sh index 35c83a54c7..dfe7403778 100644 --- a/installer/install.sh +++ b/installer/install.sh @@ -185,9 +185,6 @@ if [[ -d images ]]; then docker load -i images/$i 2>&1 | tee -a ${CURRENT_DIR}/install.log done else - log "拉取镜像" - cd ${DE_RUN_BASE} && docker-compose $compose_files pull 2>&1 - DEVERSION=$(cat ${CURRENT_DIR}/dataease/templates/version) curl -sfL https://resource.fit2cloud.com/installation-log.sh | sh -s de ${INSTALL_TYPE} ${DEVERSION} cd - @@ -244,5 +241,9 @@ log "启动服务" dectl start | tee -a ${CURRENT_DIR}/install.log dectl status 2>&1 | tee -a ${CURRENT_DIR}/install.log +access_port=$DE_PORT +if [[ $DE_INSTALL_MODE != "community" ]];then + access_port=9080 +fi echo -e "======================= 安装完成 =======================\n" 2>&1 | tee -a ${CURRENT_DIR}/install.log -echo -e "系统登录信息如下:\n 用户名: admin\n 初始密码: DataEase@123456" 2>&1 | tee -a ${CURRENT_DIR}/install.log \ No newline at end of file +echo -e "系统登录信息如下:\n 访问地址: http://服务器IP:$access_port\n 用户名: admin\n 初始密码: DataEase@123456" 2>&1 | tee -a ${CURRENT_DIR}/install.log \ No newline at end of file diff --git a/installer/uninstall.sh b/installer/uninstall.sh new file mode 100644 index 0000000000..433f478122 --- /dev/null +++ b/installer/uninstall.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +DE_BASE=/opt + +read -r -p "即将卸载 DataEase 服务,包括删除运行目录、数据及相关镜像,是否继续? [Y/n] " input + +case $input in + [yY][eE][sS]|[yY]) + echo "Yes" + ;; + [nN][oO]|[nN]) + echo "No" + exit 1 + ;; + *) + echo "无效输入..." + exit 1 + ;; +esac + +if [ -f /usr/bin/dectl ]; then + # 获取已安装的 DataEase 的运行目录 + DE_BASE=$(grep "^DE_BASE=" /usr/bin/dectl | cut -d'=' -f2) +fi + +echo "停止 DataEase 服务" +dectl stop + +# 清理 DataEase 相关镜像 +if test ! -z "$(docker images -f dangling=true -q)"; then + echo "清理虚悬镜像" + docker rmi $(docker images -f dangling=true -q) +fi + +if test -n "$(docker images | grep 'registry.cn-qingdao.aliyuncs.com/dataease')"; then + echo "清理 DataEase 镜像" + docker rmi $(docker images | grep "registry.cn-qingdao.aliyuncs.com/dataease" | awk -F' ' '{print $1":"$2}') +fi + +# 清理 DataEase 运行目录及命令行工具 dectl +rm -rf ${DE_BASE}/dataease2.0 /usr/bin/dectl \ No newline at end of file