TB-65: ThingsBoard install/upgrade support for windows distribution.

This commit is contained in:
Igor Kulikov 2017-07-05 10:16:48 +03:00
parent 2441cc0ee9
commit 6356fc56ba
4 changed files with 107 additions and 2 deletions

View File

@ -417,6 +417,28 @@
</filters> </filters>
</configuration> </configuration>
</execution> </execution>
<execution>
<id>copy-windows-install</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${pkg.win.dist}/install</outputDirectory>
<resources>
<resource>
<directory>src/main/scripts/install</directory>
<includes>
<include>logback.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<filters>
<filter>src/main/filters/windows.properties</filter>
</filters>
</configuration>
</execution>
<execution> <execution>
<id>copy-data</id> <id>copy-data</id>
<phase>process-resources</phase> <phase>process-resources</phase>
@ -503,6 +525,9 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<configuration> <configuration>
<excludes>
<exclude>**/logback.xml</exclude>
</excludes>
<archive> <archive>
<manifestEntries> <manifestEntries>
<Implementation-Title>ThingsBoard</Implementation-Title> <Implementation-Title>ThingsBoard</Implementation-Title>

View File

@ -33,6 +33,11 @@
<exclude>*/**</exclude> <exclude>*/**</exclude>
</excludes> </excludes>
</fileSet> </fileSet>
<fileSet>
<directory>${pkg.win.dist}/install</directory>
<outputDirectory>install</outputDirectory>
<lineEnding>windows</lineEnding>
</fileSet>
<fileSet> <fileSet>
<directory>${pkg.win.dist}/conf</directory> <directory>${pkg.win.dist}/conf</directory>
<outputDirectory>conf</outputDirectory> <outputDirectory>conf</outputDirectory>
@ -75,5 +80,10 @@
<outputDirectory/> <outputDirectory/>
<lineEnding>windows</lineEnding> <lineEnding>windows</lineEnding>
</file> </file>
<file>
<source>${pkg.win.dist}/upgrade.bat</source>
<outputDirectory/>
<lineEnding>windows</lineEnding>
</file>
</files> </files>
</assembly> </assembly>

View File

@ -69,9 +69,34 @@ IF "%JRE_PATH2%" == "" GOTO JAVA_NOT_INSTALLED
@ECHO Java 1.8 found! @ECHO Java 1.8 found!
@ECHO Installing ${pkg.name} ... @ECHO Installing ${pkg.name} ...
%~dp0${pkg.name}.exe install
@ECHO DONE. SET loadDemo=false
if "%1" == "--loadDemo" (
SET loadDemo=true
)
SET BASE=%~dp0
SET LOADER_PATH=%BASE%\conf,%BASE%\extensions
SET jarfile=%BASE%\lib\${pkg.name}.jar
SET installDir=%BASE%\data
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!
exit /b %errorlevel%
)
%BASE%${pkg.name}.exe install
@ECHO ThingsBoard installed successfully!
GOTO END GOTO END

View File

@ -0,0 +1,45 @@
@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 jarfile=%BASE%\lib\${pkg.name}.jar
SET installDir=%BASE%\data
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!
exit /b %errorlevel%
)
@ECHO ThingsBoard upgraded successfully!
GOTO END
:END