From f2ee4680d4704e4630b32e5e3d496c2df409c62e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=AE=B8=E6=99=93=E4=B8=9C?= <763795151@qq.com>
Date: Fri, 3 Sep 2021 14:39:12 +0800
Subject: [PATCH] package config
---
assembly.xml | 37 ++++++++++++++++++
bin/shutdown.sh | 8 ++++
bin/start.sh | 20 ++++++++++
package.sh | 2 +-
pom.xml | 39 +++++++++++++++----
src/main/resources/application.yml | 10 ++++-
src/main/resources/logback-test.xml | 56 +++++++++++++++++++++++-----
ui/.env | 3 ++
ui/.env.development | 3 ++
ui/src/utils/request.js | 2 +-
ui/src/views/acl/Acl.vue | 4 --
ui/src/views/utils/ConfirmDialog.vue | 36 ------------------
ui/vue.config.js | 6 +--
13 files changed, 164 insertions(+), 62 deletions(-)
create mode 100644 assembly.xml
create mode 100644 bin/shutdown.sh
create mode 100644 bin/start.sh
create mode 100644 ui/.env
create mode 100644 ui/.env.development
delete mode 100644 ui/src/views/utils/ConfirmDialog.vue
diff --git a/assembly.xml b/assembly.xml
new file mode 100644
index 0000000..6363171
--- /dev/null
+++ b/assembly.xml
@@ -0,0 +1,37 @@
+
+ rocketmq-reput
+
+ tar.gz
+
+
+
+
+ ${project.basedir}/src/main/resources
+ config
+
+ *.yml
+
+
+
+
+ ${project.basedir}/bin
+ unix
+
+ *.sh
+
+ bin
+ 0755
+
+
+
+ ${project.basedir}/target
+ lib
+
+ *.jar
+
+
+
+
diff --git a/bin/shutdown.sh b/bin/shutdown.sh
new file mode 100644
index 0000000..8d15dd6
--- /dev/null
+++ b/bin/shutdown.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+SCRIPT_DIR=`dirname $0`
+PROJECT_DIR="$SCRIPT_DIR/.."
+# 不要修改进程标记,作为进程属性关闭使用
+PROCESS_FLAG="kafka-console-ui-process-flag:${PROJECT_DIR}"
+pkill -f $PROCESS_FLAG
+echo 'Stop Kafka-console-ui!'
\ No newline at end of file
diff --git a/bin/start.sh b/bin/start.sh
new file mode 100644
index 0000000..9af3864
--- /dev/null
+++ b/bin/start.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# 设置jvm堆大小及栈大小,栈大小最少设置为256K,不要小于这个值,比如设置为128,太小了
+JAVA_MEM_OPTS="-Xmx512m -Xms512m -Xmn256m -Xss256k"
+
+SCRIPT_DIR=`dirname $0`
+PROJECT_DIR="$SCRIPT_DIR/.."
+CONF_FILE="$PROJECT_DIR/config/application.yml"
+TARGET="$PROJECT_DIR/lib/kafka-console-ui.jar"
+# 日志目录,默认为当前工程目录下
+# 这个是错误输出,如果启动命令有误,输出到这个文件,应用日志不会输出到error.out,应用日志输出到上面的rocketmq-reput.log中
+ERROR_OUT="$PROJECT_DIR/error.out"
+# 不要修改进程标记,作为进程属性关闭使用,如果要修改,请把stop.sh里的该属性的值保持一致
+PROCESS_FLAG="kafka-console-ui-process-flag:${PROJECT_DIR}"
+
+JAVA_OPTS="$JAVA_OPTS $JAVA_MEM_OPTS"
+
+nohup java -jar $JAVA_OPTS $TARGET --spring.config.location="$CONF_FILE" --logging.home="$PROJECT_DIR" $PROCESS_FLAG 1>/dev/null 2>$ERROR_OUT &
+
+echo "Kafka-console-ui Started!"
\ No newline at end of file
diff --git a/package.sh b/package.sh
index 8d0a950..e72fe00 100644
--- a/package.sh
+++ b/package.sh
@@ -1,3 +1,3 @@
#!/bin/bash
-mvn clean scala:compile compile package -Dmaven.test.skip=true
\ No newline at end of file
+mvn clean scala:compile compile package -Dmaven.test.skip=true -Pdeploy
diff --git a/pom.xml b/pom.xml
index 68114d6..9c968d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,6 +22,7 @@
1.11.0
1.8
2.8.0
+ 3.0.0
@@ -162,16 +163,16 @@
${frontend-maven-plugin.version}
${ui.path}
- v8.17.0
+ v14.16.0
http://npm.taobao.org/mirrors/node/
-
-
-
-
-
-
+
+ install node and npm
+
+ install-node-and-npm
+
+
npm install
@@ -210,6 +211,30 @@
+
+ maven-assembly-plugin
+ ${maven.assembly.plugin.version}
+
+
+ kafka-console-ui
+ package
+
+ single
+
+
+
+ ${project.basedir}/assembly.xml
+
+
+
+
+
+ true
+ posix
+ false
+ false
+
+
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index ecf591b..0898d33 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -1,7 +1,8 @@
server:
port: 7766
servlet:
- context-path: /kafka-console
+ # 不要修改context-path
+ context-path: /
kafka:
config:
@@ -16,6 +17,13 @@ kafka:
admin-password: admin
# 启动自动创建配置的超级管理员用户
admin-create: true
+ # broker连接的zk地址
zookeeper-addr: localhost:2181
sasl-jaas-config: org.apache.kafka.common.security.scram.ScramLoginModule required username="${kafka.config.admin-username}" password="${kafka.config.admin-password}";
+spring:
+ application:
+ name: kafka-console-ui
+
+logging:
+ home: ./
\ No newline at end of file
diff --git a/src/main/resources/logback-test.xml b/src/main/resources/logback-test.xml
index adc5289..cf8f74a 100644
--- a/src/main/resources/logback-test.xml
+++ b/src/main/resources/logback-test.xml
@@ -1,24 +1,62 @@
+
+
-
-
- %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n
-
+
+
+
+
+
+
+
+
+
+
+ ${LOG_HOME}/${APP_NAME}.log
+ true
+
+ ${LOG_HOME}/${APP_NAME}.%i.log.gz
+ 1
+ 10
+
+
+
+ 20MB
+
+
+ ${FILE_LOG_PATTERN}
+ UTF-8
+
+
+
+
+
-
-
+
+
+
+
-
+
+
+
+
+
+
+
-
+
+
-
+
+
\ No newline at end of file
diff --git a/ui/.env b/ui/.env
new file mode 100644
index 0000000..31f8c59
--- /dev/null
+++ b/ui/.env
@@ -0,0 +1,3 @@
+NODE_ENV=production
+VUE_APP_PREVIEW=false
+VUE_APP_API_BASE_URL=/
diff --git a/ui/.env.development b/ui/.env.development
new file mode 100644
index 0000000..3aa6746
--- /dev/null
+++ b/ui/.env.development
@@ -0,0 +1,3 @@
+NODE_ENV=development
+VUE_APP_PREVIEW=true
+VUE_APP_API_BASE_URL=/kafka-console
diff --git a/ui/src/utils/request.js b/ui/src/utils/request.js
index 67136df..ec58573 100644
--- a/ui/src/utils/request.js
+++ b/ui/src/utils/request.js
@@ -5,7 +5,7 @@ import { VueAxios } from "./axios";
// 创建 axios 实例
const request = axios.create({
// API 请求的默认前缀
- baseURL: "/kafka-console",
+ baseURL: process.env.VUE_APP_API_BASE_URL,
timeout: 10000, // 请求超时时间
});
diff --git a/ui/src/views/acl/Acl.vue b/ui/src/views/acl/Acl.vue
index 39b3935..c2836cf 100644
--- a/ui/src/views/acl/Acl.vue
+++ b/ui/src/views/acl/Acl.vue
@@ -201,10 +201,6 @@ export default {
Object.assign(rowData, row);
this.selectRow = rowData;
},
- cancel(e) {
- console.log(e);
- this.$message.error("Click on No");
- },
closeManageProducerAuthDialog() {
this.openManageProducerAuthDialog = false;
getAclList(this.data, this.queryParam);
diff --git a/ui/src/views/utils/ConfirmDialog.vue b/ui/src/views/utils/ConfirmDialog.vue
deleted file mode 100644
index 6e2e3f4..0000000
--- a/ui/src/views/utils/ConfirmDialog.vue
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
diff --git a/ui/vue.config.js b/ui/vue.config.js
index 4b5f3d4..e3cc750 100644
--- a/ui/vue.config.js
+++ b/ui/vue.config.js
@@ -5,9 +5,9 @@ module.exports = {
"/kafka-console": {
target: `${process.env.SW_PROXY_TARGET || "http://127.0.0.1:7766"}`,
changeOrigin: true,
- // pathRewrite: {
- // '^/kafka-console': '/'
- // }
+ pathRewrite: {
+ "^/kafka-console": "/",
+ },
},
},
},