Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ set -
# usage: seatunnel-backend-daemon.sh <start|stop|status>

WORKDIR=$(cd "$(dirname "$0")" || exit; pwd)
SEATUNNEL_WEB_HOME=${SEATUNNEL_WEB_HOME:-"$WORKDIR/.."}
LOGDIR=${LOGDIR:-"${SEATUNNEL_WEB_HOME}/logs"}
CONFDIR=${CONFDIR:-"${SEATUNNEL_WEB_HOME}/conf"}

# check
check() {
Expand All @@ -39,12 +42,16 @@ start() {

check

LOGDIR=${WORKDIR}/../logs
# Create the log directory if it does not exist
if [ ! -d "$LOGDIR" ]; then
mkdir -p "$LOGDIR"
fi
JAVA_OPTS="${JAVA_OPTS} -server -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:${LOGDIR}/gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"

JAVA_MEMORY_OPTS=${JAVA_MEMORY_OPTS:-"-Xms1g -Xmx1g -Xmn512m"}
JAVA_GC_OPTS=${JAVA_GC_OPTS:-"-XX:+PrintGCDetails -Xloggc:${LOGDIR}/gc.log"}
JAVA_ERROR_OPTS=${JAVA_ERROR_OPTS:-"-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOGDIR}/dump.hprof"}

JAVA_OPTS="${JAVA_OPTS} -server $JAVA_MEMORY_OPTS $JAVA_GC_OPTS $JAVA_ERROR_OPTS"
SPRING_OPTS="${SPRING_OPTS} -Dspring.config.name=application.yml -Dspring.config.location=classpath:application.yml"
JAVA_OPTS="${JAVA_OPTS} -Dseatunnel-web.logs.path=${LOGDIR}"
# check env JAVA_HOME
Expand All @@ -53,11 +60,11 @@ start() {
exit 1
fi

echo "$WORKDIR"
CLASSPATH="$WORKDIR/../conf:$WORKDIR/../libs/*:$WORKDIR/../datasource/*"
if [ -d "$WORKDIR/../ranger-seatunnel-plugin" ]; then
CLASSPATH="$CLASSPATH:$WORKDIR/../ranger-seatunnel-plugin/lib/*.jar"
CLASSPATH="$CLASSPATH:$WORKDIR/../ranger-seatunnel-plugin/lib/ranger-seatunnel-plugin-impl/*"
echo "$SEATUNNEL_WEB_HOME"
CLASSPATH="$CONFDIR:$SEATUNNEL_WEB_HOME/libs/*:$SEATUNNEL_WEB_HOME/datasource/*"
if [ -d "$SEATUNNEL_WEB_HOME/ranger-seatunnel-plugin" ]; then
CLASSPATH="$CLASSPATH:$SEATUNNEL_WEB_HOME/ranger-seatunnel-plugin/lib/*.jar"
CLASSPATH="$CLASSPATH:$SEATUNNEL_WEB_HOME/ranger-seatunnel-plugin/lib/ranger-seatunnel-plugin-impl/*"
fi

nohup $JAVA_HOME/bin/java $JAVA_OPTS \
Expand Down
37 changes: 37 additions & 0 deletions seatunnel-web-dist/conf/seatunnel-web-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh
#
# 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.
#

# Default directories
STACK_ROOT=${STACK_ROOT:-"/usr/bigtop"}
export LOGDIR=${LOGDIR:-"/var/log/seatunnel-web"}
export CONFDIR=${CONFDIR:-"/etc/seatunnel-web/conf"}
export SEATUNNEL_WEB_HOME=${SEATUNNEL_WEB_HOME:-"$STACK_ROOT/current/seatunnel-web"}
export SEATUNNEL_HOME="${STACK_ROOT}/current/seatunnel"

# JVM options
export JAVA_MEMORY_OPTS=${JAVA_MEMORY_OPTS:-"-Xms2g -Xmx4g -Xmn1g"}
export JAVA_GC_OPTS=${JAVA_GC_OPTS:-"-XX:+PrintGCDetails -Xloggc:${LOGDIR}/gc.log"}
export JAVA_ERROR_OPTS=${JAVA_ERROR_OPTS:-"-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOGDIR}/dump.hprof"}

#JDK17_OPTS="--add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.security.jgss/sun.security.krb5=ALL-UNNAMED"
#JAVA_OPTS="$JAVA_OPTS $JDK17_OPTS"

#DEBUG_OPTS="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=*:8476,suspend=n"
#DEBUG_OPTS="$DEBUG_OPTS -verbose:class"
#export JAVA_OPTS="$JAVA_OPTS $DEBUG_OPTS"

122 changes: 122 additions & 0 deletions seatunnel-web-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
<postgresql.version>42.4.3</postgresql.version>
<sqlserver.version>9.2.1.jre8</sqlserver.version>
<mysql-connector.version>8.0.28</mysql-connector.version>
<rpm.build.disable>true</rpm.build.disable>
<rpm.release.number>1</rpm.release.number>
<rpm.stack.root>/usr/bigtop</rpm.stack.root>
<rpm.version>${project.version}-${rpm.release.number}</rpm.version>
</properties>

<profiles>
Expand Down Expand Up @@ -481,6 +485,124 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>postinstall_script</id>
<goals>
<goal>run</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<target>
<echo append="false" file="${project.build.directory}/postinstall.sh">#!/bin/sh
mkdir -p ${rpm.stack.root}/current
ln -sfn ${rpm.stack.root}/${rpm.version}/seatunnel-web ${rpm.stack.root}/current
chmod 755 ${rpm.stack.root}/${rpm.version}/seatunnel-web/bin/*.sh
chmod 755 /etc/seatunnel-web/conf/*.sh</echo>
</target>
</configuration>
</execution>
<execution>
<id>postremove_script</id>
<goals>
<goal>run</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<target>
<echo append="false" file="${project.build.directory}/postremove.sh">#!/bin/sh
rm -f ${rpm.stack.root}/current/seatunnel-web
rm -rf ${rpm.stack.root}/${rpm.version}</echo>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.3.0</version>
<executions>
<execution>
<id>generate-rpm</id>
<goals>
<goal>rpm</goal>
</goals>
<phase>package</phase>
<configuration>
<group>Development</group>
<name>seatunnel-web</name>
<version>${project.version}</version>
<release>${rpm.release.number}</release>
<needarch>x86_64</needarch>
<group>Application/Java</group>
<defaultFilemode>644</defaultFilemode>
<defaultDirmode>755</defaultDirmode>
<defaultUsername>root</defaultUsername>
<defaultGroupname>root</defaultGroupname>
<autoRequires>false</autoRequires>
<disabled>${rpm.build.disable}</disabled>
<mappings>
<mapping>
<directory>${rpm.stack.root}/${rpm.version}/seatunnel-web/</directory>
<sources>
<source>
<location>${project.build.directory}/apache-seatunnel-web-${project.version}/apache-seatunnel-web-${project.version}/</location>
<excludes>
<exclude>conf/**</exclude>
</excludes>
</source>
</sources>
</mapping>
<mapping>
<directory>/etc/seatunnel-web/</directory>
<sources>
<source>
<location>${project.build.directory}/apache-seatunnel-web-${project.version}/apache-seatunnel-web-${project.version}/</location>
<includes>
<include>conf/**</include>
</includes>
</source>
</sources>
</mapping>
<mapping>
<directory>/usr/sbin</directory>
<filemode>755</filemode>
<username>root</username>
<groupname>root</groupname>
<directoryIncluded>false</directoryIncluded>
<sources>
<source>
<location>${project.basedir}/sbin/seatunnel-web</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/etc/seatunnel-web/conf/</directory>
<filemode>755</filemode>
<sources>
<source>
<location>${project.basedir}/conf/seatunnel-web-env.sh</location>
</source>
</sources>
</mapping>
</mappings>
<postinstallScriptlet>
<scriptFile>${project.build.directory}/postinstall.sh</scriptFile>
<fileEncoding>utf-8</fileEncoding>
</postinstallScriptlet>
<postremoveScriptlet>
<scriptFile>${project.build.directory}/postremove.sh</scriptFile>
<fileEncoding>utf-8</fileEncoding>
</postremoveScriptlet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down
72 changes: 72 additions & 0 deletions seatunnel-web-dist/sbin/seatunnel-web
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/sh

#
# 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.
#

set -
# Usage: seatunnel-web {start|stop|status}
CONFDIR=${CONFDIR:-"/etc/seatunnel-web/conf"}

# Load environment variables if the configuration file exists
if [ -f "${CONFDIR}/seatunnel-web-env.sh" ]; then
. "${CONFDIR}/seatunnel-web-env.sh"
else
echo "Error: ${CONFDIR}/seatunnel-web-env.sh not found."
exit 1
fi
if [ -z "${SEATUNNEL_WEB_HOME}" ]; then
echo "Error: SEATUNNEL_WEB_HOME is not set. It must be set in seatunnel-web-env.sh"
exit 1
fi

if [ -z "${SEATUNNEL_HOME}" ]; then
echo "Error: SEATUNNEL_HOME is not set. It must be set in seatunnel-web-env.sh"
exit 1
fi

# start
start() {
cd "${SEATUNNEL_WEB_HOME}" || exit
sh ./bin/seatunnel-backend-daemon.sh start
}
# Stop the Seatunnel application
stop() {
cd "${SEATUNNEL_WEB_HOME}" || exit
sh ./bin/seatunnel-backend-daemon.sh stop
}

# Check the status of the Seatunnel application
status() {
cd "${SEATUNNEL_WEB_HOME}" || exit
sh ./bin/seatunnel-backend-daemon.sh status
}

# main
case "$1" in
"start")
start
;;
"stop")
stop
;;
"status")
status
;;
*)
echo "Usage: seatunnel-web {start|stop|status}"
exit 1
esac
Loading