134 changed files with 838 additions and 3132 deletions
@ -1,9 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
chown -R ${pkg.user}: ${pkg.logFolder} |
|
||||
chown -R ${pkg.user}: ${pkg.installFolder} |
|
||||
|
|
||||
if [ $1 -eq 1 ] ; then |
|
||||
# Initial installation |
|
||||
systemctl --no-reload enable ${pkg.name}.service >/dev/null 2>&1 || : |
|
||||
fi |
|
||||
@ -1,50 +0,0 @@ |
|||||
/** |
|
||||
* Copyright © 2016-2020 The Thingsboard Authors |
|
||||
* |
|
||||
* Licensed 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. |
|
||||
*/ |
|
||||
package org.thingsboard.server.rules; |
|
||||
|
|
||||
import org.cassandraunit.dataset.cql.ClassPathCQLDataSet; |
|
||||
import org.junit.BeforeClass; |
|
||||
import org.junit.ClassRule; |
|
||||
import org.junit.extensions.cpsuite.ClasspathSuite; |
|
||||
import org.junit.runner.RunWith; |
|
||||
import org.thingsboard.server.dao.CustomCassandraCQLUnit; |
|
||||
import org.thingsboard.server.dao.CustomSqlUnit; |
|
||||
import org.thingsboard.server.queue.memory.InMemoryStorage; |
|
||||
|
|
||||
import java.util.Arrays; |
|
||||
|
|
||||
@RunWith(ClasspathSuite.class) |
|
||||
@ClasspathSuite.ClassnameFilters({ |
|
||||
"org.thingsboard.server.rules.flow.nosql.*Test", |
|
||||
"org.thingsboard.server.rules.lifecycle.nosql.*Test" |
|
||||
}) |
|
||||
public class RuleEngineNoSqlTestSuite { |
|
||||
|
|
||||
@ClassRule |
|
||||
public static CustomCassandraCQLUnit cassandraUnit = |
|
||||
new CustomCassandraCQLUnit( |
|
||||
Arrays.asList( |
|
||||
new ClassPathCQLDataSet("cassandra/schema-ts.cql", false, false), |
|
||||
new ClassPathCQLDataSet("cassandra/schema-entities.cql", false, false), |
|
||||
new ClassPathCQLDataSet("cassandra/system-data.cql", false, false)), |
|
||||
"cassandra-test.yaml", 30000l); |
|
||||
|
|
||||
@BeforeClass |
|
||||
public static void cleanupInMemStorage(){ |
|
||||
InMemoryStorage.getInstance().cleanup(); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
@ -1,120 +0,0 @@ |
|||||
/** |
|
||||
* Copyright © 2016-2020 The Thingsboard Authors |
|
||||
* |
|
||||
* Licensed 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. |
|
||||
*/ |
|
||||
import org.apache.tools.ant.filters.ReplaceTokens |
|
||||
|
|
||||
buildscript { |
|
||||
ext { |
|
||||
osPackageVersion = "3.8.0" |
|
||||
} |
|
||||
repositories { |
|
||||
jcenter() |
|
||||
} |
|
||||
dependencies { |
|
||||
classpath("com.netflix.nebula:gradle-ospackage-plugin:${osPackageVersion}") |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
apply plugin: "nebula.ospackage" |
|
||||
|
|
||||
buildDir = projectBuildDir |
|
||||
version = projectVersion |
|
||||
distsDirName = "./" |
|
||||
|
|
||||
// OS Package plugin configuration |
|
||||
ospackage { |
|
||||
packageName = pkgName |
|
||||
version = "${project.version}" |
|
||||
release = 1 |
|
||||
os = LINUX |
|
||||
type = BINARY |
|
||||
|
|
||||
into pkgInstallFolder |
|
||||
|
|
||||
user pkgUser |
|
||||
permissionGroup pkgUser |
|
||||
|
|
||||
// Copy the executable file |
|
||||
from("target/package/linux/bin/${pkgName}") { |
|
||||
fileMode 0500 |
|
||||
into "bin" |
|
||||
} |
|
||||
|
|
||||
// Copy the init file |
|
||||
from("target/package/linux/init/${pkgName}") { |
|
||||
fileMode 0500 |
|
||||
into "init" |
|
||||
} |
|
||||
|
|
||||
// Copy the config files |
|
||||
from("target/package/linux/conf") { |
|
||||
fileType CONFIG | NOREPLACE |
|
||||
fileMode 0754 |
|
||||
into "conf" |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
// Configure our RPM build task |
|
||||
buildRpm { |
|
||||
|
|
||||
arch = X86_64 |
|
||||
|
|
||||
version = projectVersion.replace('-', '') |
|
||||
archiveName = "${pkgName}.rpm" |
|
||||
|
|
||||
preInstall file("${buildDir}/control/rpm/preinst") |
|
||||
postInstall file("${buildDir}/control/rpm/postinst") |
|
||||
preUninstall file("${buildDir}/control/rpm/prerm") |
|
||||
postUninstall file("${buildDir}/control/rpm/postrm") |
|
||||
|
|
||||
user pkgUser |
|
||||
permissionGroup pkgUser |
|
||||
|
|
||||
// Copy the system unit files |
|
||||
from("${buildDir}/control/${pkgName}.service") { |
|
||||
addParentDirs = false |
|
||||
fileMode 0644 |
|
||||
into "/usr/lib/systemd/system" |
|
||||
} |
|
||||
|
|
||||
directory(pkgLogFolder, 0755) |
|
||||
link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf") |
|
||||
} |
|
||||
|
|
||||
// Same as the buildRpm task |
|
||||
buildDeb { |
|
||||
|
|
||||
arch = "amd64" |
|
||||
|
|
||||
archiveName = "${pkgName}.deb" |
|
||||
|
|
||||
configurationFile("${pkgInstallFolder}/conf/${pkgName}.conf") |
|
||||
configurationFile("${pkgInstallFolder}/conf/custom-environment-variables.yml") |
|
||||
configurationFile("${pkgInstallFolder}/conf/default.yml") |
|
||||
configurationFile("${pkgInstallFolder}/conf/logger.js") |
|
||||
|
|
||||
preInstall file("${buildDir}/control/deb/preinst") |
|
||||
postInstall file("${buildDir}/control/deb/postinst") |
|
||||
preUninstall file("${buildDir}/control/deb/prerm") |
|
||||
postUninstall file("${buildDir}/control/deb/postrm") |
|
||||
|
|
||||
user pkgUser |
|
||||
permissionGroup pkgUser |
|
||||
|
|
||||
directory(pkgLogFolder, 0755) |
|
||||
link("/etc/init.d/${pkgName}", "${pkgInstallFolder}/init/${pkgName}") |
|
||||
link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf") |
|
||||
} |
|
||||
@ -1,71 +0,0 @@ |
|||||
<!-- |
|
||||
|
|
||||
Copyright © 2016-2020 The Thingsboard Authors |
|
||||
|
|
||||
Licensed 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. |
|
||||
|
|
||||
--> |
|
||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" |
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> |
|
||||
<id>windows</id> |
|
||||
|
|
||||
<formats> |
|
||||
<format>zip</format> |
|
||||
</formats> |
|
||||
|
|
||||
<!-- Workaround to create logs directory --> |
|
||||
<fileSets> |
|
||||
<fileSet> |
|
||||
<directory>${pkg.win.dist}</directory> |
|
||||
<outputDirectory>logs</outputDirectory> |
|
||||
<excludes> |
|
||||
<exclude>*/**</exclude> |
|
||||
</excludes> |
|
||||
</fileSet> |
|
||||
<fileSet> |
|
||||
<directory>${pkg.win.dist}/conf</directory> |
|
||||
<outputDirectory>conf</outputDirectory> |
|
||||
<lineEnding>windows</lineEnding> |
|
||||
</fileSet> |
|
||||
</fileSets> |
|
||||
|
|
||||
<files> |
|
||||
<file> |
|
||||
<source>${pkg.win.dist}/bin/${pkg.name}.exe</source> |
|
||||
<outputDirectory>bin</outputDirectory> |
|
||||
<destName>${pkg.name}.exe</destName> |
|
||||
</file> |
|
||||
<file> |
|
||||
<source>${pkg.win.dist}/service.exe</source> |
|
||||
<outputDirectory/> |
|
||||
<destName>${pkg.name}.exe</destName> |
|
||||
</file> |
|
||||
<file> |
|
||||
<source>${pkg.win.dist}/service.xml</source> |
|
||||
<outputDirectory/> |
|
||||
<destName>${pkg.name}.xml</destName> |
|
||||
<lineEnding>windows</lineEnding> |
|
||||
</file> |
|
||||
<file> |
|
||||
<source>${pkg.win.dist}/install.bat</source> |
|
||||
<outputDirectory/> |
|
||||
<lineEnding>windows</lineEnding> |
|
||||
</file> |
|
||||
<file> |
|
||||
<source>${pkg.win.dist}/uninstall.bat</source> |
|
||||
<outputDirectory/> |
|
||||
<lineEnding>windows</lineEnding> |
|
||||
</file> |
|
||||
</files> |
|
||||
</assembly> |
|
||||
@ -1,6 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
chown -R ${pkg.user}: ${pkg.logFolder} |
|
||||
chown -R ${pkg.user}: ${pkg.installFolder} |
|
||||
update-rc.d ${pkg.name} defaults |
|
||||
|
|
||||
@ -1,3 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
update-rc.d -f ${pkg.name} remove |
|
||||
@ -1,233 +0,0 @@ |
|||||
#!/bin/bash |
|
||||
# |
|
||||
|
|
||||
|
|
||||
### BEGIN INIT INFO |
|
||||
# Provides: tb-js-executor |
|
||||
# Required-Start: $remote_fs $syslog $network |
|
||||
# Required-Stop: $remote_fs $syslog $network |
|
||||
# Default-Start: 2 3 4 5 |
|
||||
# Default-Stop: 0 1 6 |
|
||||
# Short-Description: ${project.name} |
|
||||
# Description: ${project.description} |
|
||||
# chkconfig: 2345 99 01 |
|
||||
### END INIT INFO |
|
||||
|
|
||||
[[ -n "$DEBUG" ]] && set -x |
|
||||
|
|
||||
# Initialize variables that cannot be provided by a .conf file |
|
||||
WORKING_DIR="$(pwd)" |
|
||||
# shellcheck disable=SC2153 |
|
||||
|
|
||||
mainfile=${pkg.installFolder}/bin/${pkg.name} |
|
||||
configfile=${pkg.name}.conf |
|
||||
|
|
||||
# Follow symlinks to find the real script and detect init.d script |
|
||||
cd "$(dirname "$0")" || exit 1 |
|
||||
[[ -z "$initfile" ]] && initfile=$(pwd)/$(basename "$0") |
|
||||
while [[ -L "$initfile" ]]; do |
|
||||
[[ "$initfile" =~ init\.d ]] && init_script=$(basename "$initfile") |
|
||||
initfile=$(readlink "$initfile") |
|
||||
cd "$(dirname "$initfile")" || exit 1 |
|
||||
initfile=$(pwd)/$(basename "$initfile") |
|
||||
done |
|
||||
initfolder="$( (cd "$(dirname "initfile")" && pwd -P) )" |
|
||||
cd "$WORKING_DIR" || exit 1 |
|
||||
|
|
||||
# Initialize CONF_FOLDER location |
|
||||
[[ -z "$CONF_FOLDER" ]] && CONF_FOLDER="${pkg.installFolder}/conf" |
|
||||
|
|
||||
# shellcheck source=/dev/null |
|
||||
[[ -r "${CONF_FOLDER}/${configfile}" ]] && source "${CONF_FOLDER}/${configfile}" |
|
||||
|
|
||||
# Initialize PID/LOG locations if they weren't provided by the config file |
|
||||
[[ -z "$PID_FOLDER" ]] && PID_FOLDER="/var/run" |
|
||||
[[ -z "$LOG_FOLDER" ]] && LOG_FOLDER="${pkg.unixLogFolder}" |
|
||||
! [[ "$PID_FOLDER" == /* ]] && PID_FOLDER="$(dirname "$mainfile")"/"$PID_FOLDER" |
|
||||
! [[ "$LOG_FOLDER" == /* ]] && LOG_FOLDER="$(dirname "$mainfile")"/"$LOG_FOLDER" |
|
||||
! [[ -x "$PID_FOLDER" ]] && PID_FOLDER="/tmp" |
|
||||
! [[ -x "$LOG_FOLDER" ]] && LOG_FOLDER="/tmp" |
|
||||
|
|
||||
# Set up defaults |
|
||||
[[ -z "$MODE" ]] && MODE="auto" # modes are "auto", "service" or "run" |
|
||||
[[ -z "$USE_START_STOP_DAEMON" ]] && USE_START_STOP_DAEMON="true" |
|
||||
|
|
||||
# Create an identity for log/pid files |
|
||||
if [[ -z "$identity" ]]; then |
|
||||
if [[ -n "$init_script" ]]; then |
|
||||
identity="${init_script}" |
|
||||
else |
|
||||
identity=$(basename "${initfile%.*}")_${initfolder//\//} |
|
||||
fi |
|
||||
fi |
|
||||
|
|
||||
# Initialize log file name if not provided by the config file |
|
||||
[[ -z "$LOG_FILENAME" ]] && LOG_FILENAME="${identity}.log" |
|
||||
|
|
||||
# ANSI Colors |
|
||||
echoRed() { echo $'\e[0;31m'"$1"$'\e[0m'; } |
|
||||
echoGreen() { echo $'\e[0;32m'"$1"$'\e[0m'; } |
|
||||
echoYellow() { echo $'\e[0;33m'"$1"$'\e[0m'; } |
|
||||
|
|
||||
# Utility functions |
|
||||
checkPermissions() { |
|
||||
touch "$pid_file" &> /dev/null || { echoRed "Operation not permitted (cannot access pid file)"; return 4; } |
|
||||
touch "$log_file" &> /dev/null || { echoRed "Operation not permitted (cannot access log file)"; return 4; } |
|
||||
} |
|
||||
|
|
||||
isRunning() { |
|
||||
ps -p "$1" &> /dev/null |
|
||||
} |
|
||||
|
|
||||
await_file() { |
|
||||
end=$(date +%s) |
|
||||
let "end+=10" |
|
||||
while [[ ! -s "$1" ]] |
|
||||
do |
|
||||
now=$(date +%s) |
|
||||
if [[ $now -ge $end ]]; then |
|
||||
break |
|
||||
fi |
|
||||
sleep 1 |
|
||||
done |
|
||||
} |
|
||||
|
|
||||
# Determine the script mode |
|
||||
action="run" |
|
||||
if [[ "$MODE" == "auto" && -n "$init_script" ]] || [[ "$MODE" == "service" ]]; then |
|
||||
action="$1" |
|
||||
shift |
|
||||
fi |
|
||||
|
|
||||
# Build the pid and log filenames |
|
||||
if [[ "$identity" == "$init_script" ]] || [[ "$identity" == "$APP_NAME" ]]; then |
|
||||
PID_FOLDER="$PID_FOLDER/${identity}" |
|
||||
pid_subfolder=$PID_FOLDER |
|
||||
fi |
|
||||
pid_file="$PID_FOLDER/${identity}.pid" |
|
||||
log_file="$LOG_FOLDER/$LOG_FILENAME" |
|
||||
|
|
||||
# Determine the user to run as if we are root |
|
||||
# shellcheck disable=SC2012 |
|
||||
[[ $(id -u) == "0" ]] && run_user=$(ls -ld "$mainfile" | awk '{print $3}') |
|
||||
|
|
||||
arguments=($RUN_ARGS "$@") |
|
||||
|
|
||||
# Action functions |
|
||||
start() { |
|
||||
if [[ -f "$pid_file" ]]; then |
|
||||
pid=$(cat "$pid_file") |
|
||||
isRunning "$pid" && { echoYellow "Already running [$pid]"; return 0; } |
|
||||
fi |
|
||||
do_start "$@" |
|
||||
} |
|
||||
|
|
||||
do_start() { |
|
||||
working_dir=$(dirname "$mainfile") |
|
||||
pushd "$working_dir" > /dev/null |
|
||||
mkdir -p "$PID_FOLDER" &> /dev/null |
|
||||
if [[ -n "$run_user" ]]; then |
|
||||
checkPermissions || return $? |
|
||||
if [[ -z "$pid_subfolder" ]]; then |
|
||||
chown "$run_user" "$pid_subfolder" |
|
||||
fi |
|
||||
chown "$run_user" "$pid_file" |
|
||||
chown "$run_user" "$log_file" |
|
||||
if [ $USE_START_STOP_DAEMON = true ] && type start-stop-daemon > /dev/null 2>&1; then |
|
||||
start-stop-daemon --start --quiet \ |
|
||||
--chuid "$run_user" \ |
|
||||
--name "$identity" \ |
|
||||
--make-pidfile --pidfile "$pid_file" \ |
|
||||
--background --no-close \ |
|
||||
--startas "$mainfile" \ |
|
||||
--chdir "$working_dir" \ |
|
||||
-- "${arguments[@]}" \ |
|
||||
>> "$log_file" 2>&1 |
|
||||
await_file "$pid_file" |
|
||||
else |
|
||||
su -s /bin/sh -c "$mainfile $(printf "\"%s\" " "${arguments[@]}") >> \"$log_file\" 2>&1 & echo \$!" "$run_user" > "$pid_file" |
|
||||
fi |
|
||||
pid=$(cat "$pid_file") |
|
||||
else |
|
||||
checkPermissions || return $? |
|
||||
"$mainfile" "${arguments[@]}" >> "$log_file" 2>&1 & |
|
||||
pid=$! |
|
||||
disown $pid |
|
||||
echo "$pid" > "$pid_file" |
|
||||
fi |
|
||||
[[ -z $pid ]] && { echoRed "Failed to start"; return 1; } |
|
||||
echoGreen "Started [$pid]" |
|
||||
} |
|
||||
|
|
||||
stop() { |
|
||||
working_dir=$(dirname "$mainfile") |
|
||||
pushd "$working_dir" > /dev/null |
|
||||
[[ -f $pid_file ]] || { echoYellow "Not running (pidfile not found)"; return 0; } |
|
||||
pid=$(cat "$pid_file") |
|
||||
isRunning "$pid" || { echoYellow "Not running (process ${pid}). Removing stale pid file."; rm -f "$pid_file"; return 0; } |
|
||||
do_stop "$pid" "$pid_file" |
|
||||
} |
|
||||
|
|
||||
do_stop() { |
|
||||
kill -2 "$1" &> /dev/null || { echoRed "Unable to kill process $1"; return 1; } |
|
||||
for i in $(seq 1 60); do |
|
||||
isRunning "$1" || { echoGreen "Stopped [$1]"; rm -f "$2"; return 0; } |
|
||||
[[ $i -eq 30 ]] && kill -9 "$1" &> /dev/null |
|
||||
sleep 1 |
|
||||
done |
|
||||
echoRed "Unable to kill process $1"; |
|
||||
return 1; |
|
||||
} |
|
||||
|
|
||||
restart() { |
|
||||
stop && start |
|
||||
} |
|
||||
|
|
||||
orce_reload() { |
|
||||
working_dir=$(dirname "$mainfile") |
|
||||
pushd "$working_dir" > /dev/null |
|
||||
[[ -f $pid_file ]] || { echoRed "Not running (pidfile not found)"; return 7; } |
|
||||
pid=$(cat "$pid_file") |
|
||||
rm -f "$pid_file" |
|
||||
isRunning "$pid" || { echoRed "Not running (process ${pid} not found)"; return 7; } |
|
||||
do_stop "$pid" "$pid_file" |
|
||||
do_start |
|
||||
} |
|
||||
|
|
||||
status() { |
|
||||
working_dir=$(dirname "$mainfile") |
|
||||
pushd "$working_dir" > /dev/null |
|
||||
[[ -f "$pid_file" ]] || { echoRed "Not running"; return 3; } |
|
||||
pid=$(cat "$pid_file") |
|
||||
isRunning "$pid" || { echoRed "Not running (process ${pid} not found)"; return 1; } |
|
||||
echoGreen "Running [$pid]" |
|
||||
return 0 |
|
||||
} |
|
||||
|
|
||||
run() { |
|
||||
pushd "$(dirname "$mainfile")" > /dev/null |
|
||||
"$mainfile" "${arguments[@]}" |
|
||||
result=$? |
|
||||
popd > /dev/null |
|
||||
return "$result" |
|
||||
} |
|
||||
|
|
||||
# Call the appropriate action function |
|
||||
case "$action" in |
|
||||
start) |
|
||||
start "$@"; exit $?;; |
|
||||
stop) |
|
||||
stop "$@"; exit $?;; |
|
||||
restart) |
|
||||
restart "$@"; exit $?;; |
|
||||
force-reload) |
|
||||
force_reload "$@"; exit $?;; |
|
||||
status) |
|
||||
status "$@"; exit $?;; |
|
||||
run) |
|
||||
run "$@"; exit $?;; |
|
||||
*) |
|
||||
echo "Usage: $0 {start|stop|restart|force-reload|status|run}"; exit 1; |
|
||||
esac |
|
||||
|
|
||||
exit 0 |
|
||||
@ -1,29 +0,0 @@ |
|||||
<!-- |
|
||||
|
|
||||
Copyright © 2016-2018 The Thingsboard Authors |
|
||||
|
|
||||
Licensed 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. |
|
||||
|
|
||||
--> |
|
||||
<service> |
|
||||
<id>${pkg.name}</id> |
|
||||
<name>${project.name}</name> |
|
||||
<description>${project.description}</description> |
|
||||
<workingdirectory>%BASE%\bin</workingdirectory> |
|
||||
<logpath>${pkg.winWrapperLogFolder}</logpath> |
|
||||
<logmode>rotate</logmode> |
|
||||
<env name="NODE_CONFIG_DIR" value="%BASE%\conf" /> |
|
||||
<env name="LOG_FOLDER" value="${pkg.winWrapperLogFolder}" /> |
|
||||
<env name="NODE_ENV" value="production" /> |
|
||||
<executable>%BASE%\bin\${pkg.name}.exe</executable> |
|
||||
</service> |
|
||||
@ -1 +0,0 @@ |
|||||
pkg.logFolder=${pkg.unixLogFolder} |
|
||||
@ -1,2 +0,0 @@ |
|||||
pkg.logFolder=${BASE}\\logs |
|
||||
pkg.winWrapperLogFolder=%BASE%\\logs |
|
||||
@ -1,6 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
chown -R ${pkg.user}: ${pkg.logFolder} |
|
||||
chown -R ${pkg.user}: ${pkg.installFolder} |
|
||||
update-rc.d ${pkg.name} defaults |
|
||||
|
|
||||
@ -1,3 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
update-rc.d -f ${pkg.name} remove |
|
||||
@ -1,18 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
if ! getent group ${pkg.user} >/dev/null; then |
|
||||
addgroup --system ${pkg.user} |
|
||||
fi |
|
||||
|
|
||||
if ! getent passwd ${pkg.user} >/dev/null; then |
|
||||
adduser --quiet \ |
|
||||
--system \ |
|
||||
--ingroup ${pkg.user} \ |
|
||||
--quiet \ |
|
||||
--disabled-login \ |
|
||||
--disabled-password \ |
|
||||
--home ${pkg.installFolder} \ |
|
||||
--no-create-home \ |
|
||||
-gecos "Thingsboard application" \ |
|
||||
${pkg.user} |
|
||||
fi |
|
||||
@ -1,5 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
if [ -e /var/run/${pkg.name}/${pkg.name}.pid ]; then |
|
||||
service ${pkg.name} stop |
|
||||
fi |
|
||||
@ -1,9 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
chown -R ${pkg.user}: ${pkg.logFolder} |
|
||||
chown -R ${pkg.user}: ${pkg.installFolder} |
|
||||
|
|
||||
if [ $1 -eq 1 ] ; then |
|
||||
# Initial installation |
|
||||
systemctl --no-reload enable ${pkg.name}.service >/dev/null 2>&1 || : |
|
||||
fi |
|
||||
@ -1,6 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
if [ $1 -ge 1 ] ; then |
|
||||
# Package upgrade, not uninstall |
|
||||
systemctl try-restart ${pkg.name}.service >/dev/null 2>&1 || : |
|
||||
fi |
|
||||
@ -1,6 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
getent group ${pkg.user} >/dev/null || groupadd -r ${pkg.user} |
|
||||
getent passwd ${pkg.user} >/dev/null || \ |
|
||||
useradd -d ${pkg.installFolder} -g ${pkg.user} -M -r ${pkg.user} -s /sbin/nologin \ |
|
||||
-c "Thingsboard application" |
|
||||
@ -1,6 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
if [ $1 -eq 0 ] ; then |
|
||||
# Package removal, not upgrade |
|
||||
systemctl --no-reload disable --now ${pkg.name}.service > /dev/null 2>&1 || : |
|
||||
fi |
|
||||
@ -1,11 +0,0 @@ |
|||||
[Unit] |
|
||||
Description=${pkg.name} |
|
||||
After=syslog.target |
|
||||
|
|
||||
[Service] |
|
||||
User=${pkg.user} |
|
||||
ExecStart=${pkg.installFolder}/init/${pkg.name} |
|
||||
SuccessExitStatus=143 |
|
||||
|
|
||||
[Install] |
|
||||
WantedBy=multi-user.target |
|
||||
@ -1,31 +0,0 @@ |
|||||
@REM |
|
||||
@REM Copyright © 2016-2018 The Thingsboard Authors |
|
||||
@REM |
|
||||
@REM Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||
@REM you may not use this file except in compliance with the License. |
|
||||
@REM You may obtain a copy of the License at |
|
||||
@REM |
|
||||
@REM http://www.apache.org/licenses/LICENSE-2.0 |
|
||||
@REM |
|
||||
@REM Unless required by applicable law or agreed to in writing, software |
|
||||
@REM distributed under the License is distributed on an "AS IS" BASIS, |
|
||||
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||
@REM See the License for the specific language governing permissions and |
|
||||
@REM limitations under the License. |
|
||||
@REM |
|
||||
|
|
||||
@ECHO OFF |
|
||||
|
|
||||
setlocal ENABLEEXTENSIONS |
|
||||
|
|
||||
@ECHO Installing ${pkg.name} ... |
|
||||
|
|
||||
SET BASE=%~dp0 |
|
||||
|
|
||||
"%BASE%"${pkg.name}.exe install |
|
||||
|
|
||||
@ECHO ${pkg.name} installed successfully! |
|
||||
|
|
||||
GOTO END |
|
||||
|
|
||||
:END |
|
||||
@ -1,25 +0,0 @@ |
|||||
@REM |
|
||||
@REM Copyright © 2016-2018 The Thingsboard Authors |
|
||||
@REM |
|
||||
@REM Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||
@REM you may not use this file except in compliance with the License. |
|
||||
@REM You may obtain a copy of the License at |
|
||||
@REM |
|
||||
@REM http://www.apache.org/licenses/LICENSE-2.0 |
|
||||
@REM |
|
||||
@REM Unless required by applicable law or agreed to in writing, software |
|
||||
@REM distributed under the License is distributed on an "AS IS" BASIS, |
|
||||
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||
@REM See the License for the specific language governing permissions and |
|
||||
@REM limitations under the License. |
|
||||
@REM |
|
||||
|
|
||||
@ECHO OFF |
|
||||
|
|
||||
@ECHO Stopping ${pkg.name} ... |
|
||||
net stop ${pkg.name} |
|
||||
|
|
||||
@ECHO Uninstalling ${pkg.name} ... |
|
||||
"%~dp0"${pkg.name}.exe uninstall |
|
||||
|
|
||||
@ECHO DONE. |
|
||||
@ -1,5 +1,6 @@ |
|||||
#!/bin/sh |
#!/bin/sh |
||||
|
|
||||
|
mkdir -m 0755 -p ${pkg.logFolder} |
||||
chown -R ${pkg.user}: ${pkg.logFolder} |
chown -R ${pkg.user}: ${pkg.logFolder} |
||||
chown -R ${pkg.user}: ${pkg.installFolder} |
chown -R ${pkg.user}: ${pkg.installFolder} |
||||
|
|
||||
@ -0,0 +1,8 @@ |
|||||
|
#!/bin/sh |
||||
|
|
||||
|
mkdir -m 0755 -p ${pkg.logFolder} |
||||
|
chown -R ${pkg.user}: ${pkg.logFolder} |
||||
|
chown -R ${pkg.user}: ${pkg.installFolder} |
||||
|
|
||||
|
systemctl --no-reload enable ${pkg.name}.service >/dev/null 2>&1 || : |
||||
|
|
||||
@ -0,0 +1,8 @@ |
|||||
|
#!/bin/sh |
||||
|
|
||||
|
set -e |
||||
|
|
||||
|
systemctl --no-reload disable --now ${pkg.name}.service > /dev/null 2>&1 || : |
||||
|
|
||||
|
exit 0 |
||||
|
|
||||
@ -1,5 +1,6 @@ |
|||||
#!/bin/sh |
#!/bin/sh |
||||
|
|
||||
|
mkdir -m 0755 -p ${pkg.logFolder} |
||||
chown -R ${pkg.user}: ${pkg.logFolder} |
chown -R ${pkg.user}: ${pkg.logFolder} |
||||
chown -R ${pkg.user}: ${pkg.installFolder} |
chown -R ${pkg.user}: ${pkg.installFolder} |
||||
|
|
||||
@ -1,140 +0,0 @@ |
|||||
/** |
|
||||
* Copyright © 2016-2020 The Thingsboard Authors |
|
||||
* |
|
||||
* Licensed 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. |
|
||||
*/ |
|
||||
import org.apache.tools.ant.filters.ReplaceTokens |
|
||||
|
|
||||
buildscript { |
|
||||
ext { |
|
||||
osPackageVersion = "3.8.0" |
|
||||
} |
|
||||
repositories { |
|
||||
jcenter() |
|
||||
} |
|
||||
dependencies { |
|
||||
classpath("com.netflix.nebula:gradle-ospackage-plugin:${osPackageVersion}") |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
apply plugin: "nebula.ospackage" |
|
||||
|
|
||||
buildDir = projectBuildDir |
|
||||
version = projectVersion |
|
||||
distsDirName = "./" |
|
||||
|
|
||||
// OS Package plugin configuration |
|
||||
ospackage { |
|
||||
packageName = pkgName |
|
||||
version = "${project.version}" |
|
||||
release = 1 |
|
||||
os = LINUX |
|
||||
type = BINARY |
|
||||
|
|
||||
into pkgInstallFolder |
|
||||
|
|
||||
user pkgName |
|
||||
permissionGroup pkgName |
|
||||
|
|
||||
// Copy the actual .jar file |
|
||||
from(mainJar) { |
|
||||
// Strip the version from the jar filename |
|
||||
rename { String fileName -> |
|
||||
"${pkgName}.jar" |
|
||||
} |
|
||||
fileMode 0500 |
|
||||
into "bin" |
|
||||
} |
|
||||
|
|
||||
// Copy the config files |
|
||||
from("target/conf") { |
|
||||
exclude "${pkgName}.conf" |
|
||||
fileType CONFIG | NOREPLACE |
|
||||
fileMode 0754 |
|
||||
into "conf" |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
// Configure our RPM build task |
|
||||
buildRpm { |
|
||||
|
|
||||
arch = NOARCH |
|
||||
|
|
||||
version = projectVersion.replace('-', '') |
|
||||
archiveName = "${pkgName}.rpm" |
|
||||
|
|
||||
requires("java-1.8.0") |
|
||||
|
|
||||
from("target/conf") { |
|
||||
include "${pkgName}.conf" |
|
||||
filter(ReplaceTokens, tokens: ['pkg.platform': 'rpm']) |
|
||||
fileType CONFIG | NOREPLACE |
|
||||
fileMode 0754 |
|
||||
into "${pkgInstallFolder}/conf" |
|
||||
} |
|
||||
|
|
||||
preInstall file("${buildDir}/control/rpm/preinst") |
|
||||
postInstall file("${buildDir}/control/rpm/postinst") |
|
||||
preUninstall file("${buildDir}/control/rpm/prerm") |
|
||||
postUninstall file("${buildDir}/control/rpm/postrm") |
|
||||
|
|
||||
user pkgName |
|
||||
permissionGroup pkgName |
|
||||
|
|
||||
// Copy the system unit files |
|
||||
from("${buildDir}/control/${pkgName}.service") { |
|
||||
addParentDirs = false |
|
||||
fileMode 0644 |
|
||||
into "/usr/lib/systemd/system" |
|
||||
} |
|
||||
|
|
||||
directory(pkgLogFolder, 0755) |
|
||||
link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml") |
|
||||
link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf") |
|
||||
} |
|
||||
|
|
||||
// Same as the buildRpm task |
|
||||
buildDeb { |
|
||||
|
|
||||
arch = "all" |
|
||||
|
|
||||
archiveName = "${pkgName}.deb" |
|
||||
|
|
||||
requires("openjdk-8-jre").or("java8-runtime").or("oracle-java8-installer").or("openjdk-8-jre-headless") |
|
||||
|
|
||||
from("target/conf") { |
|
||||
include "${pkgName}.conf" |
|
||||
filter(ReplaceTokens, tokens: ['pkg.platform': 'deb']) |
|
||||
fileType CONFIG | NOREPLACE |
|
||||
fileMode 0754 |
|
||||
into "${pkgInstallFolder}/conf" |
|
||||
} |
|
||||
|
|
||||
configurationFile("${pkgInstallFolder}/conf/${pkgName}.conf") |
|
||||
configurationFile("${pkgInstallFolder}/conf/${pkgName}.yml") |
|
||||
configurationFile("${pkgInstallFolder}/conf/logback.xml") |
|
||||
|
|
||||
preInstall file("${buildDir}/control/deb/preinst") |
|
||||
postInstall file("${buildDir}/control/deb/postinst") |
|
||||
preUninstall file("${buildDir}/control/deb/prerm") |
|
||||
postUninstall file("${buildDir}/control/deb/postrm") |
|
||||
|
|
||||
user pkgName |
|
||||
permissionGroup pkgName |
|
||||
|
|
||||
directory(pkgLogFolder, 0755) |
|
||||
link("/etc/init.d/${pkgName}", "${pkgInstallFolder}/bin/${pkgName}.jar") |
|
||||
link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml") |
|
||||
link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf") |
|
||||
} |
|
||||
@ -1,71 +0,0 @@ |
|||||
<!-- |
|
||||
|
|
||||
Copyright © 2016-2020 The Thingsboard Authors |
|
||||
|
|
||||
Licensed 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. |
|
||||
|
|
||||
--> |
|
||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" |
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> |
|
||||
<id>windows</id> |
|
||||
|
|
||||
<formats> |
|
||||
<format>zip</format> |
|
||||
</formats> |
|
||||
|
|
||||
<!-- Workaround to create logs directory --> |
|
||||
<fileSets> |
|
||||
<fileSet> |
|
||||
<directory>${pkg.win.dist}</directory> |
|
||||
<outputDirectory>logs</outputDirectory> |
|
||||
<excludes> |
|
||||
<exclude>*/**</exclude> |
|
||||
</excludes> |
|
||||
</fileSet> |
|
||||
<fileSet> |
|
||||
<directory>${pkg.win.dist}/conf</directory> |
|
||||
<outputDirectory>conf</outputDirectory> |
|
||||
<lineEnding>windows</lineEnding> |
|
||||
</fileSet> |
|
||||
</fileSets> |
|
||||
|
|
||||
<files> |
|
||||
<file> |
|
||||
<source>${project.build.directory}/${project.build.finalName}-boot.${project.packaging}</source> |
|
||||
<outputDirectory>lib</outputDirectory> |
|
||||
<destName>${pkg.name}.jar</destName> |
|
||||
</file> |
|
||||
<file> |
|
||||
<source>${pkg.win.dist}/service.exe</source> |
|
||||
<outputDirectory/> |
|
||||
<destName>${pkg.name}.exe</destName> |
|
||||
</file> |
|
||||
<file> |
|
||||
<source>${pkg.win.dist}/service.xml</source> |
|
||||
<outputDirectory/> |
|
||||
<destName>${pkg.name}.xml</destName> |
|
||||
<lineEnding>windows</lineEnding> |
|
||||
</file> |
|
||||
<file> |
|
||||
<source>${pkg.win.dist}/install.bat</source> |
|
||||
<outputDirectory/> |
|
||||
<lineEnding>windows</lineEnding> |
|
||||
</file> |
|
||||
<file> |
|
||||
<source>${pkg.win.dist}/uninstall.bat</source> |
|
||||
<outputDirectory/> |
|
||||
<lineEnding>windows</lineEnding> |
|
||||
</file> |
|
||||
</files> |
|
||||
</assembly> |
|
||||
@ -1 +0,0 @@ |
|||||
pkg.logFolder=${pkg.unixLogFolder} |
|
||||
@ -1,2 +0,0 @@ |
|||||
pkg.logFolder=${BASE}\\logs |
|
||||
pkg.winWrapperLogFolder=%BASE%\\logs |
|
||||
@ -1,6 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
chown -R ${pkg.user}: ${pkg.logFolder} |
|
||||
chown -R ${pkg.user}: ${pkg.installFolder} |
|
||||
update-rc.d ${pkg.name} defaults |
|
||||
|
|
||||
@ -1,3 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
update-rc.d -f ${pkg.name} remove |
|
||||
@ -1,18 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
if ! getent group ${pkg.user} >/dev/null; then |
|
||||
addgroup --system ${pkg.user} |
|
||||
fi |
|
||||
|
|
||||
if ! getent passwd ${pkg.user} >/dev/null; then |
|
||||
adduser --quiet \ |
|
||||
--system \ |
|
||||
--ingroup ${pkg.user} \ |
|
||||
--quiet \ |
|
||||
--disabled-login \ |
|
||||
--disabled-password \ |
|
||||
--home ${pkg.installFolder} \ |
|
||||
--no-create-home \ |
|
||||
-gecos "Thingsboard application" \ |
|
||||
${pkg.user} |
|
||||
fi |
|
||||
@ -1,5 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
if [ -e /var/run/${pkg.name}/${pkg.name}.pid ]; then |
|
||||
service ${pkg.name} stop |
|
||||
fi |
|
||||
@ -1,6 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
if [ $1 -ge 1 ] ; then |
|
||||
# Package upgrade, not uninstall |
|
||||
systemctl try-restart ${pkg.name}.service >/dev/null 2>&1 || : |
|
||||
fi |
|
||||
@ -1,6 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
getent group ${pkg.user} >/dev/null || groupadd -r ${pkg.user} |
|
||||
getent passwd ${pkg.user} >/dev/null || \ |
|
||||
useradd -d ${pkg.installFolder} -g ${pkg.user} -M -r ${pkg.user} -s /sbin/nologin \ |
|
||||
-c "Thingsboard application" |
|
||||
@ -1,6 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
|
|
||||
if [ $1 -eq 0 ] ; then |
|
||||
# Package removal, not upgrade |
|
||||
systemctl --no-reload disable --now ${pkg.name}.service > /dev/null 2>&1 || : |
|
||||
fi |
|
||||
@ -1,11 +0,0 @@ |
|||||
[Unit] |
|
||||
Description=${pkg.name} |
|
||||
After=syslog.target |
|
||||
|
|
||||
[Service] |
|
||||
User=${pkg.user} |
|
||||
ExecStart=${pkg.installFolder}/bin/${pkg.name}.jar |
|
||||
SuccessExitStatus=143 |
|
||||
|
|
||||
[Install] |
|
||||
WantedBy=multi-user.target |
|
||||
@ -1,31 +0,0 @@ |
|||||
@ECHO OFF |
|
||||
|
|
||||
setlocal ENABLEEXTENSIONS |
|
||||
|
|
||||
@ECHO Detecting Java version installed. |
|
||||
:CHECK_JAVA |
|
||||
for /f tokens^=2-5^ delims^=.-_^" %%j in ('java -fullversion 2^>^&1') do set "jver=%%j%%k" |
|
||||
@ECHO CurrentVersion %jver% |
|
||||
|
|
||||
if %jver% NEQ 18 GOTO JAVA_NOT_INSTALLED |
|
||||
|
|
||||
:JAVA_INSTALLED |
|
||||
|
|
||||
@ECHO Java 1.8 found! |
|
||||
@ECHO Installing ${pkg.name} ... |
|
||||
|
|
||||
"%BASE%"${pkg.name}.exe install |
|
||||
|
|
||||
@ECHO ${pkg.name} installed successfully! |
|
||||
|
|
||||
GOTO END |
|
||||
|
|
||||
:JAVA_NOT_INSTALLED |
|
||||
@ECHO Java 1.8 is not installed. Only Java 1.8 is supported |
|
||||
@ECHO Please go to https://adoptopenjdk.net/index.html and install Java 1.8. Then retry installation. |
|
||||
PAUSE |
|
||||
GOTO END |
|
||||
|
|
||||
:END |
|
||||
|
|
||||
|
|
||||
@ -1,36 +0,0 @@ |
|||||
<service> |
|
||||
<id>${pkg.name}</id> |
|
||||
<name>${project.name}</name> |
|
||||
<description>${project.description}</description> |
|
||||
<workingdirectory>%BASE%\conf</workingdirectory> |
|
||||
<logpath>${pkg.winWrapperLogFolder}</logpath> |
|
||||
<logmode>rotate</logmode> |
|
||||
<env name="LOADER_PATH" value="%BASE%\conf" /> |
|
||||
<executable>java</executable> |
|
||||
<startargument>-Xloggc:%BASE%\logs\gc.log</startargument> |
|
||||
<startargument>-XX:+HeapDumpOnOutOfMemoryError</startargument> |
|
||||
<startargument>-XX:+PrintGCDetails</startargument> |
|
||||
<startargument>-XX:+PrintGCDateStamps</startargument> |
|
||||
<startargument>-XX:+PrintHeapAtGC</startargument> |
|
||||
<startargument>-XX:+PrintTenuringDistribution</startargument> |
|
||||
<startargument>-XX:+PrintGCApplicationStoppedTime</startargument> |
|
||||
<startargument>-XX:+UseGCLogFileRotation</startargument> |
|
||||
<startargument>-XX:NumberOfGCLogFiles=10</startargument> |
|
||||
<startargument>-XX:GCLogFileSize=10M</startargument> |
|
||||
<startargument>-XX:-UseBiasedLocking</startargument> |
|
||||
<startargument>-XX:+UseTLAB</startargument> |
|
||||
<startargument>-XX:+ResizeTLAB</startargument> |
|
||||
<startargument>-XX:+PerfDisableSharedMem</startargument> |
|
||||
<startargument>-XX:+UseCondCardMark</startargument> |
|
||||
<startargument>-XX:CMSWaitDuration=10000</startargument> |
|
||||
<startargument>-XX:+UseParNewGC</startargument> |
|
||||
<startargument>-XX:+UseConcMarkSweepGC</startargument> |
|
||||
<startargument>-XX:+CMSParallelRemarkEnabled</startargument> |
|
||||
<startargument>-XX:+CMSParallelInitialMarkEnabled</startargument> |
|
||||
<startargument>-XX:+CMSEdenChunksRecordAlways</startargument> |
|
||||
<startargument>-XX:CMSInitiatingOccupancyFraction=75</startargument> |
|
||||
<startargument>-XX:+UseCMSInitiatingOccupancyOnly</startargument> |
|
||||
<startargument>-jar</startargument> |
|
||||
<startargument>%BASE%\lib\${pkg.name}.jar</startargument> |
|
||||
|
|
||||
</service> |
|
||||
@ -1,9 +0,0 @@ |
|||||
@ECHO OFF |
|
||||
|
|
||||
@ECHO Stopping ${pkg.name} ... |
|
||||
net stop ${pkg.name} |
|
||||
|
|
||||
@ECHO Uninstalling ${pkg.name} ... |
|
||||
"%~dp0"${pkg.name}.exe uninstall |
|
||||
|
|
||||
@ECHO DONE. |
|
||||
@ -1,140 +0,0 @@ |
|||||
/** |
|
||||
* Copyright © 2016-2020 The Thingsboard Authors |
|
||||
* |
|
||||
* Licensed 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. |
|
||||
*/ |
|
||||
import org.apache.tools.ant.filters.ReplaceTokens |
|
||||
|
|
||||
buildscript { |
|
||||
ext { |
|
||||
osPackageVersion = "3.8.0" |
|
||||
} |
|
||||
repositories { |
|
||||
jcenter() |
|
||||
} |
|
||||
dependencies { |
|
||||
classpath("com.netflix.nebula:gradle-ospackage-plugin:${osPackageVersion}") |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
apply plugin: "nebula.ospackage" |
|
||||
|
|
||||
buildDir = projectBuildDir |
|
||||
version = projectVersion |
|
||||
distsDirName = "./" |
|
||||
|
|
||||
// OS Package plugin configuration |
|
||||
ospackage { |
|
||||
packageName = pkgName |
|
||||
version = "${project.version}" |
|
||||
release = 1 |
|
||||
os = LINUX |
|
||||
type = BINARY |
|
||||
|
|
||||
into pkgInstallFolder |
|
||||
|
|
||||
user pkgName |
|
||||
permissionGroup pkgName |
|
||||
|
|
||||
// Copy the actual .jar file |
|
||||
from(mainJar) { |
|
||||
// Strip the version from the jar filename |
|
||||
rename { String fileName -> |
|
||||
"${pkgName}.jar" |
|
||||
} |
|
||||
fileMode 0500 |
|
||||
into "bin" |
|
||||
} |
|
||||
|
|
||||
// Copy the config files |
|
||||
from("target/conf") { |
|
||||
exclude "${pkgName}.conf" |
|
||||
fileType CONFIG | NOREPLACE |
|
||||
fileMode 0754 |
|
||||
into "conf" |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
// Configure our RPM build task |
|
||||
buildRpm { |
|
||||
|
|
||||
arch = NOARCH |
|
||||
|
|
||||
version = projectVersion.replace('-', '') |
|
||||
archiveName = "${pkgName}.rpm" |
|
||||
|
|
||||
requires("java-1.8.0") |
|
||||
|
|
||||
from("target/conf") { |
|
||||
include "${pkgName}.conf" |
|
||||
filter(ReplaceTokens, tokens: ['pkg.platform': 'rpm']) |
|
||||
fileType CONFIG | NOREPLACE |
|
||||
fileMode 0754 |
|
||||
into "${pkgInstallFolder}/conf" |
|
||||
} |
|
||||
|
|
||||
preInstall file("${buildDir}/control/rpm/preinst") |
|
||||
postInstall file("${buildDir}/control/rpm/postinst") |
|
||||
preUninstall file("${buildDir}/control/rpm/prerm") |
|
||||
postUninstall file("${buildDir}/control/rpm/postrm") |
|
||||
|
|
||||
user pkgName |
|
||||
permissionGroup pkgName |
|
||||
|
|
||||
// Copy the system unit files |
|
||||
from("${buildDir}/control/${pkgName}.service") { |
|
||||
addParentDirs = false |
|
||||
fileMode 0644 |
|
||||
into "/usr/lib/systemd/system" |
|
||||
} |
|
||||
|
|
||||
directory(pkgLogFolder, 0755) |
|
||||
link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml") |
|
||||
link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf") |
|
||||
} |
|
||||
|
|
||||
// Same as the buildRpm task |
|
||||
buildDeb { |
|
||||
|
|
||||
arch = "all" |
|
||||
|
|
||||
archiveName = "${pkgName}.deb" |
|
||||
|
|
||||
requires("openjdk-8-jre").or("java8-runtime").or("oracle-java8-installer").or("openjdk-8-jre-headless") |
|
||||
|
|
||||
from("target/conf") { |
|
||||
include "${pkgName}.conf" |
|
||||
filter(ReplaceTokens, tokens: ['pkg.platform': 'deb']) |
|
||||
fileType CONFIG | NOREPLACE |
|
||||
fileMode 0754 |
|
||||
into "${pkgInstallFolder}/conf" |
|
||||
} |
|
||||
|
|
||||
configurationFile("${pkgInstallFolder}/conf/${pkgName}.conf") |
|
||||
configurationFile("${pkgInstallFolder}/conf/${pkgName}.yml") |
|
||||
configurationFile("${pkgInstallFolder}/conf/logback.xml") |
|
||||
|
|
||||
preInstall file("${buildDir}/control/deb/preinst") |
|
||||
postInstall file("${buildDir}/control/deb/postinst") |
|
||||
preUninstall file("${buildDir}/control/deb/prerm") |
|
||||
postUninstall file("${buildDir}/control/deb/postrm") |
|
||||
|
|
||||
user pkgName |
|
||||
permissionGroup pkgName |
|
||||
|
|
||||
directory(pkgLogFolder, 0755) |
|
||||
link("/etc/init.d/${pkgName}", "${pkgInstallFolder}/bin/${pkgName}.jar") |
|
||||
link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml") |
|
||||
link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf") |
|
||||
} |
|
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue