diff --git a/.gitignore b/.gitignore index 67a5890f..e2b7e642 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,4 @@ tmp/ # vscode # .vscode +dist/datacap/ diff --git a/configure/assembly/assembly.xml b/configure/assembly/assembly.xml new file mode 100644 index 00000000..6b48b143 --- /dev/null +++ b/configure/assembly/assembly.xml @@ -0,0 +1,62 @@ + + release + + + tar.gz + + + true + + + + false + lib + false + + + + + + src/main/bin + bin + 0755 + unix + true + + + src/main/etc/conf + configure + + **/*.xml + **/*.properties + **/*.yml + + true + + + target + lib + + *.jar + + + + . + docs + + *.md + + 0644 + + + docs + docs + 0644 + + + src/main/assembly/docs + docs + 0644 + + + diff --git a/dist/README.md b/dist/README.md new file mode 100644 index 00000000..e69de29b diff --git a/pom.xml b/pom.xml index 237e2b2c..636bc6b8 100644 --- a/pom.xml +++ b/pom.xml @@ -8,12 +8,16 @@ configure + server DataCap(Incubator) DataCap is integrated software for data transformation, integration and visualization. + 2.7.3 + 1.18.24 + 4.13.2 3.0.0 3.0.5 3.3 @@ -21,6 +25,30 @@ 1.8 + + + junit + junit + ${junit.version} + test + + + org.projectlombok + lombok + ${lombok.version} + + + + + + + org.springframework.boot + spring-boot-starter-web + ${springboot.version} + + + + diff --git a/server/pom.xml b/server/pom.xml new file mode 100644 index 00000000..5292a122 --- /dev/null +++ b/server/pom.xml @@ -0,0 +1,51 @@ + + + + incubator-datacap + io.edurt.datacap + 1.0.0.20221015 + + 4.0.0 + + datacap-server + DataCap for server + + + 3.1.1 + + + + + org.springframework.boot + spring-boot-starter-web + + + + + + + maven-assembly-plugin + ${assembly-plugin.version} + + datacap + + ../configure/assembly/assembly.xml + + ../dist + + + + make-assembly + package + + single + + + + + + + + diff --git a/server/src/main/bin/debug.sh b/server/src/main/bin/debug.sh new file mode 100644 index 00000000..228d2a3f --- /dev/null +++ b/server/src/main/bin/debug.sh @@ -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 diff --git a/server/src/main/bin/shutdown.sh b/server/src/main/bin/shutdown.sh new file mode 100644 index 00000000..58594770 --- /dev/null +++ b/server/src/main/bin/shutdown.sh @@ -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 diff --git a/server/src/main/bin/startup.sh b/server/src/main/bin/startup.sh new file mode 100644 index 00000000..06252aae --- /dev/null +++ b/server/src/main/bin/startup.sh @@ -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 diff --git a/server/src/main/etc/conf/application.properties b/server/src/main/etc/conf/application.properties new file mode 100644 index 00000000..e1f38019 --- /dev/null +++ b/server/src/main/etc/conf/application.properties @@ -0,0 +1 @@ +server.port=9096 diff --git a/server/src/main/java/io/edurt/datacap/server/DataCap.java b/server/src/main/java/io/edurt/datacap/server/DataCap.java new file mode 100644 index 00000000..9b3246cc --- /dev/null +++ b/server/src/main/java/io/edurt/datacap/server/DataCap.java @@ -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); + } +} diff --git a/server/src/main/resources/banner.txt b/server/src/main/resources/banner.txt new file mode 100644 index 00000000..2de51513 --- /dev/null +++ b/server/src/main/resources/banner.txt @@ -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