From 2205c13ba9ffb346faa55e5fbf06c6018bee0eb3 Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Fri, 15 Mar 2024 00:47:20 +0800 Subject: [PATCH 1/8] add back missing build label --- eventmesh-dashboard-console/pom.xml | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/eventmesh-dashboard-console/pom.xml b/eventmesh-dashboard-console/pom.xml index b071854f..a638c99d 100644 --- a/eventmesh-dashboard-console/pom.xml +++ b/eventmesh-dashboard-console/pom.xml @@ -105,4 +105,35 @@ + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + UTF-8 + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication + + + + repackage + + repackage + + + + + + + \ No newline at end of file From ee278b5b2b9d2b818d751175a1bf7a0c1551869b Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Fri, 15 Mar 2024 00:57:19 +0800 Subject: [PATCH 2/8] Fix module name --- eventmesh-dashboard-service/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eventmesh-dashboard-service/pom.xml b/eventmesh-dashboard-service/pom.xml index ebcd1113..bfc88056 100644 --- a/eventmesh-dashboard-service/pom.xml +++ b/eventmesh-dashboard-service/pom.xml @@ -11,7 +11,7 @@ org.apache.eventmesh.dashboard.service eventmesh-dashboard-service 0.0.1-SNAPSHOT - eventmesh-dashboard-core + eventmesh-dashboard-service 1.8 From 2306fadf7684533d6a4a60d8455f2601191d0adb Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Fri, 15 Mar 2024 01:09:19 +0800 Subject: [PATCH 3/8] add test scope --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 68372bf7..2a97e52a 100644 --- a/pom.xml +++ b/pom.xml @@ -108,6 +108,7 @@ org.mybatis.spring.boot mybatis-spring-boot-starter-test ${mybatis-spring-boot.version} + test From 288f1a146cfb87b0a528fdb23e51b3b261987bc1 Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Fri, 15 Mar 2024 01:11:12 +0800 Subject: [PATCH 4/8] exclude log4j-to-slf4j --- pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pom.xml b/pom.xml index 2a97e52a..e8fbd8e5 100644 --- a/pom.xml +++ b/pom.xml @@ -103,6 +103,12 @@ org.mybatis.spring.boot mybatis-spring-boot-starter ${mybatis-spring-boot.version} + + + org.apache.logging.log4j + log4j-to-slf4j + + org.mybatis.spring.boot From 09004db173424f6641aa52fa95020c394a98b7b9 Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Fri, 15 Mar 2024 01:39:20 +0800 Subject: [PATCH 5/8] exclude log4j-slf4j-impl --- eventmesh-dashboard-console/pom.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eventmesh-dashboard-console/pom.xml b/eventmesh-dashboard-console/pom.xml index a638c99d..737e9b12 100644 --- a/eventmesh-dashboard-console/pom.xml +++ b/eventmesh-dashboard-console/pom.xml @@ -80,6 +80,10 @@ junit junit-dep + + org.apache.logging.log4j + log4j-slf4j-impl + From f8080a5cc121ce9883f79b86e7e1af88a41abd18 Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Fri, 15 Mar 2024 02:00:55 +0800 Subject: [PATCH 6/8] add auto deploy script --- deployment/auto-deploy-eventmesh-dashboard.sh | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 deployment/auto-deploy-eventmesh-dashboard.sh diff --git a/deployment/auto-deploy-eventmesh-dashboard.sh b/deployment/auto-deploy-eventmesh-dashboard.sh new file mode 100644 index 00000000..fd9a2dd8 --- /dev/null +++ b/deployment/auto-deploy-eventmesh-dashboard.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +# Git repository path +REPO_PATH=~/service/eventmesh-dashboard + +# SpringBoot process ID file path +PID_LOG=./eventmesh-dashboard-pid.log + +# Automatic deployment log file path +AUTO_DEPLOY_LOG=./auto-deploy-eventmesh-dashboard.log + +# Jar file path +JAR_FILE_PATH=~/service/eventmesh-dashboard/eventmesh-dashboard-console/target/eventmesh-dashboard-console-0.0.1-SNAPSHOT.jar + +# Check if the pid.log file exists, if not, create an empty file +touch $PID_LOG + +# Update the git repository +cd $REPO_PATH +git fetch origin dev +LOCAL=$(git rev-parse @) +REMOTE=$(git rev-parse origin/dev) + +if [ $LOCAL != $REMOTE ]; then + # If the remote dev branch is newer than the local one, update the local dev branch code + git pull origin dev + + # Log the event + echo "$(date +"%Y-%m-%d %H:%M:%S") - change detected." >> $AUTO_DEPLOY_LOG + + # Terminate the old process + if [ -f $PID_LOG ]; then + PID=$(cat $PID_LOG) + if [ -n "$PID" ]; then + kill $PID + # Log the event + echo "$(date +"%Y-%m-%d %H:%M:%S") - kill running application." >> $AUTO_DEPLOY_LOG + fi + fi + + # Compile and package the Jar file using Maven + mvn clean package + + # Start the springboot application and record the process id to pid.log file, redirect console logs to eventmesh-dashboard-.log file + nohup java -jar $JAR_FILE_PATH > eventmesh-dashboard-$(date +"%Y-%m-%d-%H-%M-%S").log 2>&1 & + echo $! > $PID_LOG + + # Log the event + echo "$(date +"%Y-%m-%d %H:%M:%S") - start new application." >> $AUTO_DEPLOY_LOG +else + # If there are no new changes in the remote dev branch + + # Log the event + echo "$(date +"%Y-%m-%d %H:%M:%S") - no change detected." >> $AUTO_DEPLOY_LOG + + if [ -f $PID_LOG ]; then + # If the pid.log file exists, no action is performed + echo "$(date +"%Y-%m-%d %H:%M:%S") - application running, no operation performed." >> $AUTO_DEPLOY_LOG + else + # If the pid.log file does not exist, start the springboot application and record the process id to pid.log file, redirect console logs to eventmesh-dashboard-.log file + nohup java -jar $JAR_FILE_PATH > eventmesh-dashboard-$(date +"%Y-%m-%d-%H-%M-%S").log 2>&1 & + echo $! > $PID_LOG + + # Log the event + echo "$(date +"%Y-%m-%d %H:%M:%S") - no pid.log file, start application." >> $AUTO_DEPLOY_LOG + fi +fi From 14af6ebbf1d18e50c405d3190dce78759050fb5f Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Fri, 15 Mar 2024 02:06:02 +0800 Subject: [PATCH 7/8] add license --- deployment/auto-deploy-eventmesh-dashboard.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/deployment/auto-deploy-eventmesh-dashboard.sh b/deployment/auto-deploy-eventmesh-dashboard.sh index fd9a2dd8..82a99c3e 100644 --- a/deployment/auto-deploy-eventmesh-dashboard.sh +++ b/deployment/auto-deploy-eventmesh-dashboard.sh @@ -1,4 +1,21 @@ #!/bin/bash +# +# Licensed to Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Apache Software Foundation (ASF) licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. # Git repository path REPO_PATH=~/service/eventmesh-dashboard From bf2e71d76cfab59384ca2736fef9c757752bac88 Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Fri, 15 Mar 2024 18:30:07 +0800 Subject: [PATCH 8/8] refine the script --- deployment/auto-deploy-eventmesh-dashboard.sh | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/deployment/auto-deploy-eventmesh-dashboard.sh b/deployment/auto-deploy-eventmesh-dashboard.sh index 82a99c3e..01aae6c5 100644 --- a/deployment/auto-deploy-eventmesh-dashboard.sh +++ b/deployment/auto-deploy-eventmesh-dashboard.sh @@ -21,17 +21,17 @@ REPO_PATH=~/service/eventmesh-dashboard # SpringBoot process ID file path -PID_LOG=./eventmesh-dashboard-pid.log +PID_LOG=~/service/eventmesh-dashboard/deployment/eventmesh-dashboard-pid.log -# Automatic deployment log file path -AUTO_DEPLOY_LOG=./auto-deploy-eventmesh-dashboard.log +# Automatic deployment shell script log file path +AUTO_DEPLOY_LOG=~/service/eventmesh-dashboard/deployment/auto-deploy-eventmesh-dashboard.log + +# EventMesh Dashboard log file path +APP_LOG=~/service/eventmesh-dashboard/deployment/eventmesh-dashboard-$(date +"%Y-%m-%d-%H-%M-%S").log # Jar file path JAR_FILE_PATH=~/service/eventmesh-dashboard/eventmesh-dashboard-console/target/eventmesh-dashboard-console-0.0.1-SNAPSHOT.jar -# Check if the pid.log file exists, if not, create an empty file -touch $PID_LOG - # Update the git repository cd $REPO_PATH git fetch origin dev @@ -46,7 +46,7 @@ if [ $LOCAL != $REMOTE ]; then echo "$(date +"%Y-%m-%d %H:%M:%S") - change detected." >> $AUTO_DEPLOY_LOG # Terminate the old process - if [ -f $PID_LOG ]; then + if [ -s $PID_LOG ]; then PID=$(cat $PID_LOG) if [ -n "$PID" ]; then kill $PID @@ -55,11 +55,11 @@ if [ $LOCAL != $REMOTE ]; then fi fi - # Compile and package the Jar file using Maven + # Compile and package the Jar file mvn clean package # Start the springboot application and record the process id to pid.log file, redirect console logs to eventmesh-dashboard-.log file - nohup java -jar $JAR_FILE_PATH > eventmesh-dashboard-$(date +"%Y-%m-%d-%H-%M-%S").log 2>&1 & + nohup java -jar $JAR_FILE_PATH > $APP_LOG 2>&1 & echo $! > $PID_LOG # Log the event @@ -70,14 +70,17 @@ else # Log the event echo "$(date +"%Y-%m-%d %H:%M:%S") - no change detected." >> $AUTO_DEPLOY_LOG - if [ -f $PID_LOG ]; then + if [ -s $PID_LOG ]; then # If the pid.log file exists, no action is performed echo "$(date +"%Y-%m-%d %H:%M:%S") - application running, no operation performed." >> $AUTO_DEPLOY_LOG else - # If the pid.log file does not exist, start the springboot application and record the process id to pid.log file, redirect console logs to eventmesh-dashboard-.log file - nohup java -jar $JAR_FILE_PATH > eventmesh-dashboard-$(date +"%Y-%m-%d-%H-%M-%S").log 2>&1 & + # If the pid.log file does not exist, compile and package the Jar file + mvn clean package + + # Start the springboot application and record the process id to pid.log file, redirect console logs to eventmesh-dashboard-.log file + nohup java -jar $JAR_FILE_PATH > $APP_LOG 2>&1 & echo $! > $PID_LOG - + # Log the event echo "$(date +"%Y-%m-%d %H:%M:%S") - no pid.log file, start application." >> $AUTO_DEPLOY_LOG fi