Merge pull request #198 from thingsboard/feature/TB-65

TB-65: ThingsBoard installation and upgrade support
This commit is contained in:
Igor Kulikov 2017-07-05 11:15:48 +03:00 committed by GitHub
commit 2543063e4a
4 changed files with 107 additions and 2 deletions

View File

@ -417,6 +417,28 @@
</filters>
</configuration>
</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>
<id>copy-data</id>
<phase>process-resources</phase>
@ -503,6 +525,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/logback.xml</exclude>
</excludes>
<archive>
<manifestEntries>
<Implementation-Title>ThingsBoard</Implementation-Title>

View File

@ -33,6 +33,11 @@
<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>
@ -75,5 +80,10 @@
<outputDirectory/>
<lineEnding>windows</lineEnding>
</file>
<file>
<source>${pkg.win.dist}/upgrade.bat</source>
<outputDirectory/>
<lineEnding>windows</lineEnding>
</file>
</files>
</assembly>

View File

@ -69,9 +69,34 @@ IF "%JRE_PATH2%" == "" GOTO JAVA_NOT_INSTALLED
@ECHO Java 1.8 found!
@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

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