diff --git a/0001-fix-script-docker-install-error.patch b/0001-fix-script-docker-install-error.patch deleted file mode 100644 index 211a9ea2d7e46fc970bed2a4f1dd6a1254beae01..0000000000000000000000000000000000000000 --- a/0001-fix-script-docker-install-error.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 5ecf2c9769dc81b1a9da2c4ef1821184766a370b Mon Sep 17 00:00:00 2001 -From: gongzt -Date: Mon, 24 Apr 2023 09:36:25 +0800 -Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E9=94=AE=E9=83=A8?= - =?UTF-8?q?=E7=BD=B2=E4=B8=AD=E6=A3=80=E6=9F=A5docker=E3=80=81docker-compo?= - =?UTF-8?q?se=E5=AE=89=E8=A3=85=E7=9A=84=E9=94=99=E8=AF=AF=EF=BC=8C?= - =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=A4=E4=BA=92=E5=BC=8F=E5=91=BD=E4=BB=A4?= - =?UTF-8?q?=E4=B8=AD=E6=A0=87=E8=AF=86=E7=AC=A6=E9=94=99=E8=AF=AF?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - ---- - .../deploy/container/aops-apollo/Dockerfile | 2 +- - .../deploy/container/aops-diana/Dockerfile | 2 +- - scripts/deploy/container/run.sh | 22 ++++++++++++------- - 3 files changed, 16 insertions(+), 10 deletions(-) - -diff --git a/scripts/deploy/container/aops-apollo/Dockerfile b/scripts/deploy/container/aops-apollo/Dockerfile -index 996b7ec..ea0a3fc 100644 ---- a/scripts/deploy/container/aops-apollo/Dockerfile -+++ b/scripts/deploy/container/aops-apollo/Dockerfile -@@ -1,5 +1,5 @@ - FROM openeuler/openeuler:22.03-lts-sp1 - WORKDIR /app --COPY *.repo /app/ -+COPY * /app/ - RUN dnf install aops-apollo -y --setopt=reposdir=/app - CMD ["/bin/bash","/app/start.sh"] -\ No newline at end of file -diff --git a/scripts/deploy/container/aops-diana/Dockerfile b/scripts/deploy/container/aops-diana/Dockerfile -index 03297ec..9e9eef9 100644 ---- a/scripts/deploy/container/aops-diana/Dockerfile -+++ b/scripts/deploy/container/aops-diana/Dockerfile -@@ -1,5 +1,5 @@ - FROM openeuler/openeuler:22.03-lts-sp1 - WORKDIR /app --COPY *.repo /app/ -+COPY * /app/ - RUN dnf install aops-diana -y --setopt=reposdir=/app - CMD ["/bin/bash","/app/start.sh"] -\ No newline at end of file -diff --git a/scripts/deploy/container/run.sh b/scripts/deploy/container/run.sh -index c32a57a..581c0bc 100755 ---- a/scripts/deploy/container/run.sh -+++ b/scripts/deploy/container/run.sh -@@ -44,10 +44,6 @@ prometheus(){ - docker_build(){ - copy_aops_conf - prepare_dockerfile_repo -- storage_mysql_data -- storage_es_data -- prometheus -- docker-compose -f docker-compose-base-service.yml build --no-cache - docker-compose build --no-cache - rm ./aops-apollo/*.repo - rm ./aops-diana/*.repo -@@ -56,14 +52,21 @@ docker_build(){ - } - - install_docker_compose(){ -- installed_docker_compose=`rpm -ql docker-compose` -- if [ "$(echo $installed_docker_compose | grep "is not installed")" != "" ]; then -+ docker_compose_installed=`rpm -q docker-compose` -+ if [ $? -ne 0 ] ; then - dnf install docker-compose -y -+ else -+ echo "docker-compose is already installed." -+ fi -+ docker_installed=`rpm -q docker` -+ if [ $? -ne 0 ] ; then -+ dnf install docker -y -+ else -+ echo "docker is already installed." - fi - } - - main(){ -- - install_docker_compose - while : - do -@@ -71,7 +74,7 @@ main(){ - echo "1. Build the docker container (build)." - echo "2. Start the container orchestration service (start-service/start-env)." - echo "3. Stop all container services (stop-service/stop-env)." -- read "Enter to exit the operation (Q/q)." -+ echo "Enter to exit the operation (Q/q)." - read -p "Select an operation procedure to continue: " operation - case $operation in - "build") -@@ -82,6 +85,9 @@ main(){ - docker-compose up -d - ;; - "start-env") -+ prometheus -+ storage_es_data -+ storage_mysql_data - docker-compose -f docker-compose-base-service.yml up -d - ;; - "stop-service") --- -Gitee - diff --git a/0001-optimize-service-start-check-logic.patch b/0001-optimize-service-start-check-logic.patch new file mode 100644 index 0000000000000000000000000000000000000000..98cea1dbc97218afb08e2bfdbeb517eb269bb268 --- /dev/null +++ b/0001-optimize-service-start-check-logic.patch @@ -0,0 +1,43 @@ +From 2820dc579dad400c8b0f4dfe4220c3d78e218645 Mon Sep 17 00:00:00 2001 +From: gongzt +Date: Wed, 30 Aug 2023 15:41:06 +0800 +Subject: [PATCH] = Optimize start service check logic +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + aops-vulcanus | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/aops-vulcanus b/aops-vulcanus +index abb02b1..ba854f9 100644 +--- a/aops-vulcanus ++++ b/aops-vulcanus +@@ -100,8 +100,13 @@ function is_started() { + function start_service() { + module_name=$1 + echo "[INFO] 1. Before starting the service, ensure that the data table is initialized" +- echo "[INFO] 2. Execute aops-basedatabase zeus or apollo to complete the data table initialization, For example '/opt/aops/script/aops-basedatabase init zues'" ++ echo "[INFO] 2. Execute aops-basedatabase zeus or apollo to complete the data table initialization, For example '/opt/aops/script/aops-basedatabase init zeus'" + uwsgi -d --ini ${OUT_PATH}/"${module_name}".ini --enable-threads ++ pid=`ps auxww | grep $module_name.ini | grep -v grep | awk '{print $2}'` ++ if [ "${pid}" = "" ]; then ++ echo "[ERROR] start uwsgi service: ${module_name} failed" ++ exit 1 ++ fi + echo "[INFO] start uwsgi service: ${module_name} success" + exit 0 + } +@@ -167,7 +172,7 @@ function check_mysql_installed() { + aops_database=$(get_config "$CONFIG_FILE" "mysql" "database_name") + connect_check_cmd="import pymysql + try: +- connect = pymysql.connect(host='$mysql_ip', port=$port, password='123456', database='$aops_database') ++ connect = pymysql.connect(host='$mysql_ip', port=$port, database='$aops_database') + connect.close() + except pymysql.err.OperationalError: + print(False) +-- +Gitee + diff --git a/0002-add-custom-validation-rules.patch b/0002-add-custom-validation-rules.patch deleted file mode 100644 index e65dfa7df374a340038ec3cf7befe4a827c84555..0000000000000000000000000000000000000000 --- a/0002-add-custom-validation-rules.patch +++ /dev/null @@ -1,78 +0,0 @@ -From e1a72048bed334ff2e5014e2437598aa5580760f Mon Sep 17 00:00:00 2001 -From: rabbitali -Date: Wed, 26 Apr 2023 19:25:32 +0800 -Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89?= - =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99;=E6=B7=BB=E5=8A=A0?= - =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=80=80=E5=87=BA=E7=99=BB=E5=BD=95=E6=8E=A5?= - =?UTF-8?q?=E5=8F=A3=E7=9A=84=E8=B7=AF=E7=94=B1?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - ---- - vulcanus/conf/constant.py | 1 + - vulcanus/restful/serialize/validate.py | 31 ++++++++++++++++++++++++++ - 2 files changed, 32 insertions(+) - -diff --git a/vulcanus/conf/constant.py b/vulcanus/conf/constant.py -index 9779602..7185685 100644 ---- a/vulcanus/conf/constant.py -+++ b/vulcanus/conf/constant.py -@@ -53,6 +53,7 @@ GET_GROUP = "/manage/host/group/get" - COLLECT_CONFIG = '/manage/config/collect' - - USER_LOGIN = "/manage/account/login" -+LOGOUT = "/manage/account/logout" - CHANGE_PASSWORD = '/manage/account/change' - ADD_USER = '/manage/account/add' - GITEE_AUTH_LOGIN = "/manage/account/gitee/login" -diff --git a/vulcanus/restful/serialize/validate.py b/vulcanus/restful/serialize/validate.py -index bfe25ad..1c00804 100644 ---- a/vulcanus/restful/serialize/validate.py -+++ b/vulcanus/restful/serialize/validate.py -@@ -15,6 +15,7 @@ Time: - Author: - Description: - """ -+import re - from marshmallow import ValidationError - - -@@ -42,3 +43,33 @@ def validate(verifier, data, load=False): - errors = verifier().validate(data) - - return result, errors -+ -+ -+class ValidateRules: -+ """ -+ Custom validation rules -+ """ -+ -+ @staticmethod -+ def space_character_check(string: str) -> None: -+ """ -+ one of validation rules for string, no spaces are allowed at the beginning or end. -+ """ -+ if len(string.strip()) != len(string): -+ raise ValidationError("there may be space character exists at the beginning or end!") -+ -+ @staticmethod -+ def account_name_check(string: str) -> None: -+ """ -+ validation rules for username, which only contains string or number -+ """ -+ if not re.findall("[a-zA-Z0-9]{5,20}", string): -+ raise ValidationError("username should only contains string or number, between 5 and 20 characters!") -+ -+ @staticmethod -+ def account_password_check(string: str) -> None: -+ """ -+ validation rules for password, which only contains string or number -+ """ -+ if not re.findall("[a-zA-Z0-9]{6,20}", string): -+ raise ValidationError("password should only contains string or number, between 6 and 20 characters!!") -\ No newline at end of file --- -Gitee - diff --git a/0002-fix-systemctl-startup-service-error.patch b/0002-fix-systemctl-startup-service-error.patch new file mode 100644 index 0000000000000000000000000000000000000000..595f38b9382b14e3897885a023ea92e69e16e10a --- /dev/null +++ b/0002-fix-systemctl-startup-service-error.patch @@ -0,0 +1,58 @@ +From 97d9a39ac7a196af73f491f3d447023797fbe469 Mon Sep 17 00:00:00 2001 +From: gongzt +Date: Mon, 18 Sep 2023 11:39:40 +0800 +Subject: [PATCH 1/1] fix systemctl startup service error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + aops-vulcanus | 5 ++++- + scripts/deploy/aops-basedatabase.sh | 6 +++--- + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/aops-vulcanus b/aops-vulcanus +index ba854f9..f00b4a0 100644 +--- a/aops-vulcanus ++++ b/aops-vulcanus +@@ -101,9 +101,11 @@ function start_service() { + module_name=$1 + echo "[INFO] 1. Before starting the service, ensure that the data table is initialized" + echo "[INFO] 2. Execute aops-basedatabase zeus or apollo to complete the data table initialization, For example '/opt/aops/script/aops-basedatabase init zeus'" ++ rm -rf ${OUT_PATH}/"${module_name}".pid + uwsgi -d --ini ${OUT_PATH}/"${module_name}".ini --enable-threads + pid=`ps auxww | grep $module_name.ini | grep -v grep | awk '{print $2}'` +- if [ "${pid}" = "" ]; then ++ local_pid=`cat ${OUT_PATH}/"${module_name}".pid` ++ if [ "${pid}" = "" ] && [ "${local_pid}" = "" ]; then + echo "[ERROR] start uwsgi service: ${module_name} failed" + exit 1 + fi +@@ -115,6 +117,7 @@ function stop_service() { + module_name=$1 + echo "[INFO] stop uwsgi service: ${module_name}" + uwsgi --stop ${OUT_PATH}/"${module_name}".pid ++ rm -rf ${OUT_PATH}/"${module_name}".pid + echo "[INFO] stop ${AOPS_CONSTANT} service success" + exit 0 + } +diff --git a/scripts/deploy/aops-basedatabase.sh b/scripts/deploy/aops-basedatabase.sh +index 054bea9..49a80f4 100755 +--- a/scripts/deploy/aops-basedatabase.sh ++++ b/scripts/deploy/aops-basedatabase.sh +@@ -133,9 +133,9 @@ function main(){ + service=$2 + case $operation in + "init") +- if [ "${service}" != "zeus" ] && [ "${service}" != "apollo" ]; then +- echo "[ERROR] Table initialization service can only be zeus or apollo" +- echo "[INFO] e.g 'aops-basedatabase init zeus' or 'aops-basedatabase init apollo'" ++ if [ "${service}" != "zeus" ] && [ "${service}" != "apollo" ] && [ "${service}" != "diana" ]; then ++ echo "[ERROR] Table initialization service can only be zeus apollo or diana" ++ echo "[INFO] e.g 'aops-basedatabase init zeus' 'aops-basedatabase init apollo' or 'aops-basedatabase init diana'" + exit 1 + fi + config_file="/etc/aops/$service.ini" +-- +2.33.1.windows.1 + diff --git a/0003-old-token-is-invalid.patch b/0003-old-token-is-invalid.patch deleted file mode 100644 index 4243943bd9caab335c8a3f6b2cd1fbc235d3b655..0000000000000000000000000000000000000000 --- a/0003-old-token-is-invalid.patch +++ /dev/null @@ -1,29 +0,0 @@ -From: gongzt -Date: Sat, 6 May 2023 10:12:42 +0800 -Subject:[PATCH] fix old token can still be used normally -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - ---- - vulcanus/restful/response.py | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/vulcanus/restful/response.py b/vulcanus/restful/response.py -index 0cb8c4b..f21e6ca 100644 ---- a/vulcanus/restful/response.py -+++ b/vulcanus/restful/response.py -@@ -139,9 +139,8 @@ class BaseResponse(Resource): - except ValueError: - return state.TOKEN_ERROR - -- cache_token = RedisProxy.redis_connect.get( -- "token_" + verify_info["key"]) -- if not cache_token: -+ cache_token = RedisProxy.redis_connect.get("token_" + verify_info["key"]) -+ if not cache_token or cache_token != token: - return state.TOKEN_ERROR - - args['username'] = verify_info["key"] --- -Gitee diff --git a/0003-update-aops-basedatabase.patch b/0003-update-aops-basedatabase.patch new file mode 100644 index 0000000000000000000000000000000000000000..bfd13507ad26732eaa0e43c5eb51fc6d0bd44039 --- /dev/null +++ b/0003-update-aops-basedatabase.patch @@ -0,0 +1,29 @@ +From 5cb95dafa699058cbdfb3056e8b10960f2a82408 Mon Sep 17 00:00:00 2001 +From: smjiao +Date: Mon, 9 Oct 2023 07:13:16 +0000 +Subject: update scripts/deploy/aops-basedatabase.sh +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: smjiao +--- + scripts/deploy/aops-basedatabase.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/deploy/aops-basedatabase.sh b/scripts/deploy/aops-basedatabase.sh +index 49a80f4..438716d 100755 +--- a/scripts/deploy/aops-basedatabase.sh ++++ b/scripts/deploy/aops-basedatabase.sh +@@ -1,7 +1,7 @@ + #!/bin/bash + . /usr/bin/aops-vulcanus + REPO_CONFIG_FILE="/etc/yum.repos.d/aops_elascticsearch.repo" +-INSTALL_SOFTWARE=$1 ++INSTALL_SOFTWARE=$2 + + function check_es_status() { + visit_es_response=$(curl -s -XGET http://127.0.0.1:9200) +-- +Gitee + diff --git a/0004-add-gevent-config-item-for-uwsgi.patch b/0004-add-gevent-config-item-for-uwsgi.patch deleted file mode 100644 index 6717066935c170a31870e1970c3ba85525781cea..0000000000000000000000000000000000000000 --- a/0004-add-gevent-config-item-for-uwsgi.patch +++ /dev/null @@ -1,40 +0,0 @@ -From: rabbitali -Date: Mon, 8 May 2023 10:34:39 +0800 -Subject: [PATCH] add gevent conf item when create uwsgi conf file - ---- - aops-vulcanus | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/aops-vulcanus b/aops-vulcanus -index 368c57f..d7e4cb9 100644 ---- a/aops-vulcanus -+++ b/aops-vulcanus -@@ -42,6 +42,7 @@ function create_config_file() { - harakiri=$(get_config "${config_file}" "uwsgi" "harakiri") - processes=$(get_config "${config_file}" "uwsgi" "processes") - threads=$(get_config "${config_file}" "uwsgi" "threads") -+ gevent=$(get_config "${config_file}" "uwsgi" "gevent") - - check_file $daemonize - echo "[INFO] run ${service_name} under path: ${wsgi_file}" -@@ -65,10 +66,16 @@ pidfile=${OUT_PATH}/${service_name}.pid - callable=app - http-timeout=${http_timeout} - harakiri=${harakiri} --threads=${threads} - processes=${processes} - lazy-apps=true - daemonize=${daemonize}" >"${OUT_PATH}"/"${service_name}".ini -+ if [ ${gevent} ] -+ then -+ echo "gevent=${gevent} -+gevent-monkey-patch=true" >>"${OUT_PATH}"/"${service_name}".ini -+ else -+ echo "threads=${threads}" >>"${OUT_PATH}"/"${service_name}".ini -+ fi - chown root: ${OUT_PATH}/"${service_name}".ini - chmod 750 ${OUT_PATH}/"${service_name}".ini - echo "[INFO] create ${service_name} uwsgi file ok,path is ${OUT_PATH}/${service_name}.ini" --- - diff --git a/0004-fix-information-path-incorrect.patch b/0004-fix-information-path-incorrect.patch new file mode 100644 index 0000000000000000000000000000000000000000..1593ebe286011620a02a09732446cb26ddb9b65d --- /dev/null +++ b/0004-fix-information-path-incorrect.patch @@ -0,0 +1,55 @@ +From 565c3e1263fd5835c17309cc92d84e31f893abfb Mon Sep 17 00:00:00 2001 +From: zhangdaolong +Date: Thu, 12 Oct 2023 17:34:12 +0800 +Subject: The information path is incorrect +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + aops-vulcanus | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/aops-vulcanus b/aops-vulcanus +index f00b4a0..c0fc779 100644 +--- a/aops-vulcanus ++++ b/aops-vulcanus +@@ -100,7 +100,7 @@ function is_started() { + function start_service() { + module_name=$1 + echo "[INFO] 1. Before starting the service, ensure that the data table is initialized" +- echo "[INFO] 2. Execute aops-basedatabase zeus or apollo to complete the data table initialization, For example '/opt/aops/script/aops-basedatabase init zeus'" ++ echo "[INFO] 2. Execute aops-basedatabase zeus or apollo to complete the data table initialization, For example '/opt/aops/scripts/deploy/aops-basedatabase.sh init zeus'" + rm -rf ${OUT_PATH}/"${module_name}".pid + uwsgi -d --ini ${OUT_PATH}/"${module_name}".ini --enable-threads + pid=`ps auxww | grep $module_name.ini | grep -v grep | awk '{print $2}'` +@@ -140,7 +140,7 @@ function check_es_installed() { + if [ -z "${es_ip}" ] || [ -z "${es_port}" ]; then + echo "[ERROR] can not find config name 'ip' or 'port' of elasticsearch in: ${CONFIG_FILE}, please check the file" + echo "If you have installed ES, Please set correct 'ip' value and 'port' of elasticsearch value and re-execute '${DATABASE_CONSTANT} start' " +- echo "If you have not installed ES, please execute the automatic installation script '/opt/aops/script/aops-basedatabase elasticsearch' under the root user " ++ echo "If you have not installed ES, please execute the automatic installation script '/opt/aops/scripts/deploy/aops-basedatabase.sh elasticsearch' under the root user " + exit 1 + fi + check_num "${es_port}" "es_port" +@@ -149,7 +149,7 @@ function check_es_installed() { + if [ -z "${visit_es_response}" ]; then + echo "=========================================================================" + echo "[ERROR] elasticsearch connection FAILED,the following reason may cause failed:" +- echo "[INFO] 1. You have not installed Elasticsearch, if you need to install, please execute the automatic installation script '/opt/aops/script/sops-basedatabase' under the root user" ++ echo "[INFO] 1. You have not installed Elasticsearch, if you need to install, please execute the automatic installation script '/opt/aops/scripts/deploy/aops-basedatabase.sh' under the root user" + echo "[INFO] 2. Elasticsearch configuration is incorrect, please update value of 'ip' and 'port' of elasticsearch in $CONFIG_FILE" + echo "[INFO] 3. Elasticsearch service not started, please start elasticsearch service." + exit 1 +@@ -184,7 +184,7 @@ except pymysql.err.OperationalError: + if [ "${init_result}" = "False" ]; then + echo "=========================================================================" + echo "[ERROR] mysql connection FAILED, the following reason may cause failed:" +- echo "[INFO] 1. You have not installed mysql,If you need to install, please execute the automatic installation script '/opt/aops/script/aops-basedatabase' under the root user, For example '/opt/aops/script/aops-basedatabase install mysql'" ++ echo "[INFO] 1. You have not installed mysql,If you need to install, please execute the automatic installation script '/opt/aops/scripts/deploy/aops-basedatabase.sh' under the root user, For example '/opt/aops/scripts/deploy/aops-basedatabase.sh install mysql'" + echo "[INFO] 2. mysql configuration is incorrect,please update value of 'ip' and 'port' of mysql in ${CONFIG_FILE}" + echo "[INFO] 3. mysql service not started,please start mysql service." + exit 1 +-- +Gitee + diff --git a/0005-suitable-for-version-2003-sp3.patch b/0005-suitable-for-version-2003-sp3.patch new file mode 100644 index 0000000000000000000000000000000000000000..2eb01b9bd3ccbd8a1e545e121d8fa0393a6cb04b --- /dev/null +++ b/0005-suitable-for-version-2003-sp3.patch @@ -0,0 +1,196 @@ +From 91490e80fe9c6deb16042a2919f3c916ce274e1e Mon Sep 17 00:00:00 2001 +From: gongzt +Date: Mon, 16 Oct 2023 11:08:12 +0800 +Subject: It is suitable for version 20.03-LTS-sp3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + aops-vulcanus | 33 +------------------------ + aops-vulcanus.spec | 2 +- + scripts/deploy/aops-basedatabase.sh | 38 ++++++++++++++++++++++++++++- + scripts/deploy/container/run.sh | 11 ++++++--- + 4 files changed, 46 insertions(+), 38 deletions(-) + +diff --git a/aops-vulcanus b/aops-vulcanus +index f00b4a0..cef2b4f 100644 +--- a/aops-vulcanus ++++ b/aops-vulcanus +@@ -192,36 +192,5 @@ except pymysql.err.OperationalError: + echo "[INFO] mysql check ok" + } + +-function init_database_and_table() { +- CONFIG_FILE=$1 +- mysql_ip=$(get_config "${CONFIG_FILE}" "mysql" "ip") +- port=$(get_config "${CONFIG_FILE}" "mysql" "port") +- sql_file=$2 +- init_database_and_table_cmd="import pymysql,os +-try: +- database = pymysql.connect(host='$mysql_ip', port=$port, database='mysql', autocommit=True) +- with open('$sql_file', 'r', encoding='utf-8') as file: +- sql = file.read() +- if not sql: +- print(False) +- else: +- cursor = database.cursor() +- for command in filter(lambda _sql: _sql != os.linesep and _sql, sql.split(';')): +- sql_command = command.replace(os.linesep, '') +- if not sql_command: +- continue +- cursor.execute(sql_command) +- database.close() +-except (IOError, pymysql.err.OperationalError): +- print(False) +-" +- init_result=$(python3 -c "$init_database_and_table_cmd") +- if [ "${init_result}" = "False" ]; then +- echo "[ERROR] Table initialization failed" +- echo "[INFO] 1. Make sure that the data table initialization of the zeus service is performed first." +- echo "[INFO] 2. Check that the database configuration file is correct, please check value of 'ip' and 'port' of mysql in ${CONFIG_FILE}" +- else +- echo "[INFO] Database and table initialization ok" +- fi +-} ++ + +diff --git a/aops-vulcanus.spec b/aops-vulcanus.spec +index bf802e3..e5c4d86 100644 +--- a/aops-vulcanus.spec ++++ b/aops-vulcanus.spec +@@ -14,7 +14,7 @@ Requires: python3-concurrent-log-handler python3-xmltodict python3-pyyaml pyth + Requires: python3-requests python3-xlrd python3-prettytable python3-pygments python3-sqlalchemy + Requires: python3-elasticsearch >= 7 python3-prometheus-api-client python3-urllib3 python3-werkzeug + Requires: python3-flask python3-flask-restful python3-PyMySQL python3-kafka-python +-Requires: python-jwt python-redis python3-Flask-APScheduler >= 1.11.0 python3-APScheduler ++Requires: python-jwt python3-redis python3-Flask-APScheduler >= 1.11.0 python3-APScheduler + Provides: aops-vulcanus + Conflicts: aops-utils + +diff --git a/scripts/deploy/aops-basedatabase.sh b/scripts/deploy/aops-basedatabase.sh +index 438716d..a8f5898 100755 +--- a/scripts/deploy/aops-basedatabase.sh ++++ b/scripts/deploy/aops-basedatabase.sh +@@ -1,5 +1,4 @@ + #!/bin/bash +-. /usr/bin/aops-vulcanus + REPO_CONFIG_FILE="/etc/yum.repos.d/aops_elascticsearch.repo" + INSTALL_SOFTWARE=$2 + +@@ -128,6 +127,43 @@ function install_database() { + fi + } + ++function get_config() { ++ INIFILE=$1 ++ SECTION=$2 ++ ITEM=$3 ++ awk -F '=' '/\['"$SECTION"'\]/{a=1}a==1&&$1~/'"$ITEM"'/{print $2; exit}' "$INIFILE" ++} ++ ++function init_database_and_table() { ++ CONFIG_FILE=$1 ++ mysql_ip=$(get_config "${CONFIG_FILE}" "mysql" "ip") ++ port=$(get_config "${CONFIG_FILE}" "mysql" "port") ++ sql_file=$2 ++ init_database_and_table_cmd="import pymysql,os ++from pymysql.constants import CLIENT ++try: ++ database = pymysql.connect(host='$mysql_ip', port=$port, database='mysql', autocommit=True,client_flag=CLIENT.MULTI_STATEMENTS) ++ with open('$sql_file', 'r', encoding='utf-8') as file: ++ sql = file.read() ++ if not sql: ++ print(False) ++ else: ++ cursor = database.cursor() ++ cursor.execute(sql) ++ database.close() ++except (IOError, pymysql.err.OperationalError): ++ print(False) ++" ++ init_result=$(python3 -c "$init_database_and_table_cmd") ++ if [ "${init_result}" = "False" ]; then ++ echo "[ERROR] Table initialization failed" ++ echo "[INFO] 1. Make sure that the data table initialization of the zeus service is performed first." ++ echo "[INFO] 2. Check that the database configuration file is correct, please check value of 'ip' and 'port' of mysql in ${CONFIG_FILE}" ++ else ++ echo "[INFO] Database and table initialization ok" ++ fi ++} ++ + function main(){ + operation=$1 + service=$2 +diff --git a/scripts/deploy/container/run.sh b/scripts/deploy/container/run.sh +index 581c0bc..dffbfaf 100755 +--- a/scripts/deploy/container/run.sh ++++ b/scripts/deploy/container/run.sh +@@ -71,11 +71,12 @@ main(){ + while : + do + echo "===========================Container arrangement===========================" +- echo "1. Build the docker container (build)." +- echo "2. Start the container orchestration service (start-service/start-env)." +- echo "3. Stop all container services (stop-service/stop-env)." ++ echo "Welcome to the one-click deployment script, supporting pre-building of container images and start-stop of services." ++ echo "Image Building (build): supports the generation of docker images for zeus, apollo, hermes services." ++ echo "Service Start (start): the service types are divided into basic environment services and application services. Basic environment services include mysql, elasticsearch, redis, kafka, prometheus, which can be started by entering the 'start-env' option. Application services include apollo, zeus, hermes, which can be started by entering the 'start-service' option. please remember that, in the absence of a pre-existing environment, the correct order of using one-click startup services is to first execute "start-env" and then "start-service" Both steps are essential and cannot be skipped." ++ echo "Stop Service (stop): enter 'stop-env' or 'stop-service' to stop the basic environment services and application services respectively. After the basic environment services are stopped, if the configuration items of the application services are not reconfigured, it will cause the application services to be unusable. Conversely, after stopping the application services, there is no impact on the basic environment services." + echo "Enter to exit the operation (Q/q)." +- read -p "Select an operation procedure to continue: " operation ++ read -p "Please enter build, start-env, start-service, stop-env, stop-service, or q/Q to proceed to the next step: " operation + case $operation in + "build") + docker_build +@@ -83,6 +84,8 @@ main(){ + ;; + "start-service") + docker-compose up -d ++ bash /opt/aops/scripts/aops-basedatabase.sh init zeus ++ bash /opt/aops/scripts/aops-basedatabase.sh init apollo + ;; + "start-env") + prometheus +-- +Gitee + + +From adf7afd90a882e013e0d16a7e1af35572d75f38f Mon Sep 17 00:00:00 2001 +From: gongzt +Date: Wed, 18 Oct 2023 14:11:59 +0800 +Subject: [PATCH 2/2] =?UTF-8?q?=E9=80=82=E9=85=8D20.03-sp3=E7=89=88?= + =?UTF-8?q?=E6=9C=AC=E4=B8=AD=E7=9A=84python-jwt?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + vulcanus/token.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/vulcanus/token.py b/vulcanus/token.py +index e449991..786d5f3 100644 +--- a/vulcanus/token.py ++++ b/vulcanus/token.py +@@ -60,12 +60,16 @@ def generate_token(unique_iden, minutes=20, **kwargs): + try: + token_body["key"] = unique_iden + token_body["create_time"] = time.localtime() +- return jwt.encode( ++ jwt_token = jwt.encode( + token_body, + configuration.individuation.get("PRIVATE_KEY"), + algorithm="HS256", + headers=dict(alg="HS256"), + ) ++ if isinstance(jwt_token, bytes): ++ jwt_token = jwt_token.decode("utf-8") ++ return jwt_token ++ + except Exception: + raise ValueError("Token generation failed") + +-- +Gitee + diff --git a/0005-update-length-limit-of-username-field.patch b/0005-update-length-limit-of-username-field.patch deleted file mode 100644 index 1e17daaa3ba1fedcc4e10a0b6a34ddc9415d846f..0000000000000000000000000000000000000000 --- a/0005-update-length-limit-of-username-field.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 4276d15604e0445558009a7c48dce323073cd2d3 Mon Sep 17 00:00:00 2001 -From: rabbitali -Date: Tue, 9 May 2023 11:03:45 +0800 -Subject: [PATCH] update length limit of username field - ---- - vulcanus/database/table.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/vulcanus/database/table.py b/vulcanus/database/table.py -index 0c8d2c1..23ad889 100644 ---- a/vulcanus/database/table.py -+++ b/vulcanus/database/table.py -@@ -56,7 +56,7 @@ class Host(Base, MyBase): # pylint: disable=R0903 - last_scan = Column(Integer) - scene = Column(String(255)) - os_version = Column(String(40)) -- ssh_user = Column(String(20), default="root") -+ ssh_user = Column(String(40), default="root") - ssh_port = Column(Integer(), default=22) - pkey = Column(String(2048)) - status = Column(Integer(), default=2) --- -Gitee - diff --git a/0006-update-timed-task-args-check-and-timeout.patch b/0006-update-timed-task-args-check-and-timeout.patch new file mode 100644 index 0000000000000000000000000000000000000000..b5cb79b5f7db270b8e3771edf0f397b50ac3dabd --- /dev/null +++ b/0006-update-timed-task-args-check-and-timeout.patch @@ -0,0 +1,36 @@ +From b45d4895509b85752e62bf97267813f7cc77fec4 Mon Sep 17 00:00:00 2001 +From: rabbitali +Date: Tue, 24 Oct 2023 21:15:46 +0800 +Subject: [PATCH] update timed task args check and timeout + +--- + vulcanus/conf/constant.py | 2 +- + vulcanus/timed.py | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/vulcanus/conf/constant.py b/vulcanus/conf/constant.py +index ef2dbe3..427d949 100644 +--- a/vulcanus/conf/constant.py ++++ b/vulcanus/conf/constant.py +@@ -29,4 +29,4 @@ PRIVATE_INDIVIDUATION_CONFIG = os.path.join(BASE_CONFIG_PATH, ".aops-private-con + + + REFRESH_TOKEN_EXP = 1440 +-TIMEOUT = 600 ++TIMEOUT = 900 +diff --git a/vulcanus/timed.py b/vulcanus/timed.py +index 52874cb..7d31bee 100644 +--- a/vulcanus/timed.py ++++ b/vulcanus/timed.py +@@ -94,7 +94,7 @@ class TimedTask: + LOGGER.error("Wrong trigger parameter for timed tasks : %s.", trigger) + return False + +- if "day_of_week" not in timed or "hour" not in timed: ++ if "day_of_week" not in timed or "hour" not in timed or "minutes" not in timed: + LOGGER.error("Missing required fields when creating scheduled task.") + return False + +-- +2.33.0 + diff --git a/aops-vulcanus-v1.2.0.tar.gz b/aops-vulcanus-v1.2.0.tar.gz deleted file mode 100644 index cf87863606b366629207080489541ddd344868b5..0000000000000000000000000000000000000000 Binary files a/aops-vulcanus-v1.2.0.tar.gz and /dev/null differ diff --git a/aops-vulcanus-v1.3.0.tar.gz b/aops-vulcanus-v1.3.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..4e91ea254801e7dfb2a399aa58fc7f1318ad4fff Binary files /dev/null and b/aops-vulcanus-v1.3.0.tar.gz differ diff --git a/aops-vulcanus.spec b/aops-vulcanus.spec index 2794beb6b632d967a6c8a53108fc9143950664e4..2c2dc021500df979d3a3af4b8105822d5b6f1222 100644 --- a/aops-vulcanus.spec +++ b/aops-vulcanus.spec @@ -1,23 +1,24 @@ Name: aops-vulcanus -Version: v1.2.0 -Release: 4 +Version: v1.3.0 +Release: 6 Summary: A basic tool libraries of aops, including logging, configure and response, etc. License: MulanPSL2 URL: https://gitee.com/openeuler/%{name} Source0: %{name}-%{version}.tar.gz -Patch0001: 0001-fix-script-docker-install-error.patch -Patch0002: 0002-add-custom-validation-rules.patch -Patch0003: 0003-old-token-is-invalid.patch -Patch0004: 0004-add-gevent-config-item-for-uwsgi.patch -Patch0005: 0005-update-length-limit-of-username-field.patch - +Patch0001: 0001-optimize-service-start-check-logic.patch +Patch0002: 0002-fix-systemctl-startup-service-error.patch +Patch0003: 0003-update-aops-basedatabase.patch +Patch0004: 0004-fix-information-path-incorrect.patch +Patch0005: 0005-suitable-for-version-2003-sp3.patch +Patch0006: 0006-update-timed-task-args-check-and-timeout.patch + BuildRequires: python3-setuptools Requires: python3-concurrent-log-handler python3-xmltodict python3-pyyaml python3-marshmallow >= 3.13.0 Requires: python3-requests python3-xlrd python3-prettytable python3-pygments python3-sqlalchemy Requires: python3-elasticsearch >= 7 python3-prometheus-api-client python3-urllib3 python3-werkzeug Requires: python3-flask python3-flask-restful python3-PyMySQL python3-kafka-python -Requires: python-jwt python-redis +Requires: python-jwt python3-redis Provides: aops-vulcanus Conflicts: aops-utils @@ -65,6 +66,33 @@ cp -r scripts %{buildroot}/opt/aops/ %changelog +* Wed Oct 25 2023 wenxin - v1.3.0-6 +- since there is no arm-arch package in new repo source, remove changes of the es repo source url + +* Tue Oct 24 2023 wenxin - v1.3.0-5 +- update timed task args check and timeout +- update elasticsearch repo source url + +* Wed Oct 18 2023 gongzhengtang - v1.3.0-4 +- it is suitable for version 20.03-LTS-sp3 + +* Tue Sep 19 2023 wenxin - v1.3.0-3 +- fix systemctl startup service problem + +* Mon Sep 11 2023 zhuyuncheng - v1.3.0-2 +- optimize start service check logic + +* Tue Aug 29 2023 wenxin - v1.3.0-1 +- optimize project directory structure +- support database initialization script + +* Thu Jun 08 2023 wenxin - v1.2.1-2 +- fix issue: aops-zeus app failed to load when first start by uwsgi +- add paging parameter schema + +* Tue May 23 2023 wenxin - v1.2.1-1 +- add cve rollback url for aops-zeus + * Tue May 9 2023 wenxin - v1.2.0-4 - update length limit of username field