Commit d6779624 by Yiming Liu

Update start script by leverage spring boot launch

parent 39fb6a84
......@@ -83,6 +83,9 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
......
......@@ -12,7 +12,7 @@
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>*:apollo-buildtools:*</include>
<include>*:apollo-adminervice:*</include>
<include>*:apollo-adminservice:*</include>
</includes>
<sources>
<includeModuleDirectory>false</includeModuleDirectory>
......@@ -30,6 +30,18 @@
<fileSet>
<directory>src/main/config</directory>
<outputDirectory>config</outputDirectory>
<excludes>
<exclude>apollo-adminservice.conf</exclude>
</excludes>
<lineEnding>unix</lineEnding>
</fileSet>
<fileSet>
<directory>src/main/config</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>apollo-adminservice.conf</include>
</includes>
<lineEnding>unix</lineEnding>
</fileSet>
<!--artifact -->
<fileSet>
......@@ -38,7 +50,7 @@
<includes>
<include>${project.artifactId}-*.jar</include>
</includes>
<fileMode>0444</fileMode>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
</sources>
......
MODE=service
PID_FOLDER=.
LOG_FOLDER=/opt/logs/100003172/
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<property name="LOG_FILE"
value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}apollo-adminservice.log}" />
<include resource="org/springframework/boot/logging/logback/file-appender.xml" />
<root level="INFO">
<appender-ref ref="FILE" />
</root>
</configuration>
\ No newline at end of file
#!/bin/bash
SERVICE_NAME=apollo-adminservice
PATH_TO_JAR=$SERVICE_NAME"-0.0.1-SNAPSHOT.jar"
LOG_PATH=/opt/logs/100003172/
cd `dirname $0`/..
source bin/common.sh stop
\ No newline at end of file
./$SERVICE_NAME".jar" stop
#!/bin/bash
SERVICE_NAME=apollo-adminservice
PATH_TO_JAR=$SERVICE_NAME"-0.0.1-SNAPSHOT.jar"
LOG_PATH=/opt/logs/100003172/
VERSION=0.0.1-SNAPSHOT
PATH_TO_JAR=$SERVICE_NAME"-"$VERSION".jar"
cd `dirname $0`/..
source bin/common.sh start
if [[ -f $SERVICE_NAME".jar" ]]; then
rm -rf $SERVICE_NAME".jar"
fi
ln $PATH_TO_JAR $SERVICE_NAME".jar"
./$SERVICE_NAME".jar" start
exit 0;
\ No newline at end of file
# DataSource
spring.datasource.url =
spring.datasource.username =
spring.datasource.password =
......@@ -7,4 +7,3 @@ spring.datasource.validationQuery=SELECT 1
spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
spring.jpa.hibernate.globally_quoted_identifiers=true
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
spring.jpa.properties.hibernate.show_sql=true
#!/bin/bash
# directories
SYSOUT_LOG=$LOG_PATH/sysout.log
mkdir -p $LOG_PATH
PID_PATH_NAME=$SERVICE_NAME".pid"
case $1 in
start)
echo "Starting $SERVICE_NAME ..."
if [ ! -f $PID_PATH_NAME ]; then
nohup java -jar $PATH_TO_JAR /tmp 2>> $SYSOUT_LOG >> $SYSOUT_LOG &
echo $! > $PID_PATH_NAME
echo "$SERVICE_NAME started ..."
else
echo "$SERVICE_NAME is already running ..."
fi
;;
stop)
if [ -f $PID_PATH_NAME ]; then
PID=$(cat $PID_PATH_NAME);
echo "$SERVICE_NAME stopping ..."
kill $PID;
echo "$SERVICE_NAME stopped ..."
rm $PID_PATH_NAME
else
echo "$SERVICE_NAME is not running ..."
fi
;;
restart)
if [ -f $PID_PATH_NAME ]; then
PID=$(cat $PID_PATH_NAME);
echo "$SERVICE_NAME stopping ...";
kill $PID;
echo "$SERVICE_NAME stopped ...";
rm $PID_PATH_NAME
echo "$SERVICE_NAME starting ..."
nohup java -jar $PATH_TO_JAR /tmp 2>> $SYSOUT_LOG >> $SYSOUT_LOG &
echo $! > $PID_PATH_NAME
echo "$SERVICE_NAME started ..."
else
echo "$SERVICE_NAME is not running ..."
fi
;;
esac
exit 0
\ No newline at end of file
......@@ -30,6 +30,18 @@
<fileSet>
<directory>src/main/config</directory>
<outputDirectory>config</outputDirectory>
<excludes>
<exclude>apollo-configservice.conf</exclude>
</excludes>
<lineEnding>unix</lineEnding>
</fileSet>
<fileSet>
<directory>src/main/config</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>apollo-configservice.conf</include>
</includes>
<lineEnding>unix</lineEnding>
</fileSet>
<!--artifact -->
<fileSet>
......@@ -38,7 +50,7 @@
<includes>
<include>${project.artifactId}-*.jar</include>
</includes>
<fileMode>0444</fileMode>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
</sources>
......
MODE=service
PID_FOLDER=.
LOG_FOLDER=/opt/logs/100003171/
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<property name="LOG_FILE"
value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}apollo-configservice.log}" />
<include resource="org/springframework/boot/logging/logback/file-appender.xml" />
<root level="INFO">
<appender-ref ref="FILE" />
</root>
</configuration>
\ No newline at end of file
#!/bin/bash
SERVICE_NAME=apollo-configservice
PATH_TO_JAR=$SERVICE_NAME"-0.0.1-SNAPSHOT.jar"
LOG_PATH=/opt/logs/100003171/
source bin/common.sh stop
\ No newline at end of file
cd `dirname $0`/..
./$SERVICE_NAME".jar" stop
\ No newline at end of file
#!/bin/bash
SERVICE_NAME=apollo-configservice
PATH_TO_JAR=$SERVICE_NAME"-0.0.1-SNAPSHOT.jar"
LOG_PATH=/opt/logs/100003171/
VERSION=0.0.1-SNAPSHOT
PATH_TO_JAR=$SERVICE_NAME"-"$VERSION".jar"
cd `dirname $0`/..
source bin/common.sh start
if [[ -f $SERVICE_NAME".jar" ]]; then
rm -rf $SERVICE_NAME".jar"
fi
ln $PATH_TO_JAR $SERVICE_NAME".jar"
./$SERVICE_NAME".jar" start
exit 0;
\ No newline at end of file
......@@ -29,6 +29,9 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
......
......@@ -30,6 +30,18 @@
<fileSet>
<directory>src/main/config</directory>
<outputDirectory>config</outputDirectory>
<excludes>
<exclude>apollo-portal.conf</exclude>
</excludes>
<lineEnding>unix</lineEnding>
</fileSet>
<fileSet>
<directory>src/main/config</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>apollo-portal.conf</include>
</includes>
<lineEnding>unix</lineEnding>
</fileSet>
<!--artifact -->
<fileSet>
......@@ -38,7 +50,7 @@
<includes>
<include>${project.artifactId}-*.jar</include>
</includes>
<fileMode>0444</fileMode>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
</sources>
......
MODE=service
PID_FOLDER=.
LOG_FOLDER=/opt/logs/100003173/
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<property name="LOG_FILE"
value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}apollo-portal.log}" />
<include resource="org/springframework/boot/logging/logback/file-appender.xml" />
<root level="INFO">
<appender-ref ref="FILE" />
</root>
</configuration>
\ No newline at end of file
#!/bin/bash
SERVICE_NAME=apollo-portal
PATH_TO_JAR=$SERVICE_NAME"-0.0.1-SNAPSHOT.jar"
LOG_PATH=/opt/logs/100003173/
cd `dirname $0`/..
source bin/common.sh stop
\ No newline at end of file
./$SERVICE_NAME".jar" stop
\ No newline at end of file
#!/bin/bash
SERVICE_NAME=apollo-portal
PATH_TO_JAR=$SERVICE_NAME"-0.0.1-SNAPSHOT.jar"
LOG_PATH=/opt/logs/100003173/
VERSION=0.0.1-SNAPSHOT
PATH_TO_JAR=$SERVICE_NAME"-"$VERSION".jar"
cd `dirname $0`/..
source bin/common.sh start
if [[ -f $SERVICE_NAME".jar" ]]; then
rm -rf $SERVICE_NAME".jar"
fi
ln $PATH_TO_JAR $SERVICE_NAME".jar"
./$SERVICE_NAME".jar" start
exit 0;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment