bugfix - rule creation failure on GUI 80/121380/2
authorGuangrongFu <fu.guangrong@zte.com.cn>
Mon, 17 May 2021 10:56:05 +0000 (18:56 +0800)
committerGuangrongFu <fu.guangrong@zte.com.cn>
Mon, 17 May 2021 11:30:39 +0000 (19:30 +0800)
Issue-ID: HOLMES-440

Change-Id: I3ba937d992b054149d1c5cc072b5920935923ec5
Signed-off-by: GuangrongFu <fu.guangrong@zte.com.cn>
rulemgt-standalone/src/main/assembly/bin/find_kill_process.bat [deleted file]
rulemgt-standalone/src/main/assembly/bin/initDB.bat [deleted file]
rulemgt-standalone/src/main/assembly/bin/initDB.sh
rulemgt-standalone/src/main/assembly/bin/run.bat [deleted file]
rulemgt-standalone/src/main/assembly/bin/run.sh
rulemgt-standalone/src/main/assembly/bin/stop.bat [deleted file]
rulemgt-standalone/src/main/assembly/nginx-http.conf
rulemgt-standalone/src/main/assembly/nginx-https.conf

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 (file)
index 6c61d50..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-@REM\r
-@REM Copyright 2017 ZTE Corporation.\r
-@REM\r
-@REM Licensed under the Apache License, Version 2.0 (the "License");\r
-@REM you may not use this file except in compliance with the License.\r
-@REM You may obtain a copy of the License at\r
-@REM\r
-@REM     http://www.apache.org/licenses/LICENSE-2.0\r
-@REM\r
-@REM Unless required by applicable law or agreed to in writing, software\r
-@REM distributed under the License is distributed on an "AS IS" BASIS,\r
-@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-@REM See the License for the specific language governing permissions and\r
-@REM limitations under the License.\r
-@REM\r
-\r
-echo %1 | findstr %2 >NUL\r
-echo ERRORLEVEL=%ERRORLEVEL%\r
-IF ERRORLEVEL 1 goto findend\r
-for /f "tokens=1" %%a in (%1) do (  \r
-    echo kill %1\r
-    taskkill /F /pid %%a\r
-)\r
-: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 (file)
index fd60aed..0000000
+++ /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
index 3da96e9..86a2d80 100644 (file)
@@ -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 (file)
index 1ea81ab..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-@REM\r
-@REM Copyright 2017 ZTE Corporation.\r
-@REM\r
-@REM Licensed under the Apache License, Version 2.0 (the "License");\r
-@REM you may not use this file except in compliance with the License.\r
-@REM You may obtain a copy of the License at\r
-@REM\r
-@REM     http://www.apache.org/licenses/LICENSE-2.0\r
-@REM\r
-@REM Unless required by applicable law or agreed to in writing, software\r
-@REM distributed under the License is distributed on an "AS IS" BASIS,\r
-@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-@REM See the License for the specific language governing permissions and\r
-@REM limitations under the License.\r
-@REM\r
-\r
-@echo off\r
-title holmes-rulemgt-service\r
-\r
-set RUNHOME=%~dp0\r
-echo ### RUNHOME: %RUNHOME%\r
-echo ### Starting rulemgt-service\r
-set main_path=%RUNHOME%..\\r
-cd /d %main_path%\r
-set JAVA="%JAVA_HOME%\bin\java.exe"\r
-set port=8312\r
-set jvm_opts=-Xms50m -Xmx128m\r
-rem set jvm_opts=%jvm_opts% -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=%port%,server=y,suspend=n\r
-set class_path=%main_path%;%main_path%holmes-rulemgt.jar\r
-echo ### jvm_opts: %jvm_opts%\r
-echo ### class_path: %class_path%\r
-\r
-%JAVA% -classpath %class_path% %jvm_opts% org.onap.holmes.rulemgt.RuleActiveApp server %main_path%conf/rulemgt.yml\r
-\r
-IF ERRORLEVEL 1 goto showerror\r
-exit\r
-:showerror\r
-echo WARNING: Error occurred during startup or Server abnormally stopped by way of killing the process,Please check!\r
-echo After checking, press any key to close \r
-pause\r
-exit
\ No newline at end of file
index ffbdc7e..5595a33 100644 (file)
@@ -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 (file)
index bfde362..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-@REM\r
-@REM Copyright 2017 ZTE Corporation.\r
-@REM\r
-@REM Licensed under the Apache License, Version 2.0 (the "License");\r
-@REM you may not use this file except in compliance with the License.\r
-@REM You may obtain a copy of the License at\r
-@REM\r
-@REM     http://www.apache.org/licenses/LICENSE-2.0\r
-@REM\r
-@REM Unless required by applicable law or agreed to in writing, software\r
-@REM distributed under the License is distributed on an "AS IS" BASIS,\r
-@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-@REM See the License for the specific language governing permissions and\r
-@REM limitations under the License.\r
-@REM\r
-\r
-@echo off\r
-title stopping engine-d-service\r
-\r
-set HOME=%~dp0\r
-set Main_Class="org.onap.holmes.rulemgt.RuleActiveApp"\r
-\r
-echo ================== engine-d-service info =============================================\r
-echo HOME=$HOME\r
-echo Main_Class=%Main_Class%\r
-echo ===============================================================================\r
-\r
-echo ### Stopping engine-d-service\r
-cd /d %HOME%\r
-\r
-for /f "delims=" %%i in ('"%JAVA_HOME%\bin\jcmd"') do (\r
-  call find_kill_process "%%i" %Main_Class%\r
-)\r
-exit
\ No newline at end of file
index e0c4ff3..6c49c87 100644 (file)
@@ -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;
 
index c89c0bd..dafb571 100644 (file)
@@ -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;
             }
         }