You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by il...@apache.org on 2021/01/18 08:55:26 UTC

[dubbo-admin] branch develop updated: fix #677 dubbo admin 修改打包结构,增加启动脚本 (#678)

This is an automated email from the ASF dual-hosted git repository.

iluo pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-admin.git


The following commit(s) were added to refs/heads/develop by this push:
     new 452caee  fix #677 dubbo admin 修改打包结构,增加启动脚本 (#678)
452caee is described below

commit 452caee2132491adce67029af090f87603e7c649
Author: 邪影oO <21...@qq.com>
AuthorDate: Mon Jan 18 16:55:14 2021 +0800

    fix #677 dubbo admin 修改打包结构,增加启动脚本 (#678)
    
    * fix #677 dubbo admin 修改打包结构,增加启动脚本
    
    * 加回GPG插件
---
 NOTICE                                             |  2 +-
 dubbo-admin-distribution/pom.xml                   |  2 +-
 dubbo-admin-distribution/src/NOTICE                |  4 +-
 .../src/assembly/bin-release.xml                   | 14 ++++--
 .../src/bin/config/application.properties          | 48 ++++++++++++++++++
 dubbo-admin-distribution/src/bin/shutdown.cmd      | 26 ++++++++++
 dubbo-admin-distribution/src/bin/shutdown.sh       | 31 ++++++++++++
 dubbo-admin-distribution/src/bin/startup.cmd       | 31 ++++++++++++
 dubbo-admin-distribution/src/bin/startup.sh        | 57 ++++++++++++++++++++++
 dubbo-admin-server/pom.xml                         | 17 +++++++
 10 files changed, 223 insertions(+), 9 deletions(-)

diff --git a/NOTICE b/NOTICE
index ca90c8b..cf58f0a 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,4 +1,4 @@
-Apache Dubbo Admin (incubating)
+Apache Dubbo Admin
 Copyright 2018-2019 The Apache Software Foundation
 
 This product includes software developed at
diff --git a/dubbo-admin-distribution/pom.xml b/dubbo-admin-distribution/pom.xml
index 9090e11..b1b1eee 100644
--- a/dubbo-admin-distribution/pom.xml
+++ b/dubbo-admin-distribution/pom.xml
@@ -68,7 +68,7 @@
         <profile>
             <id>release</id>
             <build>
-                <finalName>apache-dubbo-admin-incubating-${project.version}</finalName>
+                <finalName>apache-dubbo-admin-${project.version}</finalName>
                 <plugins>
                     <plugin>
                         <artifactId>maven-assembly-plugin</artifactId>
diff --git a/dubbo-admin-distribution/src/NOTICE b/dubbo-admin-distribution/src/NOTICE
index 7b03270..446a88f 100644
--- a/dubbo-admin-distribution/src/NOTICE
+++ b/dubbo-admin-distribution/src/NOTICE
@@ -1,4 +1,4 @@
-Apache Dubbo Admin (incubating)
+Apache Dubbo Admin
 Copyright 2018-2019 The Apache Software Foundation
 
 This product includes software developed at
@@ -99,7 +99,7 @@ The Apache Software Foundation (http://www.apache.org/).
 dubbo NOTICE
 
 ========================================================================
-Apache Dubbo (incubating)
+Apache Dubbo
 Copyright 2018-2019 The Apache Software Foundation
 
 This product includes software developed at
diff --git a/dubbo-admin-distribution/src/assembly/bin-release.xml b/dubbo-admin-distribution/src/assembly/bin-release.xml
index 0fec08a..b194e34 100644
--- a/dubbo-admin-distribution/src/assembly/bin-release.xml
+++ b/dubbo-admin-distribution/src/assembly/bin-release.xml
@@ -18,6 +18,8 @@
           xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
     <id>bin-release</id>
     <formats>
+        <format>dir</format>
+        <format>tar.gz</format>
         <format>zip</format>
     </formats>
     <includeBaseDirectory>true</includeBaseDirectory>
@@ -34,6 +36,11 @@
             <outputDirectory>licenses</outputDirectory>
         </fileSet>
         <fileSet>
+            <directory>src/bin</directory>
+            <outputDirectory>bin</outputDirectory>
+            <fileMode>0755</fileMode>
+        </fileSet>
+        <fileSet>
             <directory>src</directory>
             <includes>
                 <include>LICENSE</include>
@@ -45,11 +52,8 @@
     <files>
         <file>
             <source>target/dubbo-admin-${project.version}.jar</source>
-            <outputDirectory></outputDirectory>
-        </file>
-        <file>
-            <source>../dubbo-admin-server/src/main/resources/application.properties</source>
-            <outputDirectory></outputDirectory>
+            <outputDirectory>lib</outputDirectory>
+            <destName>dubbo-admin.jar</destName>
         </file>
         <file>
             <source>README.md</source>
diff --git a/dubbo-admin-distribution/src/bin/config/application.properties b/dubbo-admin-distribution/src/bin/config/application.properties
new file mode 100644
index 0000000..3f7b612
--- /dev/null
+++ b/dubbo-admin-distribution/src/bin/config/application.properties
@@ -0,0 +1,48 @@
+#
+# Licensed to the 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.
+# The 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.
+#
+server.port=8080
+# centers in dubbo2.7
+admin.registry.address=nacos://127.0.0.1:8848
+admin.config-center=nacos://127.0.0.1:8848
+admin.metadata-report.address=nacos://127.0.0.1:8848
+
+#admin.registry.address=nacos://127.0.0.1:8848
+#admin.config-center=nacos://127.0.0.1:8848
+#admin.metadata-report.address=nacos://127.0.0.1:8848
+
+admin.root.user.name=root
+admin.root.user.password=root
+#group
+admin.registry.group=DEFAULT_GROUP
+admin.config-center.group=DEFAULT_GROUP
+admin.metadata-report.group=DEFAULT_GROUP
+
+#namespace used by nacos
+admin.registry.namespace=public
+admin.config-center.namespace=public
+admin.metadata-report.namespace=public
+
+admin.apollo.token=e16e5cd903fd0c97a116c873b448544b9d086de9
+admin.apollo.appId=test
+admin.apollo.env=dev
+admin.apollo.cluster=default
+admin.apollo.namespace=dubbo
+
+#compress
+server.compression.enabled=true
+server.compression.mime-types=text/css,text/javascript,application/javascript
+server.compression.min-response-size=10240
diff --git a/dubbo-admin-distribution/src/bin/shutdown.cmd b/dubbo-admin-distribution/src/bin/shutdown.cmd
new file mode 100644
index 0000000..f4e0c7b
--- /dev/null
+++ b/dubbo-admin-distribution/src/bin/shutdown.cmd
@@ -0,0 +1,26 @@
+@echo off
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements.  See the NOTICE file distributed with
+rem this work for additional information regarding copyright ownership.
+rem The ASF licenses this file to You under the Apache License, Version 2.0
+rem (the "License"); you may not use this file except in compliance with
+rem the License.  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.
+if not exist "%JAVA_HOME%\bin\jps.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better! & EXIT /B 1
+
+setlocal
+
+set "PATH=%JAVA_HOME%\bin;%PATH%"
+
+echo killing dubbo admin server
+
+for /f "tokens=1" %%i in ('jps -m ^| find "dubbo.admin"') do ( taskkill /F /PID %%i )
+
+echo Done!
diff --git a/dubbo-admin-distribution/src/bin/shutdown.sh b/dubbo-admin-distribution/src/bin/shutdown.sh
new file mode 100644
index 0000000..67059bd
--- /dev/null
+++ b/dubbo-admin-distribution/src/bin/shutdown.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# Licensed to the 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.
+# The 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.
+
+cd `dirname $0`/../lib
+target_dir=`pwd`
+
+pid=`ps ax | grep -i 'dubbo.admin' | grep ${target_dir} | grep java | grep -v grep | awk '{print $1}'`
+if [ -z "$pid" ] ; then
+        echo "No dubbo admin server running."
+        exit -1;
+fi
+
+echo "The dubbo admin server(${pid}) is running..."
+
+kill ${pid}
+
+echo "Send shutdown request to dubbo admin server(${pid}) OK"
diff --git a/dubbo-admin-distribution/src/bin/startup.cmd b/dubbo-admin-distribution/src/bin/startup.cmd
new file mode 100644
index 0000000..67af660
--- /dev/null
+++ b/dubbo-admin-distribution/src/bin/startup.cmd
@@ -0,0 +1,31 @@
+@echo off
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements.  See the NOTICE file distributed with
+rem this work for additional information regarding copyright ownership.
+rem The ASF licenses this file to You under the Apache License, Version 2.0
+rem (the "License"); you may not use this file except in compliance with
+rem the License.  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.
+if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better! & EXIT /B 1
+set "JAVA=%JAVA_HOME%\bin\java.exe"
+
+setlocal enabledelayedexpansion
+set BASE_DIR=%~dp0
+rem added double quotation marks to avoid the issue caused by the folder names containing spaces.
+rem removed the last 5 chars(which means \bin\) to get the base DIR.
+set BASE_DIR=%BASE_DIR:~0,-5%
+
+set SERVER=dubbo-admin
+
+set "JAVA_OPT=%JAVA_OPT% -Xms512m -Xmx512m -Xmn256m"
+
+set "JAVA_OPT=%JAVA_OPT% -jar %BASE_DIR%\lib\%SERVER%.jar"
+
+call "%JAVA%" %JAVA_OPT% dubbo.admin %*
diff --git a/dubbo-admin-distribution/src/bin/startup.sh b/dubbo-admin-distribution/src/bin/startup.sh
new file mode 100644
index 0000000..f152dbb
--- /dev/null
+++ b/dubbo-admin-distribution/src/bin/startup.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+# Licensed to the 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.
+# The 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.
+
+cygwin=false
+darwin=false
+os400=false
+case "`uname`" in
+CYGWIN*) cygwin=true;;
+Darwin*) darwin=true;;
+OS400*) os400=true;;
+esac
+[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java
+[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java
+[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/opt/taobao/java
+[ ! -e "$JAVA_HOME/bin/java" ] && unset JAVA_HOME
+
+if [ -z "$JAVA_HOME" ]; then
+  if $darwin; then
+
+    if [ -x '/usr/libexec/java_home' ] ; then
+      export JAVA_HOME=`/usr/libexec/java_home`
+
+    elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then
+      export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home"
+    fi
+  else
+    JAVA_PATH=`dirname $(readlink -f $(which javac))`
+    if [ "x$JAVA_PATH" != "x" ]; then
+      export JAVA_HOME=`dirname $JAVA_PATH 2>/dev/null`
+    fi
+  fi
+  if [ -z "$JAVA_HOME" ]; then
+        error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better!"
+  fi
+fi
+export SERVER="dubbo-admin"
+export JAVA_HOME
+export JAVA="$JAVA_HOME/bin/java"
+export BASE_DIR=`cd $(dirname $0)/..; pwd`
+JAVA_OPT="${JAVA_OPT} -Xms512m -Xmx512m -Xmn256m"
+JAVA_OPT="${JAVA_OPT} -jar ${BASE_DIR}/lib/${SERVER}.jar"
+nohup $JAVA ${JAVA_OPT} dubbo.admin >> ${BASE_DIR}/logs/catlog.out 2>&1 &
+echo "${SERVER} is starting,you can check the ${BASE_DIR}/logs/catlog.out"
\ No newline at end of file
diff --git a/dubbo-admin-server/pom.xml b/dubbo-admin-server/pom.xml
index 15b7220..5d00f89 100644
--- a/dubbo-admin-server/pom.xml
+++ b/dubbo-admin-server/pom.xml
@@ -256,6 +256,23 @@
                 </dependency>
             </dependencies>
         </profile>
+        <profile>
+            <id>release</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-jar-plugin</artifactId>
+                        <configuration>
+                            <excludes>
+                                <exclude>**/application.properties</exclude>
+                                <exclude>**/application-test.properties</exclude>
+                            </excludes>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
     </profiles>
 
 </project>