From 4addb943339297040b963f45176eae719b650bb8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B5=B5=E5=95=B8=E9=9D=9E?= <8153694@qq.com>
Date: Wed, 20 Sep 2023 11:43:57 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0apipost=E7=94=9F=E6=88=90?=
 =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 appbuild-manager/pom.xml                      | 266 ++++++++++++++----
 appbuild-manager/src/main/bin/deploy.sh       | 111 ++++++++
 appbuild-manager/src/main/bin/shutdown.sh     |  42 +--
 appbuild-manager/src/main/bin/start.sh        |  39 +--
 appbuild-manager/src/main/bin/stop.sh         |  52 ++++
 .../src/main/resources/logback-spring.xml     |  48 +++-
 assembly/assembly-manager-ui.xml              |  22 ++
 assembly/assembly.xml                         |  36 +++
 8 files changed, 497 insertions(+), 119 deletions(-)
 create mode 100644 appbuild-manager/src/main/bin/deploy.sh
 create mode 100644 appbuild-manager/src/main/bin/stop.sh
 create mode 100644 assembly/assembly-manager-ui.xml
 create mode 100644 assembly/assembly.xml

diff --git a/appbuild-manager/pom.xml b/appbuild-manager/pom.xml
index 12f3e4a..cf64033 100644
--- a/appbuild-manager/pom.xml
+++ b/appbuild-manager/pom.xml
@@ -126,58 +126,12 @@
 
 	</dependencies>
 
-
 	<build>
-		<resources>
-			<resource>
-				<directory>src/main/java</directory>
-				<includes>
-					<include>**/*.xml</include>
-					<include>**/*.properties</include>
-				</includes>
-			</resource>
-			<resource>
-				<directory>src/main/resources</directory>
-				<filtering>true</filtering>
-				<includes>
-					<include>**/*.xml</include>
-					<include>**/*.properties</include>
-					<include>**/*.json</include>
-					<include>**/*.yml</include>
-					<include>**/*.js</include>
-					<include>**/*.html</include>
-					<include>**/*.css</include>
-					<include>**/*.svg</include>
-					<include>**/*.jpg</include>
-					<include>**/*.jpeg</include>
-					<include>**/*.png</include>
-					<include>**/*.ico</include>
-					<include>**/*.woff2</include>
-					<include>**/*.txt</include>
-					<include>**/*.xlsx</include>
-					<include>**/*.xls</include>
-				</includes>
-				<excludes>
-					<exclude>env/*.properties</exclude>
-				</excludes>
-			</resource>
-			<resource>
-				<directory>src/main/resources</directory>
-				<filtering>false</filtering>
-				<includes>
-					<include>**/*.docx</include>
-					<include>**/*.ftl</include>
-				</includes>
-			</resource>
-
-		</resources>
-
 		<plugins>
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-jar-plugin</artifactId>
 			</plugin>
-
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-surefire-plugin</artifactId>
@@ -189,12 +143,6 @@
 			<plugin>
 				<groupId>org.springframework.boot</groupId>
 				<artifactId>spring-boot-maven-plugin</artifactId>
-				<configuration>
-					<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
-					<outputDirectory>${project.parent.basedir}/dist/${project.parent.artifactId}/boot</outputDirectory>
-					<layout>ZIP</layout>
-					<!-- 鎵撳寘鏃讹紝鏈琷ar鍖呬笉鍖呭惈鍏朵粬渚濊禆鍖� 锛� 鍚﹀垯鎵撳嚭鐨刯ar鍖呰繕鏄緢澶� -->
-				</configuration>
 			</plugin>
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
@@ -206,6 +154,7 @@
 				</configuration>
 			</plugin>
 
+
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-resources-plugin</artifactId>
@@ -218,10 +167,36 @@
 						</goals>
 						<configuration>
 							<encoding>UTF-8</encoding>
-							<outputDirectory>${project.parent.basedir}/dist/${project.parent.artifactId}/bin</outputDirectory>
+							<outputDirectory>target/bin
+							</outputDirectory>
 							<resources>
 								<resource>
 									<directory>src/main/bin/</directory>
+									<excludes>
+										<exclude>deploy.sh</exclude>
+									</excludes>
+									<filtering>true</filtering>
+								</resource>
+							</resources>
+						</configuration>
+					</execution>
+
+					<execution>
+						<id>copy-deploy</id>
+						<phase>package</phase>
+						<goals>
+							<goal>copy-resources</goal>
+						</goals>
+						<configuration>
+							<encoding>UTF-8</encoding>
+							<outputDirectory>${project.parent.basedir}/dist/${project.artifactId}/
+							</outputDirectory>
+							<resources>
+								<resource>
+									<directory>src/main/bin</directory>
+									<includes>
+										<include>deploy.sh</include>
+									</includes>
 									<filtering>true</filtering>
 								</resource>
 							</resources>
@@ -229,7 +204,192 @@
 					</execution>
 				</executions>
 			</plugin>
+
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>exec-maven-plugin</artifactId>
+				<version>1.6.0</version>
+				<executions>
+					<execution>
+						<id>exec-npm-install</id>
+						<phase>generate-resources</phase>
+						<goals>
+							<goal>exec</goal>
+						</goals>
+						<configuration>
+							<executable>yarn</executable>
+							<arguments>
+								<argument></argument>
+							</arguments>
+							<workingDirectory>${project.parent.basedir}/appbuild-manage-ui/admin</workingDirectory>
+						</configuration>
+					</execution>
+
+					<execution>
+						<id>exec-npm-run-build</id>
+						<phase>generate-resources</phase>
+						<goals>
+							<goal>exec</goal>
+						</goals>
+						<configuration>
+							<executable>yarn</executable>
+							<arguments>
+								<argument>run</argument>
+								<arguments>build</arguments>
+							</arguments>
+							<workingDirectory>${project.parent.basedir}/appbuild-manage-ui/admin</workingDirectory>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+
+			<plugin>
+				<artifactId>maven-assembly-plugin</artifactId>
+				<version>3.3.0</version>
+				<executions>
+					<execution>
+						<id>make-assembly</id>
+						<phase>package</phase>
+						<goals>
+							<goal>single</goal>
+						</goals>
+						<configuration>
+							<finalName>${project.artifactId}</finalName>
+							<appendAssemblyId>false</appendAssemblyId>
+							<descriptors>
+								<descriptor>../assembly/assembly.xml</descriptor>
+							</descriptors>
+							<outputDirectory>${project.parent.basedir}/dist/${project.artifactId}</outputDirectory>
+						</configuration>
+					</execution>
+					<execution>
+						<id>make-assembly-ui</id>
+						<phase>package</phase>
+						<goals>
+							<goal>single</goal>
+						</goals>
+						<configuration>
+							<finalName>${project.artifactId}-ui</finalName>
+							<appendAssemblyId>false</appendAssemblyId>
+							<descriptors>
+								<descriptor>../assembly/assembly-manager-ui.xml</descriptor>
+							</descriptors>
+							<outputDirectory>${project.parent.basedir}/dist/${project.artifactId}</outputDirectory>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
 		</plugins>
 	</build>
 
+
+
+
+
+	<!--
+        <build>
+            <resources>
+                <resource>
+                    <directory>src/main/java</directory>
+                    <includes>
+                        <include>**/*.xml</include>
+                        <include>**/*.properties</include>
+                    </includes>
+                </resource>
+                <resource>
+                    <directory>src/main/resources</directory>
+                    <filtering>true</filtering>
+                    <includes>
+                        <include>**/*.xml</include>
+                        <include>**/*.properties</include>
+                        <include>**/*.json</include>
+                        <include>**/*.yml</include>
+                        <include>**/*.js</include>
+                        <include>**/*.html</include>
+                        <include>**/*.css</include>
+                        <include>**/*.svg</include>
+                        <include>**/*.jpg</include>
+                        <include>**/*.jpeg</include>
+                        <include>**/*.png</include>
+                        <include>**/*.ico</include>
+                        <include>**/*.woff2</include>
+                        <include>**/*.txt</include>
+                        <include>**/*.xlsx</include>
+                        <include>**/*.xls</include>
+                    </includes>
+                    <excludes>
+                        <exclude>env/*.properties</exclude>
+                    </excludes>
+                </resource>
+                <resource>
+                    <directory>src/main/resources</directory>
+                    <filtering>false</filtering>
+                    <includes>
+                        <include>**/*.docx</include>
+                        <include>**/*.ftl</include>
+                    </includes>
+                </resource>
+
+            </resources>
+
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-jar-plugin</artifactId>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <version>2.19.1</version>
+                    <configuration>
+                        <skipTests>true</skipTests>    &lt;!&ndash;榛樿鍏虫帀鍗曞厓娴嬭瘯 &ndash;&gt;
+                    </configuration>
+                </plugin>
+                <plugin>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-maven-plugin</artifactId>
+                    <configuration>
+                        <jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
+                        <outputDirectory>${project.parent.basedir}/dist/${project.parent.artifactId}/boot</outputDirectory>
+                        <layout>ZIP</layout>
+                        &lt;!&ndash; 鎵撳寘鏃讹紝鏈琷ar鍖呬笉鍖呭惈鍏朵粬渚濊禆鍖� 锛� 鍚﹀垯鎵撳嚭鐨刯ar鍖呰繕鏄緢澶� &ndash;&gt;
+                    </configuration>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <configuration>
+                        <source>${java.version}</source>
+                        <target>${java.version}</target>
+                        <encoding>${project.build.sourceEncoding}</encoding>
+                    </configuration>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-resources-plugin</artifactId>
+                    <executions>
+                        <execution>
+                            <id>copy-bin</id>
+                            <phase>package</phase>
+                            <goals>
+                                <goal>copy-resources</goal>
+                            </goals>
+                            <configuration>
+                                <encoding>UTF-8</encoding>
+                                <outputDirectory>${project.parent.basedir}/dist/${project.parent.artifactId}/bin</outputDirectory>
+                                <resources>
+                                    <resource>
+                                        <directory>src/main/bin/</directory>
+                                        <filtering>true</filtering>
+                                    </resource>
+                                </resources>
+                            </configuration>
+                        </execution>
+                    </executions>
+                </plugin>
+            </plugins>
+        </build>-->
+
 </project>
diff --git a/appbuild-manager/src/main/bin/deploy.sh b/appbuild-manager/src/main/bin/deploy.sh
new file mode 100644
index 0000000..b01ec39
--- /dev/null
+++ b/appbuild-manager/src/main/bin/deploy.sh
@@ -0,0 +1,111 @@
+#!/bin/sh
+RETVAL=$?
+SHELL_NAME="deploy"
+BASEDIR=$(dirname $0)
+BASEDIR=$( (
+  cd "$BASEDIR"
+  pwd
+))
+LOCK_FILE="/tmp/deploy.lock"
+# 鏃堕棿鍙橀噺
+CDATE=$(date "+%Y-%m-%d")
+CTIME=$(date "+%H:%M:%S")
+SHELL_LOG="${BASEDIR}/${SHELL_NAME}.log"
+
+JAVA_HOME="/usr/local/java/jdk1.8"
+SERVICE_PATH="/usr/lib/systemd/system"
+PUBLISH_PATH="@profiles.publish.path@"
+PROJECT_NAME="@project.artifactId@"
+
+PROJECT_EXECPATH="${PUBLISH_PATH}/${PROJECT_NAME}"
+PROJECT_UI_EXECPATH="${PUBLISH_PATH}/${PROJECT_NAME}-ui/dist"
+PROJECT_FILENAME="${PROJECT_NAME}.tar.gz"
+PROJECT_UI_FILENAME="${PROJECT_NAME}-ui.tar.gz"
+PROJECT_SERVICE="${SERVICE_PATH}/${PROJECT_NAME}.service"
+
+#鍐欐棩蹇�
+writelog() {
+  LOGINFO=$1
+  echo "${CDATE} ${CTIME}: ${SHELL_NAME} : ${LOGINFO}" >>${SHELL_LOG}
+  echo ${LOGINFO}
+}
+
+#娓呯悊鐩爣
+clear_deploy() {
+  SERVICE=$1
+  EXECPATH=$2
+  #娓呯悊鍚庡彴鑷惎鏈嶅姟
+  rm -rf ${SERVICE}
+  #娓呯悊鎵ц鏂囦欢鐩綍
+  rm -rf ${EXECPATH}
+}
+
+#娓呯悊ui
+clear_ui_deploy() {
+  EXEC_UI_PATH=$1
+  rm -rf ${EXEC_UI_PATH}
+  mkdir -p ${EXEC_UI_PATH}
+}
+
+build_service() {
+  SERVICE=$1
+  EXECPATH=$2
+  echo "" >${SERVICE}
+  echo "[Unit]" >>${SERVICE}
+  echo "Description=${PROJECT_NAME}" >>${SERVICE}
+  echo "After=network.target" >>${SERVICE}
+  echo "" >>${SERVICE}
+  echo "[Service]" >>${SERVICE}
+  echo "Environment=\"JAVA_HOME=$JAVA_HOME\"" >>${SERVICE}
+  echo "Type=forking" >>${SERVICE}
+  echo "ExecStart=${EXECPATH}/bin/start.sh" >>${SERVICE}
+  echo "ExecStop=${EXECPATH}/bin/shutdown.sh" >>${SERVICE}
+  echo "PrivateTmp=true" >>${SERVICE}
+  echo "" >>${SERVICE}
+  echo "[Install]" >>${SERVICE}
+  echo "WantedBy=multi-user.target" >>${SERVICE}
+  writelog "${PROJECT_NAME}鏈嶅姟鍒涘缓瀹屾垚!"
+
+}
+
+#鍚姩鏈嶅姟涓巒ginx
+start_service() {
+  systemctl enable ${PROJECT_NAME}
+  systemctl daemon-reload
+  writelog "${PROJECT_NAME}鏈嶅姟鍚姩..."
+  systemctl stop ${PROJECT_NAME} && systemctl start ${PROJECT_NAME}
+  project_status=$(systemctl status "${PROJECT_NAME}"|grep Active |awk '{print $2}')
+  jcpid=$(ps -ef | grep -v "grep" | grep "${PROJECT_NAME} " | awk '{print $2}')
+  writelog "${PROJECT_NAME}鏈嶅姟鍚姩,PID is ${jcpid} ,status:${project_status}"
+}
+#閮ㄧ讲鍚庡彴鏈嶅姟
+project_deploy() {
+  writelog "${PROJECT_NAME}_deploy"
+  systemctl stop ${PROJECT_NAME}
+  clear_deploy ${PROJECT_SERVICE} ${PROJECT_EXECPATH}
+  writelog "${PROJECT_NAME}_clear_finish"
+  tar -zvxf ./${PROJECT_FILENAME} -C ${PUBLISH_PATH}
+  build_service ${PROJECT_SERVICE} ${PROJECT_EXECPATH}
+  start_service
+  writelog "${PROJECT_NAME}_deploy_finish"
+}
+
+#閮ㄧ讲鍓嶅彴鏈嶅姟
+project_ui_deploy() {
+  writelog "${PROJECT_NAME}_ui_deploy"
+  clear_ui_deploy ${PROJECT_UI_EXECPATH}
+  tar -zvxf ./${PROJECT_UI_FILENAME} -C ${PUBLISH_PATH}
+  writelog "${PROJECT_NAME}_ui_deploy_finish"
+
+}
+
+#涓诲嚱鏁�
+main() {
+  echo "鍚庡彴鏈嶅姟閮ㄧ讲"
+  project_deploy
+  echo "鍓嶇鏈嶅姟閮ㄧ讲"
+  project_ui_deploy
+  exit ${RETVAL}
+}
+
+main $1
diff --git a/appbuild-manager/src/main/bin/shutdown.sh b/appbuild-manager/src/main/bin/shutdown.sh
index 71a5a2a..4991607 100644
--- a/appbuild-manager/src/main/bin/shutdown.sh
+++ b/appbuild-manager/src/main/bin/shutdown.sh
@@ -1,38 +1,26 @@
 #! /bin/sh
 PORT="@profiles.server.port@"
-BASEDIR=`dirname $0`
-BASEDIR=`(cd "$BASEDIR"; pwd)`
+BASEDIR=$(dirname $0)
+BASEDIR=$( (
+  cd "$BASEDIR"
+  pwd
+))
 PROJECT_NAME="@project.artifactId@"
-MAIN_CLASS="$PROJECT_NAME";
-SHELL_NAME="shutdown"
-SHELL_LOG="${BASEDIR}/${SHELL_NAME}.log"
-CDATE=$(date "+%Y-%m-%d")
-CTIME=$(date "+%H:%M:%S")
+MAIN_CLASS="$PROJECT_NAME"
 
-#鍐欐棩蹇�
-writelog() {
-  LOGINFO=$1
-  echo "${CDATE} ${CTIME}: ${SHELL_NAME} : ${LOGINFO}" >>${SHELL_LOG}
-  echo ${LOGINFO}
-}
-
-if [ ! -n "$PORT" ]; then  
-	writelog $"Usage: $0 {port}"
-	exit 9
+if [ ! -n "$PORT" ]; then
+  echo $"Usage: $0 {port}"
+  exit $FAIL
 fi
 
-
-pid=`ps ax | grep -i "$MAIN_CLASS"  | grep java | grep -v grep | awk '{print $1}'`
-if [ -z "$pid" ] ; then
-        writelog "No Server running."
-        exit 0;
+pid=$(ps ax | grep -i "$MAIN_CLASS" | grep java | grep -v grep | awk '{print $1}')
+if [ -z "$pid" ]; then
+  echo "No Server running."
+  exit 1
 fi
 
-writelog "stoping application $PROJECT_NAME......"
+echo "stoping application $PROJECT_NAME......"
 
 kill -15 ${pid}
 
-writelog "Send shutdown request to Server $PROJECT_NAME OK"
-exit 0;
-
-
+echo "Send shutdown request to Server $PROJECT_NAME OK"
diff --git a/appbuild-manager/src/main/bin/start.sh b/appbuild-manager/src/main/bin/start.sh
index 0fb584c..08f48de 100644
--- a/appbuild-manager/src/main/bin/start.sh
+++ b/appbuild-manager/src/main/bin/start.sh
@@ -2,9 +2,6 @@
 PORT="@profiles.server.port@"
 BASEDIR=`dirname $0`/..
 BASEDIR=`(cd "$BASEDIR"; pwd)`
-SHELL_NAME="start"
-CDATE=$(date "+%Y-%m-%d")
-CTIME=$(date "+%H:%M:%S")
 PROJECT_NAME="@project.artifactId@";
 MAIN_CLASS="$PROJECT_NAME-@project.version@.jar";
 LOG_PATH="@profiles.log.path@/$PROJECT_NAME"
@@ -12,20 +9,10 @@ GC_PATH=$LOG_PATH/PROJECT_NAME"-gc.log"
 HS_ERR_PATH=$LOG_PATH/PROJECT_NAME"-hs_err.log"
 HEAP_DUMP_PATH=$LOG_PATH/PROJECT_NAME"-heap_dump.hprof"
 TEMP_PATH=$LOG_PATH/temp/
-SHELL_LOG="${BASEDIR}/${SHELL_NAME}.log"
 SUCCESS=0
 FAIL=9
-
-#鍐欐棩蹇�
-writelog() {
-  LOGINFO=$1
-  echo "${CDATE} ${CTIME}: ${SHELL_NAME} : ${LOGINFO}" >>${SHELL_LOG}
-  echo ${LOGINFO}
-}
-
-
 if [ ! -n "$PORT" ]; then  
-	writelog $"Usage: $0 {port}"
+	echo $"Usage: $0 {port}"
 	exit $FAIL
 fi
 if [ ! -d $LOG_PATH ]; 
@@ -36,31 +23,28 @@ if [ ! -d $TEMP_PATH ];
 then     
     mkdir -p $TEMP_PATH; 
 fi
-#-z STRING  濡傛灉STRING鐨勯暱搴︿负闆跺垯涓虹湡 锛屽嵆鍒ゆ柇鏄惁涓虹┖锛岀┖鍗虫槸鐪燂紱
 if [ -z "$JAVACMD" ] ; then
-  #-n STRING  濡傛灉STRING鐨勯暱搴﹂潪闆跺垯涓虹湡 锛屽嵆鍒ゆ柇鏄惁涓洪潪绌猴紝闈炵┖鍗虫槸鐪燂紱
   if [ -n "$JAVA_HOME" ] ; then
-    #-x FILE  濡傛灉 FILE 瀛樺湪涓旀槸鍙墽琛岀殑鍒欎负鐪熴€�
     if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+      # IBM's JDK on AIX uses strange locations for the executables
       JAVACMD="$JAVA_HOME/jre/sh/java"
     else
       JAVACMD="$JAVA_HOME/bin/java"
     fi
   else
     JAVACMD=`which java`
-	   writelog  "Error: JAVA_HOME is not defined correctly.$JAVACMD"
-    #exit $ERR_NO_JAVA
+	echo  "Error: JAVA_HOME is $JAVACMD"
   fi
 fi
-#-x FILE  濡傛灉 FILE 瀛樺湪涓旀槸鍙墽琛岀殑鍒欎负鐪熴€�
+
 if [ ! -x "$JAVACMD" ] ; then
-  writelog "We cannot execute $JAVACMD"
+  echo "We cannot execute $JAVACMD"
   exit $ERR_NO_JAVA
 fi
 
 if [ -e "$BASEDIR" ]
 then
-  JAVA_OPTS="-Xms1024M -Xmx2048M -Xss256K -XX:+UseAdaptiveSizePolicy -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:GCTimeRatio=39 -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$GC_PATH -XX:+HeapDumpOnOutOfMemoryError -XX:ErrorFile=$HS_ERR_PATH -XX:HeapDumpPath=$HEAP_DUMP_PATH"
+  JAVA_OPTS="-Xms512M -Xmx1024M -Xss256K -XX:+UseAdaptiveSizePolicy -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:GCTimeRatio=39 -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$GC_PATH -XX:+HeapDumpOnOutOfMemoryError -XX:ErrorFile=$HS_ERR_PATH -XX:HeapDumpPath=$HEAP_DUMP_PATH"
 fi
 
 CLASSPATH=$CLASSPATH_PREFIX:
@@ -68,14 +52,15 @@ EXTRA_JVM_ARGUMENTS=""
 
 cd "$BASEDIR/boot";
 
-writelog "starting application $PROJECT_NAME......"
+echo "starting application $PROJECT_NAME......"
 exec "$JAVACMD" $JAVA_OPTS \
 				$EXTRA_JVM_ARGUMENTS \
 				-Dapp.name="$PROJECT_NAME" \
 				-Dapp.port="$PORT" \
 				-Dbasedir="$BASEDIR" \
 				-Djava.io.tmpdir=$TEMP_PATH \
-				-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=6913 \
+				-Dloader.path="file://$BASEDIR/conf,file://$BASEDIR/lib" \
+				-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=41086 \
 				-jar $MAIN_CLASS \
 				> /dev/null &
 				
@@ -83,11 +68,11 @@ for i in {1..60}
 do
 	jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
 	if [ $jcpid ]; then
-		writelog "The $PROJECT_NAME start finished, PID is $jcpid"
+		echo "The $PROJECT_NAME start finished, PID is $jcpid"
 		exit $SUCCESS
 	else
-		writelog "starting the application .. $i"
+		echo "starting the application .. $i"
 		sleep 1
 	fi
 done
-writelog "$PROJECT_NAME start failure!"
+echo "$PROJECT_NAME start failure!"
diff --git a/appbuild-manager/src/main/bin/stop.sh b/appbuild-manager/src/main/bin/stop.sh
new file mode 100644
index 0000000..c8dcfd1
--- /dev/null
+++ b/appbuild-manager/src/main/bin/stop.sh
@@ -0,0 +1,52 @@
+#! /bin/sh
+PORT="@profiles.server.port@"
+BASEDIR=`dirname $0`
+BASEDIR=`(cd "$BASEDIR"; pwd)`
+PROJECT_NAME="@project.artifactId@"
+MAIN_CLASS="$PROJECT_NAME";
+
+if [ ! -n "$PORT" ]; then  
+	echo $"Usage: $0 {port}"
+	exit $FAIL
+fi
+
+echo "stoping application $PROJECT_NAME......"
+
+jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
+
+if [ -z $jcpid ]; then
+    echo "$PROJECT_NAME is not started or has been stopped!"
+else
+	curl -X POST -i -u $SECURITY_USERNAME:$SECURITY_PASSWORD http://127.0.0.1:$PORT/xxx_manager/shutdown
+	for i in {1..60}
+	do
+		jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
+		if [ -z $jcpid ]; then
+	    	echo "$PROJECT_NAME has been stopped!"
+	    	break
+	    else
+	    	echo "stoping the application .. $i"
+	    	sleep 1
+	    fi
+    done
+    jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
+    if [ $jcpid ]; then
+	    [ -z $jcpid ] || kill -15 $jcpid
+		    for i in {1..30}
+			do
+				jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
+				if [ -z $jcpid ]; then
+			    	echo "$PROJECT_NAME has been stopped!"
+			    	break
+			    else
+			    	echo "stoping the application .. $i"
+			    	sleep 1
+			    fi
+		    done
+	fi
+    jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
+    if [ $jcpid ]; then
+	    [ -z $jcpid ] || kill -9 $jcpid
+	    [ $? -eq 0 ] && echo "Stop $PROJECT_NAME OK!" || echo "Stop $PROJECT_NAME Fail!"
+	fi
+fi
diff --git a/appbuild-manager/src/main/resources/logback-spring.xml b/appbuild-manager/src/main/resources/logback-spring.xml
index 94b0c37..75d1e73 100644
--- a/appbuild-manager/src/main/resources/logback-spring.xml
+++ b/appbuild-manager/src/main/resources/logback-spring.xml
@@ -1,49 +1,73 @@
 <?xml version="1.0" encoding="utf-8"?>
 <configuration scan="true" scanPeriod="60 seconds" debug="false">
+    <!-- 瀹氫箟鍙橀噺鍚庯紝鍙互浣库€�${}鈥濇潵浣跨敤鍙橀噺 source鏉ユ簮涓簊pring 涓婁笅鏂囦俊鎭� -->
     <springProperty scope="context" name="springApplicationName" source="spring.application.name"/>
     <springProperty scope="context" name="serverPort" source="server.port"/>
     <springProperty scope="context" name="logFilePath" source="application.log.path" defaultValue="/mortals/app/logs" />
     <springProperty scope="context" name="logLevel" source="application.log.level" defaultValue="INFO" />
-    <property name="logFilePath" value="${logFilePath:-/mortals/app/logs}" />
-    <property name="logLevel" value="${logLevel:-INFO}" />
 
+    <!-- appender鐢ㄦ潵鏍煎紡鍖栨棩蹇楄緭鍑鸿妭鐐癸紝鏈変咯涓睘鎬ame鍜宑lass锛宑lass鐢ㄦ潵鎸囧畾鍝杈撳嚭绛栫暐锛屽父鐢ㄥ氨鏄帶鍒跺彴杈撳嚭绛栫暐鍜屾枃浠惰緭鍑虹瓥鐣� -->
+    <!-- 鎺у埗鍙拌緭鍑虹瓥鐣�-->
     <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
         <encoder>
-            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%thread] [%.50c\(%L\)] - %msg%n</pattern>
+            <!--鏍煎紡鍖栬緭鍑猴細%d琛ㄧず鏃ユ湡锛�%thread琛ㄧず绾跨▼鍚嶏紝%-5level锛氱骇鍒粠宸︽樉绀�5涓瓧绗﹀搴�%msg锛氭棩蹇楁秷鎭紝%n鏄崲琛岀-->
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern>
         </encoder>
     </appender>
+    <!-- 鏂囦欢杈撳嚭绛栫暐-->
     <appender name="fileInfo" class="ch.qos.logback.core.rolling.RollingFileAppender">
         <encoder>
-            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%thread] [%.50c\(%L\)] - %msg%n</pattern>
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern>
         </encoder>
-        <file>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-info.log</file>
+        <file>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <fileNamePattern>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-info.log.%d{yyyyMMdd}</fileNamePattern>
+            <!-- 鏂囦欢淇濆瓨绛栫暐-->
+            <fileNamePattern>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-info.log.%d{yyyyMMdd}</fileNamePattern>
+            <cleanHistoryOnStart>true</cleanHistoryOnStart>
+            <!--鏃ュ織鏂囦欢淇濈暀澶╂暟-->
+            <MaxHistory>15</MaxHistory>
         </rollingPolicy>
     </appender>
+    <!-- 寮傚父鏂囦欢杈撳嚭绛栫暐-->
     <appender name="fileError" class="ch.qos.logback.core.rolling.RollingFileAppender">
         <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
             <level>ERROR</level>
         </filter>
         <encoder>
-            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%thread] [%.50c\(%L\)] - %msg%n</pattern>
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern>
         </encoder>
-        <file>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-error.log</file>
+        <file>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-error.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <fileNamePattern>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-error.log.%d{yyyyMMdd}</fileNamePattern>
+            <fileNamePattern>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-error.log.%d{yyyyMMdd}</fileNamePattern>
+            <!--鏃ュ織鏂囦欢淇濈暀澶╂暟-->
+            <cleanHistoryOnStart>true</cleanHistoryOnStart>
+            <MaxHistory>15</MaxHistory>
         </rollingPolicy>
     </appender>
 
-    <logger name="com.mortals.xhx.module" level="DEBUG" additivity="false"/>
-
     <root level="${logLevel}">
         <appender-ref ref="console"/>
         <appender-ref ref="fileInfo"/>
         <appender-ref ref="fileError"/>
     </root>
-    <logger name="com.mortals.xhx.module" level="INFO" additivity="false">
+
+    <!--TRACE < DEBUG < INFO < WARN < ERROR < FATAL -->
+
+    <!--鐢ㄦ潵璁剧疆鏌愪竴涓寘鎴栬€呭叿浣撶殑鏌愪竴涓被鐨勬棩蹇楁墦鍗扮骇鍒€佷互鍙婃寚瀹�<appender>銆�<logger>浠呮湁涓€涓猲ame灞炴€э紝涓€涓彲閫夌殑level鍜屼竴涓彲閫夌殑additivity灞炴€с€�-->
+    <!-- name 鐢ㄦ潵鎸囧畾鍙楁loger绾︽潫鐨勬煇涓€涓寘鎴栬€呭叿浣撶殑鏌愪竴涓被-->
+    <!-- level 鐢ㄦ潵璁剧疆鎵撳嵃绾у埆锛屽ぇ灏忓啓鏃犲叧锛歍RACE, DEBUG, INFO, WARN, ERROR, ALL 鍜� OFF锛岃繕鏈変竴涓壒淇楀€糏NHERITED鎴栬€呭悓涔夎瘝NULL锛屼唬琛ㄥ己鍒舵墽琛屼笂绾х殑绾у埆銆傚鏋滄湭璁剧疆姝ゅ睘鎬э紝閭d箞褰撳墠logger灏嗕細缁ф壙涓婄骇鐨勭骇鍒�-->
+    <!-- additivity 鏄惁鍚戜笂绾ogger浼犻€掓墦鍗颁俊鎭€傞粯璁ゆ槸true銆俧alse锛氳〃绀哄彧鐢ㄥ綋鍓峫ogger鐨刟ppender-ref銆倀rue锛氳〃绀哄綋鍓峫ogger鐨刟ppender-ref鍜宺ootLogger鐨刟ppender-ref閮芥湁鏁堛€�-->
+
+    <logger name="com.mortals" level="${logLevel}" additivity="false">
+        <appender-ref ref="console"/>
+        <appender-ref ref="fileInfo"/>
+        <appender-ref ref="fileError"/>
+    </logger>
+
+    <logger name="com.mortals.xhx.module" level="${logLevel}" additivity="false">
         <appender-ref ref="console"/>
         <appender-ref ref="fileInfo"/>
         <appender-ref ref="fileError"/>
     </logger>
+
 </configuration>
\ No newline at end of file
diff --git a/assembly/assembly-manager-ui.xml b/assembly/assembly-manager-ui.xml
new file mode 100644
index 0000000..ffc943e
--- /dev/null
+++ b/assembly/assembly-manager-ui.xml
@@ -0,0 +1,22 @@
+<assembly
+        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+    <id>release</id>
+    <formats>
+        <format>tar.gz</format>
+    </formats>
+
+    <!-- 闇€瑕佹墦鍖呯殑鏂囦欢闆� -->
+    <fileSets>
+        <fileSet>
+            <directory>${project.parent.basedir}/appbuild-manage-ui/admin/dist</directory>
+            <includes>
+                <include>**/*</include>
+            </includes>
+            <outputDirectory>/dist</outputDirectory>
+        </fileSet>
+    </fileSets>
+
+
+</assembly>
\ No newline at end of file
diff --git a/assembly/assembly.xml b/assembly/assembly.xml
new file mode 100644
index 0000000..c3feffc
--- /dev/null
+++ b/assembly/assembly.xml
@@ -0,0 +1,36 @@
+<assembly
+        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+    <id>release</id>
+    <formats>
+        <format>tar.gz</format>
+    </formats>
+
+    <fileSets>
+        <fileSet>
+            <directory>target/bin</directory>
+            <outputDirectory>bin</outputDirectory>
+            <fileMode>0755</fileMode>
+        </fileSet>
+        <fileSet>
+            <directory>${project.parent.basedir}/dist/${project.parent.artifactId}/boot</directory>
+            <outputDirectory>boot</outputDirectory>
+            <fileMode>0755</fileMode>
+        </fileSet>
+        <fileSet>
+            <directory>./db</directory>
+            <includes>
+                <include>*.sql</include>
+            </includes>
+            <outputDirectory>db</outputDirectory>
+            <fileMode>0755</fileMode>
+        </fileSet>
+    </fileSets>
+    <files>
+        <file>
+            <source>target/${project.artifactId}-${project.version}.jar</source>
+            <outputDirectory>boot</outputDirectory>
+        </file>
+    </files>
+</assembly>
\ No newline at end of file
-- 
2.24.3