From c2a7c78225a54445098d666d72c6e84c21ca70ca Mon Sep 17 00:00:00 2001 From: GuangrongFu Date: Mon, 17 May 2021 18:56:05 +0800 Subject: [PATCH] bugfix - rule creation failure on GUI Issue-ID: HOLMES-440 Change-Id: I3ba937d992b054149d1c5cc072b5920935923ec5 Signed-off-by: GuangrongFu --- .../src/main/assembly/bin/find_kill_process.bat | 24 ------------- .../src/main/assembly/bin/initDB.bat | 34 ------------------ rulemgt-standalone/src/main/assembly/bin/initDB.sh | 6 ++-- rulemgt-standalone/src/main/assembly/bin/run.bat | 41 ---------------------- rulemgt-standalone/src/main/assembly/bin/run.sh | 17 ++++----- rulemgt-standalone/src/main/assembly/bin/stop.bat | 34 ------------------ .../src/main/assembly/nginx-http.conf | 4 +-- .../src/main/assembly/nginx-https.conf | 7 ++-- 8 files changed, 16 insertions(+), 151 deletions(-) delete mode 100644 rulemgt-standalone/src/main/assembly/bin/find_kill_process.bat delete mode 100644 rulemgt-standalone/src/main/assembly/bin/initDB.bat delete mode 100644 rulemgt-standalone/src/main/assembly/bin/run.bat delete mode 100644 rulemgt-standalone/src/main/assembly/bin/stop.bat diff --git a/rulemgt-standalone/src/main/assembly/bin/find_kill_process.bat b/rulemgt-standalone/src/main/assembly/bin/find_kill_process.bat deleted file mode 100644 index 6c61d50..0000000 --- a/rulemgt-standalone/src/main/assembly/bin/find_kill_process.bat +++ /dev/null @@ -1,24 +0,0 @@ -@REM -@REM Copyright 2017 ZTE Corporation. -@REM -@REM Licensed under the Apache License, Version 2.0 (the "License"); -@REM you may not use this file except in compliance with the License. -@REM You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. -@REM - -echo %1 | findstr %2 >NUL -echo ERRORLEVEL=%ERRORLEVEL% -IF ERRORLEVEL 1 goto findend -for /f "tokens=1" %%a in (%1) do ( - echo kill %1 - taskkill /F /pid %%a -) -:findend \ No newline at end of file diff --git a/rulemgt-standalone/src/main/assembly/bin/initDB.bat b/rulemgt-standalone/src/main/assembly/bin/initDB.bat deleted file mode 100644 index fd60aed..0000000 --- a/rulemgt-standalone/src/main/assembly/bin/initDB.bat +++ /dev/null @@ -1,34 +0,0 @@ -@REM -@REM Copyright 2017 ZTE Corporation. -@REM -@REM Licensed under the Apache License, Version 2.0 (the "License"); -@REM you may not use this file except in compliance with the License. -@REM You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. -@REM - -@echo off -set HOME=%~dp0 -set user=%1 -set password=%2 -set port=%3 -set host=%4 -echo start init holmes rulemgt db -echo HOME=%HOME% -set main_path=%HOME%..\ -cd /d %main_path% -mysql -u%user% -p%password% -P%port% -h%host% < %main_path%\dbscripts\mysql\onap-holmes_rulemgt-createobj.sql -set "err=%errorlevel%" -if "%err%"=="0" ( - echo init rulemgt db success - ) else ( - echo failed init rulemgt db - pause - ) \ No newline at end of file diff --git a/rulemgt-standalone/src/main/assembly/bin/initDB.sh b/rulemgt-standalone/src/main/assembly/bin/initDB.sh index 3da96e9..86a2d80 100644 --- a/rulemgt-standalone/src/main/assembly/bin/initDB.sh +++ b/rulemgt-standalone/src/main/assembly/bin/initDB.sh @@ -45,11 +45,11 @@ if [ -z `env | grep PGPASSWORD` ]; then need_unset=1 fi -psql -U "'$user'" -p "'$port'" -h "'$host'" -d "'$dbname'" -f $main_path/dbscripts/postgresql/onap-holmes_rulemgt-createobj.sql -psql -U "'$user'" -p "'$port'" -h "'$host'" -d "'$dbname'" --command 'select * from aplus_rule;' +psql -U "$user" -p "$port" -h "$host" -d "$dbname" -f $main_path/dbscripts/postgresql/onap-holmes_rulemgt-createobj.sql +psql -U "$user" -p "$port" -h "$host" -d "$dbname" --command 'select * from aplus_rule;' sql_result=$? -if [ "$need_unset"x == "1"x ]; then +if [ "$need_unset"x = "1"x ]; then unset PGPASSWORD fi diff --git a/rulemgt-standalone/src/main/assembly/bin/run.bat b/rulemgt-standalone/src/main/assembly/bin/run.bat deleted file mode 100644 index 1ea81ab..0000000 --- a/rulemgt-standalone/src/main/assembly/bin/run.bat +++ /dev/null @@ -1,41 +0,0 @@ -@REM -@REM Copyright 2017 ZTE Corporation. -@REM -@REM Licensed under the Apache License, Version 2.0 (the "License"); -@REM you may not use this file except in compliance with the License. -@REM You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. -@REM - -@echo off -title holmes-rulemgt-service - -set RUNHOME=%~dp0 -echo ### RUNHOME: %RUNHOME% -echo ### Starting rulemgt-service -set main_path=%RUNHOME%..\ -cd /d %main_path% -set JAVA="%JAVA_HOME%\bin\java.exe" -set port=8312 -set jvm_opts=-Xms50m -Xmx128m -rem set jvm_opts=%jvm_opts% -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=%port%,server=y,suspend=n -set class_path=%main_path%;%main_path%holmes-rulemgt.jar -echo ### jvm_opts: %jvm_opts% -echo ### class_path: %class_path% - -%JAVA% -classpath %class_path% %jvm_opts% org.onap.holmes.rulemgt.RuleActiveApp server %main_path%conf/rulemgt.yml - -IF ERRORLEVEL 1 goto showerror -exit -:showerror -echo WARNING: Error occurred during startup or Server abnormally stopped by way of killing the process,Please check! -echo After checking, press any key to close -pause -exit \ No newline at end of file diff --git a/rulemgt-standalone/src/main/assembly/bin/run.sh b/rulemgt-standalone/src/main/assembly/bin/run.sh index ffbdc7e..5595a33 100644 --- a/rulemgt-standalone/src/main/assembly/bin/run.sh +++ b/rulemgt-standalone/src/main/assembly/bin/run.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright 2017-2020 ZTE Corporation. +# Copyright 2017-2021 ZTE Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -112,21 +112,18 @@ fi ${RUNHOME}/initDB.sh "$JDBC_USERNAME" "$JDBC_PASSWORD" "$DB_NAME" "$DB_PORT" "${URL_JDBC%:*}" -#Register the frontend to MSB -#body='{"serviceName":"holmes","version":"v1","url":"/iui/holmes","nodes":[{"ip":"host_ip","port":"9104","lb_server_params":"","checkType":"","checkUrl":"","checkInterval":"","checkTimeOut":"","ttl":"","ha_role":""}],"protocol":"UI","visualRange":"0|1","lb_policy":"","publish_port":"","namespace":"","network_plane_type":"","host":"","path":"","labels":[],"metadata":[]}' -#msg_body=${body/host_ip/"${HOSTNAME%:*}"} -#curl -X POST -H "Content-Type: application/json" -d ${msg_body} http://${MSB_ADDR}/api/msdiscover/v1/services?is_manual=true -#echo Registered UI to MSB. - if [ -f "/opt/app/osaaf/local/org.onap.holmes-rule-mgmt.crt" ]; then sed -i "s|/etc/ssl/certs/holmes-frontend-selfsigned.crt|/opt/app/osaaf/local/org.onap.holmes-rule-mgmt.crt|" "/etc/nginx/conf.d/nginx-https.conf" sed -i "s|/etc/ssl/private/holmes-frontend.key|/opt/app/osaaf/local/org.onap.holmes-rule-mgmt.key|" "/etc/nginx/conf.d/nginx-https.conf" fi +if [ "$MSB_IAG_SERVICE_PORT"x = "443"x ]; then + sed -i "s|http://msb-iag.onap|https://$MSB_IAG_SERVICE_HOST:$MSB_IAG_SERVICE_PORT|g" /etc/nginx/conf.d/nginx-http*.conf +else + sed -i "s|http://msb-iag.onap|http://$MSB_IAG_SERVICE_HOST:$MSB_IAG_SERVICE_PORT|g" /etc/nginx/conf.d/nginx-http*.conf +fi -sed -i "s|msb-iag.onap|$MSB_ADDR|g" /etc/nginx/conf.d/nginx-http*.conf - -if [ ${ENABLE_ENCRYPT} = true ]; then +if [ "${ENABLE_ENCRYPT}"x = "true"x ]; then nginx -c /etc/nginx/conf.d/nginx-https.conf else nginx -c /etc/nginx/conf.d/nginx-http.conf diff --git a/rulemgt-standalone/src/main/assembly/bin/stop.bat b/rulemgt-standalone/src/main/assembly/bin/stop.bat deleted file mode 100644 index bfde362..0000000 --- a/rulemgt-standalone/src/main/assembly/bin/stop.bat +++ /dev/null @@ -1,34 +0,0 @@ -@REM -@REM Copyright 2017 ZTE Corporation. -@REM -@REM Licensed under the Apache License, Version 2.0 (the "License"); -@REM you may not use this file except in compliance with the License. -@REM You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. -@REM - -@echo off -title stopping engine-d-service - -set HOME=%~dp0 -set Main_Class="org.onap.holmes.rulemgt.RuleActiveApp" - -echo ================== engine-d-service info ============================================= -echo HOME=$HOME -echo Main_Class=%Main_Class% -echo =============================================================================== - -echo ### Stopping engine-d-service -cd /d %HOME% - -for /f "delims=" %%i in ('"%JAVA_HOME%\bin\jcmd"') do ( - call find_kill_process "%%i" %Main_Class% -) -exit \ No newline at end of file diff --git a/rulemgt-standalone/src/main/assembly/nginx-http.conf b/rulemgt-standalone/src/main/assembly/nginx-http.conf index e0c4ff3..6c49c87 100644 --- a/rulemgt-standalone/src/main/assembly/nginx-http.conf +++ b/rulemgt-standalone/src/main/assembly/nginx-http.conf @@ -1,9 +1,9 @@ #user nobody; -worker_processes 1; error_log logs/error.log; error_log logs/error.log notice; error_log logs/error.log info; +#error_log logs/error.log debug; pid logs/nginx.pid; @@ -34,7 +34,7 @@ http { location / { root /usr/share/nginx/html; - proxy_set_header Host $host; + proxy_set_header Host $proxy_host; proxy_set_header X-Real-IP $remote_addr; proxy_redirect off; diff --git a/rulemgt-standalone/src/main/assembly/nginx-https.conf b/rulemgt-standalone/src/main/assembly/nginx-https.conf index c89c0bd..dafb571 100644 --- a/rulemgt-standalone/src/main/assembly/nginx-https.conf +++ b/rulemgt-standalone/src/main/assembly/nginx-https.conf @@ -4,6 +4,7 @@ worker_processes 1; error_log logs/error.log; error_log logs/error.log notice; error_log logs/error.log info; +#error_log logs/error.log debug; pid logs/nginx.pid; @@ -37,17 +38,17 @@ http { location / { root /usr/share/nginx/html; - proxy_set_header Host $host; + proxy_set_header Host $proxy_host; proxy_set_header X-Real-IP $remote_addr; proxy_redirect off; if ($uri ~ "/api/holmes-rule-mgmt/(.*)") { - proxy_pass https://msb-iag.onap$request_uri; + proxy_pass http://msb-iag.onap$request_uri; break; } if ($uri ~ "/api/holmes-engine-mgmt/(.*)") { - proxy_pass https://msb-iag.onap$request_uri; + proxy_pass http://msb-iag.onap$request_uri; break; } } -- 2.16.6