From 830d585c63897ad8b62bfc47babec32d1cbe66eb Mon Sep 17 00:00:00 2001 From: Xinwei Xiong <3293172751NSS@gmail.com> Date: Mon, 4 Mar 2024 18:19:59 +0800 Subject: [PATCH] feat: optimize openim reset code (#416) --- .github/workflows/scripts-test.yml | 10 +++++----- deployments/helm-charts/config.yaml | 2 +- deployments/templates/config.yaml | 2 +- scripts/admin_rpc_start.sh | 2 +- scripts/check_all.sh | 6 +++--- scripts/docker_start_all.sh | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/scripts-test.yml b/.github/workflows/scripts-test.yml index 29088b78..8ae825f3 100644 --- a/.github/workflows/scripts-test.yml +++ b/.github/workflows/scripts-test.yml @@ -87,7 +87,7 @@ jobs: sudo make start sudo make check - sudo cat logs/chat_$(date '+%Y%m%d').log 2>/dev/null + sudo cat _output/logs/chat_$(date '+%Y%m%d').log 2>/dev/null echo "pwd = $(pwd)" cd .. ls -al && pwd @@ -110,13 +110,13 @@ jobs: run: | sudo make init && \ sudo make start || \ - (echo "An error occurred, printing logs:" && sudo cat ./logs/* 2>/dev/null) + (echo "An error occurred, printing logs:" && sudo cat ./_output/logs/* 2>/dev/null) shell: bash - name: Check all services run: | sudo make check || \ - (echo "An error occurred, printing logs:" && sudo cat ./logs/* 2>/dev/null) + (echo "An error occurred, printing logs:" && sudo cat ./_output/logs/* 2>/dev/null) shell: bash - name: Stop chat @@ -130,7 +130,7 @@ jobs: - name: Print chat_$(date '+%Y%m%d').log run: | ls -al && echo "pwd = $(pwd)" - sudo cat ./logs/* 2>/dev/null - sudo cat ./logs/* 2>/dev/null >> "$GITHUB_OUTPUT" + sudo cat ./_output/logs/* 2>/dev/null + sudo cat ./_output/logs/* 2>/dev/null >> "$GITHUB_OUTPUT" shell: bash continue-on-error: true diff --git a/deployments/helm-charts/config.yaml b/deployments/helm-charts/config.yaml index 537f373e..ee50fa60 100644 --- a/deployments/helm-charts/config.yaml +++ b/deployments/helm-charts/config.yaml @@ -76,7 +76,7 @@ config: # 没有配置表示和OpenIM一致 log: - storageLocation: ../logs/ #存放目录 + storageLocation: ../_output/logs/ #存放目录 rotationTime: 24 #日志旋转时间 remainRotationCount: 2 #日志数量 remainLogLevel: 6 #日志级别 6表示全都打印, diff --git a/deployments/templates/config.yaml b/deployments/templates/config.yaml index 5c19cf18..c2b17c8f 100644 --- a/deployments/templates/config.yaml +++ b/deployments/templates/config.yaml @@ -63,7 +63,7 @@ mysql: # Log configuration - defines how logging is handled log: - storageLocation: ../logs/ # LOG_STORAGE_LOCATION, Directory for storing logs + storageLocation: ../_output/logs/ # LOG_STORAGE_LOCATION, Directory for storing logs rotationTime: 24 # Log rotation time in hours remainRotationCount: 2 # Number of log files to retain remainLogLevel: 6 # Log level (6 = all levels) diff --git a/scripts/admin_rpc_start.sh b/scripts/admin_rpc_start.sh index fe19fcec..4ddeb939 100755 --- a/scripts/admin_rpc_start.sh +++ b/scripts/admin_rpc_start.sh @@ -42,7 +42,7 @@ sleep 1 cd ${push_binary_root} for ((i = 0; i < ${#rpc_ports[@]}; i++)); do - nohup ./${push_name} -port ${rpc_ports[$i]} -prometheus_port ${prome_ports[$i]} >>../logs/chat_$(date '+%Y%m%d').log 2>&1 & + nohup ./${push_name} -port ${rpc_ports[$i]} -prometheus_port ${prome_ports[$i]} >>../_output/logs/chat_$(date '+%Y%m%d').log 2>&1 & done sleep 3 diff --git a/scripts/check_all.sh b/scripts/check_all.sh index e0a82f07..053ce6d5 100755 --- a/scripts/check_all.sh +++ b/scripts/check_all.sh @@ -26,10 +26,10 @@ if [ "$1" == "--print-screen" ]; then PRINT_SCREEN=1 fi -mkdir -p ${SCRIPTS_ROOT}/../logs +mkdir -p ${SCRIPTS_ROOT}/../_output/logs if [ -z "$PRINT_SCREEN" ]; then - exec >> ${SCRIPTS_ROOT}/../logs/chat_$(date '+%Y%m%d').log 2>&1 + exec >> ${SCRIPTS_ROOT}/../_output/logs/chat_$(date '+%Y%m%d').log 2>&1 fi #Include shell font styles and some basic information @@ -125,7 +125,7 @@ for i in "${!service_ports[@]}"; do if [[ "$found_port" != true ]]; then echo -e "${YELLOW_PREFIX}${new_service_name}${COLOR_SUFFIX}${RED_PREFIX} service does not start normally, expected port is ${COLOR_SUFFIX}${YELLOW_PREFIX}${service_port}${COLOR_SUFFIX}" - echo -e "${RED_PREFIX}please check ${SCRIPTS_ROOT}/../logs/chat_$(date '+%Y%m%d').log ${COLOR_SUFFIX}" + echo -e "${RED_PREFIX}please check ${SCRIPTS_ROOT}/../_output/logs/chat_$(date '+%Y%m%d').log ${COLOR_SUFFIX}" cat ${logs_dir}/chat_err_$(date '+%Y%m%d').log exit -1 fi diff --git a/scripts/docker_start_all.sh b/scripts/docker_start_all.sh index 6499e399..3e892558 100755 --- a/scripts/docker_start_all.sh +++ b/scripts/docker_start_all.sh @@ -26,7 +26,7 @@ source "$SCRIPTS_ROOT/path_info.sh" source "$SCRIPTS_ROOT/function.sh" bin_dir="$BIN_DIR" -logs_dir="$SCRIPTS_ROOT/../logs" +logs_dir="$SCRIPTS_ROOT/../_output/logs" if [ ! -d "$logs_dir" ]; then echo "mkdir -p $logs_dir"