first-fix
This commit is contained in:
1 parent
6d87c1edc8
commit
565d9d673a
6284 files changed
+820267
-76
No files matched your search
@@ -0,0 +1,89 @@
|
||||
<!--
|
||||
|
||||
Copyright © 2016-2023 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}/install</directory>
|
||||
<outputDirectory>install</outputDirectory>
|
||||
<lineEnding>windows</lineEnding>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${pkg.win.dist}/conf</directory>
|
||||
<outputDirectory>conf</outputDirectory>
|
||||
<lineEnding>windows</lineEnding>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.build.directory}/extensions</directory>
|
||||
<outputDirectory>extensions</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.build.directory}/data</directory>
|
||||
<outputDirectory>data</outputDirectory>
|
||||
</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>
|
||||
<file>
|
||||
<source>${pkg.win.dist}/upgrade.bat</source>
|
||||
<outputDirectory/>
|
||||
<lineEnding>windows</lineEnding>
|
||||
</file>
|
||||
</files>
|
||||
</assembly>
|
||||
@@ -0,0 +1,169 @@
|
||||
/**
|
||||
* Copyright © 2016-2023 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
|
||||
|
||||
plugins {
|
||||
id "nebula.ospackage" version "8.6.3"
|
||||
}
|
||||
|
||||
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 actual .jar file
|
||||
from(mainJar) {
|
||||
// Strip the version from the jar filename
|
||||
rename { String fileName ->
|
||||
"${pkgName}.jar"
|
||||
}
|
||||
fileMode 0500
|
||||
into "bin"
|
||||
}
|
||||
|
||||
if("${pkgCopyInstallScripts}".equalsIgnoreCase("true")) {
|
||||
// Copy the install files
|
||||
from("${buildDir}/bin/install/install.sh") {
|
||||
fileMode 0775
|
||||
into "bin/install"
|
||||
}
|
||||
|
||||
from("${buildDir}/bin/install/upgrade.sh") {
|
||||
fileMode 0775
|
||||
into "bin/install"
|
||||
}
|
||||
|
||||
from("${buildDir}/bin/install/logback.xml") {
|
||||
into "bin/install"
|
||||
}
|
||||
}
|
||||
|
||||
// Copy the config files
|
||||
from("${buildDir}/conf") {
|
||||
exclude "${pkgName}.conf"
|
||||
fileType CONFIG | NOREPLACE
|
||||
fileMode 0754
|
||||
into "conf"
|
||||
}
|
||||
|
||||
// Copy the data files
|
||||
from("${buildDir}/data") {
|
||||
fileType CONFIG | NOREPLACE
|
||||
fileMode 0754
|
||||
into "data"
|
||||
}
|
||||
|
||||
// Copy the extensions files
|
||||
from("${buildDir}/extensions") {
|
||||
into "extensions"
|
||||
}
|
||||
}
|
||||
|
||||
// Configure our RPM build task
|
||||
buildRpm {
|
||||
|
||||
arch = NOARCH
|
||||
|
||||
archiveVersion = projectVersion.replace('-', '')
|
||||
archiveFileName = "${pkgName}.rpm"
|
||||
|
||||
requires("java-11")
|
||||
|
||||
from("${buildDir}/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 pkgUser
|
||||
permissionGroup pkgUser
|
||||
|
||||
// Copy the system unit files
|
||||
from("${buildDir}/control/template.service") {
|
||||
addParentDirs = false
|
||||
fileMode 0644
|
||||
into "/usr/lib/systemd/system"
|
||||
rename { String filename ->
|
||||
"${pkgName}.service"
|
||||
}
|
||||
}
|
||||
|
||||
link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml")
|
||||
link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
|
||||
}
|
||||
|
||||
// Same as the buildRpm task
|
||||
buildDeb {
|
||||
|
||||
arch = "all"
|
||||
|
||||
archiveFileName = "${pkgName}.deb"
|
||||
|
||||
requires("openjdk-11-jre").or("java11-runtime").or("oracle-java11-installer").or("openjdk-11-jre-headless")
|
||||
|
||||
from("${buildDir}/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")
|
||||
configurationFile("${pkgInstallFolder}/conf/actor-system.conf")
|
||||
|
||||
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
|
||||
|
||||
// Copy the system unit files
|
||||
from("${buildDir}/control/template.service") {
|
||||
addParentDirs = false
|
||||
fileMode 0644
|
||||
into "/lib/systemd/system"
|
||||
rename { String filename ->
|
||||
"${pkgName}.service"
|
||||
}
|
||||
}
|
||||
|
||||
link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml")
|
||||
link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
pkg.logFolder=${pkg.unixLogFolder}
|
||||
@@ -0,0 +1,2 @@
|
||||
pkg.logFolder=${BASE}\\logs
|
||||
pkg.winWrapperLogFolder=%BASE%\\logs
|
||||
Binary file not shown.
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
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 || :
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
systemctl --no-reload disable --now ${pkg.name}.service > /dev/null 2>&1 || :
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
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
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ -e /var/run/${pkg.name}/${pkg.name}.pid ]; then
|
||||
service ${pkg.name} stop
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
mkdir -m 0755 -p ${pkg.logFolder}
|
||||
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
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $1 -ge 1 ] ; then
|
||||
# Package upgrade, not uninstall
|
||||
systemctl try-restart ${pkg.name}.service >/dev/null 2>&1 || :
|
||||
fi
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/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"
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $1 -eq 0 ] ; then
|
||||
# Package removal, not upgrade
|
||||
systemctl --no-reload disable --now ${pkg.name}.service > /dev/null 2>&1 || :
|
||||
fi
|
||||
@@ -0,0 +1,11 @@
|
||||
[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
|
||||
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright © 2016-2023 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.
|
||||
#
|
||||
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
--loadDemo)
|
||||
LOAD_DEMO=true
|
||||
shift # past argument
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
shift # past argument or value
|
||||
done
|
||||
|
||||
if [ "$LOAD_DEMO" == "true" ]; then
|
||||
loadDemo=true
|
||||
else
|
||||
loadDemo=false
|
||||
fi
|
||||
|
||||
CONF_FOLDER=${pkg.installFolder}/conf
|
||||
configfile=${pkg.name}.conf
|
||||
jarfile=${pkg.installFolder}/bin/${pkg.name}.jar
|
||||
installDir=${pkg.installFolder}/data
|
||||
|
||||
source "${CONF_FOLDER}/${configfile}"
|
||||
|
||||
run_user=${pkg.user}
|
||||
|
||||
su -s /bin/sh -c "java -cp ${jarfile} $JAVA_OPTS -Dloader.main=org.thingsboard.server.ThingsboardInstallApplication \
|
||||
-Dinstall.data_dir=${installDir} \
|
||||
-Dinstall.load_demo=${loadDemo} \
|
||||
-Dspring.jpa.hibernate.ddl-auto=none \
|
||||
-Dinstall.upgrade=false \
|
||||
-Dlogging.config=${pkg.installFolder}/bin/install/logback.xml \
|
||||
org.springframework.boot.loader.PropertiesLauncher" "$run_user"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ThingsBoard installation failed!"
|
||||
else
|
||||
echo "ThingsBoard installed successfully!"
|
||||
fi
|
||||
|
||||
exit $?
|
||||
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright © 2016-2023 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.
|
||||
#
|
||||
|
||||
|
||||
BASE=${project.basedir}/target
|
||||
CONF_FOLDER=${BASE}/conf
|
||||
jarfile="${BASE}/thingsboard-${project.version}-boot.jar"
|
||||
installDir=${BASE}/data
|
||||
loadDemo=true
|
||||
|
||||
|
||||
export JAVA_OPTS="$JAVA_OPTS -Dplatform=@pkg.platform@"
|
||||
export LOADER_PATH=${BASE}/conf,${BASE}/extensions
|
||||
export SQL_DATA_FOLDER=${SQL_DATA_FOLDER:-/tmp}
|
||||
|
||||
|
||||
run_user="$USER"
|
||||
|
||||
sudo -u "$run_user" -s /bin/sh -c "java -cp ${jarfile} $JAVA_OPTS -Dloader.main=org.thingsboard.server.ThingsboardInstallApplication \
|
||||
-Dinstall.data_dir=${installDir} \
|
||||
-Dinstall.load_demo=${loadDemo} \
|
||||
-Dspring.jpa.hibernate.ddl-auto=none \
|
||||
-Dinstall.upgrade=false \
|
||||
-Dlogging.config=logback.xml \
|
||||
org.springframework.boot.loader.PropertiesLauncher"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ThingsBoard DB installation failed!"
|
||||
else
|
||||
echo "ThingsBoard DB installed successfully!"
|
||||
fi
|
||||
|
||||
exit $?
|
||||
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!--
|
||||
|
||||
Copyright © 2016-2023 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.
|
||||
|
||||
-->
|
||||
<!DOCTYPE configuration>
|
||||
<configuration>
|
||||
|
||||
<appender name="fileLogAppender"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${pkg.logFolder}/install.log</file>
|
||||
<rollingPolicy
|
||||
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${pkg.logFolder}/install.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
<totalSizeCap>3GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org.thingsboard.server.install" level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.thingsboard.server.service.install" level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.thingsboard.server.ThingsboardInstallApplication" level="ERROR">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.apache.tomcat.jdbc.pool" level="ERROR">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.thingsboard.server.config.jwt" level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.thingsboard.server" level="INFO" />
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="fileLogAppender"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright © 2016-2023 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.
|
||||
#
|
||||
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
--fromVersion=*)
|
||||
FROM_VERSION="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "${FROM_VERSION// }" ]]; then
|
||||
echo "--fromVersion parameter is invalid or unspecified!"
|
||||
echo "Usage: upgrade.sh --fromVersion={VERSION}"
|
||||
exit 1
|
||||
else
|
||||
fromVersion="${FROM_VERSION// }"
|
||||
fi
|
||||
|
||||
CONF_FOLDER=${pkg.installFolder}/conf
|
||||
configfile=${pkg.name}.conf
|
||||
jarfile=${pkg.installFolder}/bin/${pkg.name}.jar
|
||||
installDir=${pkg.installFolder}/data
|
||||
|
||||
source "${CONF_FOLDER}/${configfile}"
|
||||
|
||||
run_user=${pkg.user}
|
||||
|
||||
su -s /bin/sh -c "java -cp ${jarfile} $JAVA_OPTS -Dloader.main=org.thingsboard.server.ThingsboardInstallApplication \
|
||||
-Dinstall.data_dir=${installDir} \
|
||||
-Dspring.jpa.hibernate.ddl-auto=none \
|
||||
-Dinstall.upgrade=true \
|
||||
-Dinstall.upgrade.from_version=${fromVersion} \
|
||||
-Dlogging.config=${pkg.installFolder}/bin/install/logback.xml \
|
||||
org.springframework.boot.loader.PropertiesLauncher" "$run_user"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ThingsBoard upgrade failed!"
|
||||
else
|
||||
echo "ThingsBoard upgraded successfully!"
|
||||
fi
|
||||
|
||||
exit $?
|
||||
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright © 2016-2023 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.
|
||||
#
|
||||
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
--fromVersion=*)
|
||||
FROM_VERSION="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "${FROM_VERSION// }" ]]; then
|
||||
echo "--fromVersion parameter is invalid or unspecified!"
|
||||
echo "Usage: upgrade_dev_db.sh --fromVersion={VERSION}"
|
||||
exit 1
|
||||
else
|
||||
fromVersion="${FROM_VERSION// }"
|
||||
fi
|
||||
|
||||
BASE=${project.basedir}/target
|
||||
CONF_FOLDER=${BASE}/conf
|
||||
jarfile="${BASE}/thingsboard-${project.version}-boot.jar"
|
||||
installDir=${BASE}/data
|
||||
loadDemo=true
|
||||
|
||||
|
||||
export JAVA_OPTS="$JAVA_OPTS -Dplatform=@pkg.platform@"
|
||||
export LOADER_PATH=${BASE}/conf,${BASE}/extensions
|
||||
export SQL_DATA_FOLDER=${SQL_DATA_FOLDER:-/tmp}
|
||||
|
||||
|
||||
run_user="$USER"
|
||||
|
||||
sudo -u "$run_user" -s /bin/sh -c "java -cp ${jarfile} $JAVA_OPTS -Dloader.main=org.thingsboard.server.ThingsboardInstallApplication \
|
||||
-Dinstall.data_dir=${installDir} \
|
||||
-Dinstall.load_demo=${loadDemo} \
|
||||
-Dspring.jpa.hibernate.ddl-auto=none \
|
||||
-Dinstall.upgrade=true \
|
||||
-Dinstall.upgrade.from_version=${fromVersion} \
|
||||
-Dlogging.config=logback.xml \
|
||||
org.springframework.boot.loader.PropertiesLauncher"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ThingsBoard DB installation failed!"
|
||||
else
|
||||
echo "ThingsBoard DB installed successfully!"
|
||||
fi
|
||||
|
||||
exit $?
|
||||
@@ -0,0 +1,58 @@
|
||||
@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 110 GOTO JAVA_NOT_INSTALLED
|
||||
|
||||
:JAVA_INSTALLED
|
||||
|
||||
@ECHO Java 11 found!
|
||||
@ECHO Installing thingsboard ...
|
||||
|
||||
SET loadDemo=false
|
||||
|
||||
if "%1" == "--loadDemo" (
|
||||
SET loadDemo=true
|
||||
)
|
||||
|
||||
SET BASE=%~dp0
|
||||
SET LOADER_PATH=%BASE%\conf,%BASE%\extensions
|
||||
SET SQL_DATA_FOLDER=%BASE%\data\sql
|
||||
SET jarfile=%BASE%\lib\thingsboard.jar
|
||||
SET installDir=%BASE%\data
|
||||
|
||||
PUSHD "%BASE%\conf"
|
||||
|
||||
java -cp "%jarfile%" -Dloader.main=org.thingsboard.server.ThingsboardInstallApplication^
|
||||
-Dinstall.data_dir="%installDir%"^
|
||||
-Dinstall.load_demo=%loadDemo%^
|
||||
-Dspring.jpa.hibernate.ddl-auto=none^
|
||||
-Dinstall.upgrade=false^
|
||||
-Dlogging.config="%BASE%\install\logback.xml"^
|
||||
org.springframework.boot.loader.PropertiesLauncher
|
||||
|
||||
if errorlevel 1 (
|
||||
@echo ThingsBoard installation failed!
|
||||
POPD
|
||||
exit /b %errorlevel%
|
||||
)
|
||||
POPD
|
||||
|
||||
"%BASE%"thingsboard.exe install
|
||||
|
||||
@ECHO ThingsBoard installed successfully!
|
||||
|
||||
GOTO END
|
||||
|
||||
:JAVA_NOT_INSTALLED
|
||||
@ECHO Java 11 is not installed. Only Java 11 is supported
|
||||
@ECHO Please go to https://adoptopenjdk.net/index.html and install Java 11. Then retry installation.
|
||||
PAUSE
|
||||
GOTO END
|
||||
|
||||
:END
|
||||
@@ -0,0 +1,29 @@
|
||||
@ECHO OFF
|
||||
|
||||
setlocal ENABLEEXTENSIONS
|
||||
|
||||
SET BASE=${project.basedir}\target
|
||||
SET LOADER_PATH=%BASE%\conf,%BASE%\extensions
|
||||
|
||||
SET jarfile=%BASE%\thingsboard-${project.version}-boot.jar
|
||||
SET installDir=%BASE%\data
|
||||
SET loadDemo=true
|
||||
|
||||
IF "%SQL_DATA_FOLDER%" == "" (
|
||||
SET SQL_DATA_FOLDER=/tmp
|
||||
)
|
||||
|
||||
java -cp %jarfile% -Dloader.main=org.thingsboard.server.ThingsboardInstallApplication^
|
||||
-Dinstall.data_dir=%installDir%^
|
||||
-Dinstall.load_demo=%loadDemo%^
|
||||
-Dspring.jpa.hibernate.ddl-auto=none^
|
||||
-Dinstall.upgrade=false^
|
||||
-Dlogging.config=%BASE%\windows\install\logback.xml^
|
||||
org.springframework.boot.loader.PropertiesLauncher
|
||||
|
||||
if errorlevel 1 (
|
||||
@echo ThingsBoard DB installation failed!
|
||||
POPD
|
||||
exit /b %errorlevel%
|
||||
)
|
||||
@echo ThingsBoard DB installed successfully!
|
||||
@@ -0,0 +1,30 @@
|
||||
<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,%BASE%\extensions" />
|
||||
<env name="SQL_DATA_FOLDER" value="%BASE%\data\sql" />
|
||||
<executable>java</executable>
|
||||
<startargument>-Dplatform=windows</startargument>
|
||||
<startargument>-Dinstall.data_dir=%BASE%\data</startargument>
|
||||
<startargument>-Xlog:gc*,heap*,age*,safepoint=debug:file=%BASE%\logs\gc.log:time,uptime,level,tags:filecount=10,filesize=10M</startargument>
|
||||
<startargument>-XX:+HeapDumpOnOutOfMemoryError</startargument>
|
||||
<startargument>-XX:-UseBiasedLocking</startargument>
|
||||
<startargument>-XX:+UseTLAB</startargument>
|
||||
<startargument>-XX:+ResizeTLAB</startargument>
|
||||
<startargument>-XX:+PerfDisableSharedMem</startargument>
|
||||
<startargument>-XX:+UseCondCardMark</startargument>
|
||||
<startargument>-XX:+UseG1GC</startargument>
|
||||
<startargument>-XX:MaxGCPauseMillis=500</startargument>
|
||||
<startargument>-XX:+UseStringDeduplication</startargument>
|
||||
<startargument>-XX:+ParallelRefProcEnabled</startargument>
|
||||
<startargument>-XX:MaxTenuringThreshold=10</startargument>
|
||||
<startargument>-Xms512m</startargument>
|
||||
<startargument>-Xmx1024m</startargument>
|
||||
<startargument>-jar</startargument>
|
||||
<startargument>%BASE%\lib\${pkg.name}.jar</startargument>
|
||||
|
||||
</service>
|
||||
@@ -0,0 +1,9 @@
|
||||
@ECHO OFF
|
||||
|
||||
@ECHO Stopping ${pkg.name} ...
|
||||
net stop ${pkg.name}
|
||||
|
||||
@ECHO Uninstalling ${pkg.name} ...
|
||||
"%~dp0"${pkg.name}.exe uninstall
|
||||
|
||||
@ECHO DONE.
|
||||
@@ -0,0 +1,50 @@
|
||||
@ECHO OFF
|
||||
|
||||
setlocal ENABLEEXTENSIONS
|
||||
|
||||
@ECHO Upgrading ${pkg.name} ...
|
||||
|
||||
SET BASE=%~dp0
|
||||
|
||||
:loop
|
||||
IF NOT "%1"=="" (
|
||||
IF "%1"=="--fromVersion" (
|
||||
SET fromVersion=%2
|
||||
)
|
||||
SHIFT
|
||||
GOTO :loop
|
||||
)
|
||||
|
||||
if not defined fromVersion (
|
||||
echo "--fromVersion parameter is invalid or unspecified!"
|
||||
echo "Usage: upgrade.bat --fromVersion {VERSION}"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
SET LOADER_PATH=%BASE%\conf,%BASE%\extensions
|
||||
SET SQL_DATA_FOLDER=%BASE%\data\sql
|
||||
SET jarfile=%BASE%\lib\${pkg.name}.jar
|
||||
SET installDir=%BASE%\data
|
||||
|
||||
PUSHD "%BASE%\conf"
|
||||
|
||||
java -cp "%jarfile%" -Dloader.main=org.thingsboard.server.ThingsboardInstallApplication^
|
||||
-Dinstall.data_dir="%installDir%"^
|
||||
-Dspring.jpa.hibernate.ddl-auto=none^
|
||||
-Dinstall.upgrade=true^
|
||||
-Dinstall.upgrade.from_version=%fromVersion%^
|
||||
-Dlogging.config="%BASE%\install\logback.xml"^
|
||||
org.springframework.boot.loader.PropertiesLauncher
|
||||
|
||||
if errorlevel 1 (
|
||||
@echo ThingsBoard upgrade failed!
|
||||
POPD
|
||||
exit /b %errorlevel%
|
||||
)
|
||||
POPD
|
||||
|
||||
@ECHO ThingsBoard upgraded successfully!
|
||||
|
||||
GOTO END
|
||||
|
||||
:END
|
||||
Reference in new issue
Block a user