commit 2787d8245f7d591820da3dd7434f5efe46385a11
parent c0c137552e9a2360665db3eca8d5125fc845c306
Author: Kebigon <git@kebigon.xyz>
Date: Tue, 18 Dec 2018 22:00:17 +0900
Create packaging
Diffstat:
3 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
@@ -40,6 +40,12 @@
<artifactId>caffeine</artifactId>
</dependency>
+ <!-- Avoid java.lang.NoClassDefFoundError: reactor/core/Disposable -->
+ <dependency>
+ <groupId>io.projectreactor</groupId>
+ <artifactId>reactor-core</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
@@ -55,8 +61,13 @@
<build>
<plugins>
<plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <!-- Version managed by spring-boot-dependencies -->
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/assembly.xml</descriptor>
+ </descriptors>
+ </configuration>
</plugin>
</plugins>
</build>
diff --git a/src/assembly/assembly.xml b/src/assembly/assembly.xml
@@ -0,0 +1,36 @@
+<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
+ <id>release</id>
+ <formats>
+ <format>tar.gz</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>src/main/external-resources</directory>
+ <outputDirectory>bin</outputDirectory>
+ <includes>
+ <include>yuzurss.sh</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/external-resources</directory>
+ <outputDirectory>cfg</outputDirectory>
+ <excludes>
+ <exclude>yuzurss.sh</exclude>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>.</directory>
+ <outputDirectory>var/log</outputDirectory>
+ <excludes>
+ <exclude>*/**</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ </dependencySet>
+ </dependencySets>
+</assembly>
+\ No newline at end of file
diff --git a/src/main/external-resources/yuzurss.sh b/src/main/external-resources/yuzurss.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+SERVICE_NAME=yuzurss
+SERVICE_RAM=32M
+SERVICE_MAIN=fr.lrgn.yuzurss.YuzuRssApplication
+
+if screen -ls $SERVICE_NAME | grep -q $SERVICE_NAME
+then
+
+ echo "The service $SERVICE_NAME is already started."
+
+else
+
+ HEAP="-Xms$SERVICE_RAM -Xmx$SERVICE_RAM"
+ ERROR="-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=../var/log/$SERVICE_NAME-$(date +%Y%m%d-%H%M%S).hprof -XX:ErrorFile=../var/log/$SERVICE_NAME-$(date +%Y%m%d-%H%M%S)-error.log"
+
+ GC="-XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:GCPauseIntervalMillis=500 -XX:+DisableExplicitGC"
+ GC_LOGS="-Xlog:gc*=trace:file=../var/log/$SERVICE_NAME-$(date +%Y%m%d-%H%M%S)-gc.log:tags,time,uptime,level"
+
+ CLASSPATH="-cp ../cfg:../lib/*"
+
+ screen -dmS $SERVICE_NAME java -server $HEAP $ERROR $GC $GC_LOGS $CLASSPATH $SERVICE_MAIN
+
+ echo "The service $SERVICE_NAME has been started."
+
+fi
+\ No newline at end of file