Skip to content

Commit

Permalink
Add dist package module (apache#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
dengliming authored Sep 29, 2020
1 parent 9045fc2 commit c0fa3f5
Show file tree
Hide file tree
Showing 7 changed files with 264 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<module>soul-sync-data-center</module>
<module>soul-metrics</module>
<module>soul-spi</module>
<module>soul-dist</module>
</modules>

<organization>
Expand Down Expand Up @@ -461,4 +462,4 @@
</plugins>
</build>

</project>
</project>
8 changes: 8 additions & 0 deletions soul-dist/bin/admin/shutdown.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PRGDIR=`dirname "$0"`
APP=$PRGDIR/../lib/soul-admin.jar
BASE_DIR=$PRGDIR/..
PID_FILE=$BASE_DIR/logs/soul-admin.pid

PID=$(cat $PID_FILE 2>/dev/null)
kill -KILL $PID 2>/dev/null
echo "Stopping $APP OK"
56 changes: 56 additions & 0 deletions soul-dist/bin/admin/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
noJavaHome=false
if [ -z "$JAVA_HOME" ] ; then
noJavaHome=true
fi

if [ ! -e "$JAVA_HOME/bin/java" ] ; then
noJavaHome=true
fi

if $noJavaHome ; then
echo
echo "Error: JAVA_HOME environment variable is not set."
echo
exit 1
fi

PRGDIR=`dirname "$0"`
APP=$PRGDIR/../lib/soul-admin.jar
BASE_DIR=$PRGDIR/..
APP_DIR=$BASE_DIR
LOG_DIR=$BASE_DIR/logs
PID_FILE=$LOG_DIR/soul-admin.pid

#cd $APP_DIR
#设置java的CLASSPATH

#==============================================================================

#set JAVA_OPTS
#JAVA_OPTS="-server -Xmx2048m -Xms2048g -Xmn1024m -Xss512k -XX:PermSize=128m"
JAVA_OPTS="-server -Xmx2048m -Xms2048m -Xmn1024m -Xss512k"
JAVA_OPTS="$JAVA_OPTS -XX:+AggressiveOpts"
JAVA_OPTS="$JAVA_OPTS -XX:+UseBiasedLocking"
JAVA_OPTS="$JAVA_OPTS -XX:+UseFastAccessorMethods"
JAVA_OPTS="$JAVA_OPTS -XX:+DisableExplicitGC"
JAVA_OPTS="$JAVA_OPTS -XX:+UseParNewGC"
JAVA_OPTS="$JAVA_OPTS -XX:ParallelGCThreads=20"
JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC"
JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
JAVA_OPTS="$JAVA_OPTS -XX:MaxGCPauseMillis=850"
#JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDetail"
JAVA_OPTS="$JAVA_OPTS -XX:+CMSParallelRemarkEnabled"
#JAVA_OPTS="$JAVA_OPTS -XX:+UseCMSCompactAtFullCollection"
JAVA_OPTS="$JAVA_OPTS -XX:+UseCMSInitiatingOccupancyOnly"
JAVA_OPTS="$JAVA_OPTS -XX:CMSInitiatingOccupancyFraction=75"
JAVA_OPTS="$JAVA_OPTS -Xloggc:$LOG_DIR/gc.log"

mkdir -p $LOG_DIR
run_cmd="java $JAVA_OPTS -jar $APP --spring.config.location=file:$BASE_DIR/conf/"
$run_cmd >> $LOG_DIR/stdout.log 2>&1 &
echo $! > "$PID_FILE"
if [ $? -gt 0 ]; then
echo "Starting $APP ERROR"
fi
echo "Starting $APP OK"

8 changes: 8 additions & 0 deletions soul-dist/bin/bootstrap/shutdown.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PRGDIR=`dirname "$0"`
APP=$PRGDIR/../lib/soul-bootstrap.jar
BASE_DIR=$PRGDIR/..
PID_FILE=$BASE_DIR/logs/soul-bootstrap.pid

PID=$(cat $PID_FILE 2>/dev/null)
kill -KILL $PID 2>/dev/null
echo "Stopping $APP OK"
56 changes: 56 additions & 0 deletions soul-dist/bin/bootstrap/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
noJavaHome=false
if [ -z "$JAVA_HOME" ] ; then
noJavaHome=true
fi

if [ ! -e "$JAVA_HOME/bin/java" ] ; then
noJavaHome=true
fi

if $noJavaHome ; then
echo
echo "Error: JAVA_HOME environment variable is not set."
echo
exit 1
fi

PRGDIR=`dirname "$0"`
APP=$PRGDIR/../lib/soul-bootstrap.jar
BASE_DIR=$PRGDIR/..
APP_DIR=$BASE_DIR
LOG_DIR=$BASE_DIR/logs
PID_FILE=$LOG_DIR/soul-bootstrap.pid

#cd $APP_DIR
#设置java的CLASSPATH

#==============================================================================

#set JAVA_OPTS
#JAVA_OPTS="-server -Xmx2048m -Xms2048g -Xmn1024m -Xss512k -XX:PermSize=128m"
JAVA_OPTS="-server -Xmx2048m -Xms2048m -Xmn1024m -Xss512k"
JAVA_OPTS="$JAVA_OPTS -XX:+AggressiveOpts"
JAVA_OPTS="$JAVA_OPTS -XX:+UseBiasedLocking"
JAVA_OPTS="$JAVA_OPTS -XX:+UseFastAccessorMethods"
JAVA_OPTS="$JAVA_OPTS -XX:+DisableExplicitGC"
JAVA_OPTS="$JAVA_OPTS -XX:+UseParNewGC"
JAVA_OPTS="$JAVA_OPTS -XX:ParallelGCThreads=20"
JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC"
JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
JAVA_OPTS="$JAVA_OPTS -XX:MaxGCPauseMillis=850"
#JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDetail"
JAVA_OPTS="$JAVA_OPTS -XX:+CMSParallelRemarkEnabled"
#JAVA_OPTS="$JAVA_OPTS -XX:+UseCMSCompactAtFullCollection"
JAVA_OPTS="$JAVA_OPTS -XX:+UseCMSInitiatingOccupancyOnly"
JAVA_OPTS="$JAVA_OPTS -XX:CMSInitiatingOccupancyFraction=75"
JAVA_OPTS="$JAVA_OPTS -Xloggc:$LOG_DIR/gc.log"

mkdir -p $LOG_DIR
run_cmd="java $JAVA_OPTS -jar $APP --spring.config.location=file:$BASE_DIR/conf/"
$run_cmd >> $LOG_DIR/stdout.log 2>&1 &
echo $! > "$PID_FILE"
if [ $? -gt 0 ]; then
echo "Starting $APP ERROR"
fi
echo "Starting $APP OK"

79 changes: 79 additions & 0 deletions soul-dist/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>soul</artifactId>
<groupId>org.dromara</groupId>
<version>2.2.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>soul-dist</artifactId>
<packaging>pom</packaging>

<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>dist</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>dromara-soul-bin</finalName>
<descriptors>
<descriptor>${project.basedir}/src/main/assembly/binary.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
<configuration>
<attach>true</attach>
<tarLongFileMode>posix</tarLongFileMode>
<runOnlyAtExecutionRoot>false</runOnlyAtExecutionRoot>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>dist</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy file="${project.build.directory}/dromara-soul-bin.tar.gz" tofile="${project.basedir}/../dist/dromara-soul-bin.tar.gz" overwrite="true" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>


</project>
55 changes: 55 additions & 0 deletions soul-dist/src/main/assembly/binary.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>dist</id>
<formats>
<format>tar.gz</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.basedir}/../soul-admin/src/main/resources</directory>
<outputDirectory>${file.separator}soul-admin${file.separator}conf</outputDirectory>
<includes>
<include>*.yml</include>
</includes>
</fileSet>

<fileSet>
<directory>${project.basedir}/../soul-dist/bin/admin</directory>
<outputDirectory>${file.separator}soul-admin${file.separator}bin</outputDirectory>
<includes>
<include>*.sh</include>
</includes>
</fileSet>

<fileSet>
<directory>${project.basedir}/../soul-bootstrap/src/main/resources</directory>
<outputDirectory>${file.separator}soul-bootstrap${file.separator}conf</outputDirectory>
<includes>
<include>*.yml</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/../soul-dist/bin/bootstrap</directory>
<outputDirectory>${file.separator}soul-bootstrap${file.separator}bin</outputDirectory>
<includes>
<include>*.sh</include>
</includes>
</fileSet>

</fileSets>
<files>
<file>
<source>${project.basedir}/../soul-admin/target/soul-admin.jar</source>
<outputDirectory>${file.separator}soul-admin${file.separator}lib</outputDirectory>
<fileMode>0644</fileMode>
</file>

<file>
<source>${project.basedir}/../soul-bootstrap/target/soul-bootstrap.jar</source>
<outputDirectory>${file.separator}soul-bootstrap${file.separator}lib</outputDirectory>
<fileMode>0644</fileMode>
</file>
</files>
</assembly>

0 comments on commit c0fa3f5

Please sign in to comment.