feature: Add program entry configuration

This commit is contained in:
qianmoQ 2022-09-17 17:28:21 +08:00
parent d12ec8d28a
commit 2048834c35
11 changed files with 310 additions and 0 deletions

1
.gitignore vendored
View File

@ -39,3 +39,4 @@ tmp/
# vscode #
.vscode
dist/datacap/

View File

@ -0,0 +1,62 @@
<assembly>
<id>release</id>
<formats>
<format>tar.gz</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<dependencySets>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<outputDirectory>lib</outputDirectory>
<unpack>false</unpack>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>src/main/bin</directory>
<outputDirectory>bin</outputDirectory>
<fileMode>0755</fileMode>
<lineEnding>unix</lineEnding>
<filtered>true</filtered>
</fileSet>
<fileSet>
<directory>src/main/etc/conf</directory>
<outputDirectory>configure</outputDirectory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
<include>**/*.yml</include>
</includes>
<filtered>true</filtered>
</fileSet>
<fileSet>
<directory>target</directory>
<outputDirectory>lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>.</directory>
<outputDirectory>docs</outputDirectory>
<includes>
<include>*.md</include>
</includes>
<fileMode>0644</fileMode>
</fileSet>
<fileSet>
<directory>docs</directory>
<outputDirectory>docs</outputDirectory>
<fileMode>0644</fileMode>
</fileSet>
<fileSet>
<directory>src/main/assembly/docs</directory>
<outputDirectory>docs</outputDirectory>
<fileMode>0644</fileMode>
</fileSet>
</fileSets>
</assembly>

0
dist/README.md vendored Normal file
View File

28
pom.xml
View File

@ -8,12 +8,16 @@
<modules>
<module>configure</module>
<module>server</module>
</modules>
<name>DataCap(Incubator)</name>
<description>DataCap is integrated software for data transformation, integration and visualization.</description>
<properties>
<springboot.version>2.7.3</springboot.version>
<lombok.version>1.18.24</lombok.version>
<junit.version>4.13.2</junit.version>
<plugin.maven.checkstyle.version>3.0.0</plugin.maven.checkstyle.version>
<plugin.maven.findbugs.version>3.0.5</plugin.maven.findbugs.version>
<plugin.maven.compiler.version>3.3</plugin.maven.compiler.version>
@ -21,6 +25,30 @@
<environment.compile.java.version>1.8</environment.compile.java.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${springboot.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>

51
server/pom.xml Normal file
View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>incubator-datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.0.0.20221015</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>datacap-server</artifactId>
<name>DataCap for server</name>
<properties>
<assembly-plugin.version>3.1.1</assembly-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>${assembly-plugin.version}</version>
<configuration>
<finalName>datacap</finalName>
<descriptors>
<descriptor>../configure/assembly/assembly.xml</descriptor>
</descriptors>
<outputDirectory>../dist</outputDirectory>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,48 @@
#!/bin/sh
HOME=$(pwd)
JAVA_HOME=${JAVA_HOME:-/opt/jdk}
APPLICATION_NAME='io.edurt.datacap.server.DataCap'
APPLICATION_PID=
job_before_echo_basic() {
printf "\n\tJob before echo basic \n"
printf "============================================\n"
printf "Runtime home | %s\n" "$HOME"
printf "Runtime java home | %s\n" "$JAVA_HOME"
printf "Runtime application name | %s\n" "$APPLICATION_NAME"
printf "============================================\n\n"
}
job_before_apply_server() {
APPLICATION_PID=$(pgrep -f "$APPLICATION_NAME" | awk '{print $1}')
}
job_runner_checker_server() {
printf "\n\tJob runner check server \n"
printf "============================================\n"
job_before_apply_server
printf "Runtime process | %s\n" "$APPLICATION_PID"
if test -z "$APPLICATION_PID"; then
printf "Server status | %s\n" "stopped"
printf "============================================\n\n"
else
printf "Server status | %s\n" "running"
printf "============================================\n\n"
exit
fi
}
job_runner_debug_server() {
printf "\n\tJob runner server \n"
printf "============================================\n"
printf "Server starting | %s\n" "$APPLICATION_NAME"
cd "$HOME"
"$JAVA_HOME"/bin/java -classpath 'lib/*' "$APPLICATION_NAME" \
--spring.config.location="$HOME/configure/"
}
job_before_echo_basic
# shellcheck disable=SC2119
job_runner_checker_server
job_runner_debug_server

View File

@ -0,0 +1,38 @@
#!/bin/sh
HOME=$(pwd)
APPLICATION_NAME='io.edurt.datacap.server.DataCap'
APPLICATION_PID=
job_before_echo_basic() {
printf "\n\tJob before echo basic \n"
printf "============================================\n"
printf "Runtime home | %s\n" "$HOME"
printf "Runtime application name | %s\n" "$APPLICATION_NAME"
printf "============================================\n\n"
}
job_before_apply_server() {
APPLICATION_PID=$(pgrep -f "$APPLICATION_NAME" | awk '{print $1}')
}
job_runner_stop_server() {
printf "\n\tJob runner check server \n"
printf "============================================\n"
job_before_apply_server
printf "Runtime process | %s\n" "$APPLICATION_PID"
if test -z "$APPLICATION_PID"; then
printf "Server status | %s\n" "stopped"
printf "============================================\n\n"
exit
else
printf "Server stopping | %s\n" "$APPLICATION_NAME"
kill -9 "$APPLICATION_PID"
rm -rf "$HOME/pid"
printf "Server stopped successfully | %s\n"
printf "============================================\n\n"
fi
}
job_before_echo_basic
job_runner_stop_server

View File

@ -0,0 +1,58 @@
#!/bin/sh
HOME=$(pwd)
JAVA_HOME=${JAVA_HOME:-/opt/jdk}
APPLICATION_NAME='io.edurt.datacap.server.DataCap'
APPLICATION_PID=
job_before_echo_basic() {
printf "\n\tJob before echo basic \n"
printf "============================================\n"
printf "Runtime home | %s\n" "$HOME"
printf "Runtime java home | %s\n" "$JAVA_HOME"
printf "Runtime application name | %s\n" "$APPLICATION_NAME"
printf "============================================\n\n"
}
job_before_apply_server() {
APPLICATION_PID=$(pgrep -f "$APPLICATION_NAME" | awk '{print $1}')
}
job_runner_checker_server() {
printf "\n\tJob runner check server \n"
printf "============================================\n"
job_before_apply_server
printf "Runtime process | %s\n" "$APPLICATION_PID"
if test -z "$APPLICATION_PID"; then
printf "Server status | %s\n" "stopped"
printf "============================================\n\n"
else
printf "Server status | %s\n" "running"
printf "============================================\n\n"
exit
fi
}
job_runner_start_server() {
printf "\n\tJob runner server \n"
printf "============================================\n"
printf "Server starting | %s\n" "$APPLICATION_NAME"
cd "$HOME"
nohup "$JAVA_HOME"/bin/java -classpath 'lib/*' "$APPLICATION_NAME" \
--spring.config.location="$HOME/configure/" > /dev/null 2>&1 &
sleep 5
job_before_apply_server
if test -z "$APPLICATION_PID"; then
printf "Server start failed | %s\n"
else
echo "$APPLICATION_PID" >pid
printf "Server start successful | %s\n"
fi
printf "============================================\n\n"
}
job_before_echo_basic
# shellcheck disable=SC2119
job_runner_checker_server
job_runner_start_server
exit 0

View File

@ -0,0 +1 @@
server.port=9096

View File

@ -0,0 +1,18 @@
package io.edurt.datacap.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DataCap
{
public void start(String[] args)
{
SpringApplication.run(DataCap.class, args);
}
public static void main(String[] args)
{
new DataCap().start(args);
}
}

View File

@ -0,0 +1,5 @@
8888b. db 888888 db dP""b8 db 88""Yb
8I Yb dPYb 88 dPYb dP `" dPYb 88__dP
8I dY dP__Yb 88 dP__Yb Yb dP__Yb 88"""
8888Y" dP""""Yb 88 dP""""Yb YboodP dP""""Yb 88