Commit 2543063e4afc1e6346e7c88c9617b1d07d4650f5
Committed by
GitHub
Merge pull request #198 from thingsboard/feature/TB-65
TB-65: ThingsBoard installation and upgrade support
Showing
4 changed files
with
107 additions
and
2 deletions
@@ -418,6 +418,28 @@ | @@ -418,6 +418,28 @@ | ||
418 | </configuration> | 418 | </configuration> |
419 | </execution> | 419 | </execution> |
420 | <execution> | 420 | <execution> |
421 | + <id>copy-windows-install</id> | ||
422 | + <phase>process-resources</phase> | ||
423 | + <goals> | ||
424 | + <goal>copy-resources</goal> | ||
425 | + </goals> | ||
426 | + <configuration> | ||
427 | + <outputDirectory>${pkg.win.dist}/install</outputDirectory> | ||
428 | + <resources> | ||
429 | + <resource> | ||
430 | + <directory>src/main/scripts/install</directory> | ||
431 | + <includes> | ||
432 | + <include>logback.xml</include> | ||
433 | + </includes> | ||
434 | + <filtering>true</filtering> | ||
435 | + </resource> | ||
436 | + </resources> | ||
437 | + <filters> | ||
438 | + <filter>src/main/filters/windows.properties</filter> | ||
439 | + </filters> | ||
440 | + </configuration> | ||
441 | + </execution> | ||
442 | + <execution> | ||
421 | <id>copy-data</id> | 443 | <id>copy-data</id> |
422 | <phase>process-resources</phase> | 444 | <phase>process-resources</phase> |
423 | <goals> | 445 | <goals> |
@@ -503,6 +525,9 @@ | @@ -503,6 +525,9 @@ | ||
503 | <groupId>org.apache.maven.plugins</groupId> | 525 | <groupId>org.apache.maven.plugins</groupId> |
504 | <artifactId>maven-jar-plugin</artifactId> | 526 | <artifactId>maven-jar-plugin</artifactId> |
505 | <configuration> | 527 | <configuration> |
528 | + <excludes> | ||
529 | + <exclude>**/logback.xml</exclude> | ||
530 | + </excludes> | ||
506 | <archive> | 531 | <archive> |
507 | <manifestEntries> | 532 | <manifestEntries> |
508 | <Implementation-Title>ThingsBoard</Implementation-Title> | 533 | <Implementation-Title>ThingsBoard</Implementation-Title> |
@@ -34,6 +34,11 @@ | @@ -34,6 +34,11 @@ | ||
34 | </excludes> | 34 | </excludes> |
35 | </fileSet> | 35 | </fileSet> |
36 | <fileSet> | 36 | <fileSet> |
37 | + <directory>${pkg.win.dist}/install</directory> | ||
38 | + <outputDirectory>install</outputDirectory> | ||
39 | + <lineEnding>windows</lineEnding> | ||
40 | + </fileSet> | ||
41 | + <fileSet> | ||
37 | <directory>${pkg.win.dist}/conf</directory> | 42 | <directory>${pkg.win.dist}/conf</directory> |
38 | <outputDirectory>conf</outputDirectory> | 43 | <outputDirectory>conf</outputDirectory> |
39 | <lineEnding>windows</lineEnding> | 44 | <lineEnding>windows</lineEnding> |
@@ -75,5 +80,10 @@ | @@ -75,5 +80,10 @@ | ||
75 | <outputDirectory/> | 80 | <outputDirectory/> |
76 | <lineEnding>windows</lineEnding> | 81 | <lineEnding>windows</lineEnding> |
77 | </file> | 82 | </file> |
83 | + <file> | ||
84 | + <source>${pkg.win.dist}/upgrade.bat</source> | ||
85 | + <outputDirectory/> | ||
86 | + <lineEnding>windows</lineEnding> | ||
87 | + </file> | ||
78 | </files> | 88 | </files> |
79 | </assembly> | 89 | </assembly> |
@@ -69,9 +69,34 @@ IF "%JRE_PATH2%" == "" GOTO JAVA_NOT_INSTALLED | @@ -69,9 +69,34 @@ IF "%JRE_PATH2%" == "" GOTO JAVA_NOT_INSTALLED | ||
69 | 69 | ||
70 | @ECHO Java 1.8 found! | 70 | @ECHO Java 1.8 found! |
71 | @ECHO Installing ${pkg.name} ... | 71 | @ECHO Installing ${pkg.name} ... |
72 | -%~dp0${pkg.name}.exe install | ||
73 | 72 | ||
74 | -@ECHO DONE. | 73 | +SET loadDemo=false |
74 | + | ||
75 | +if "%1" == "--loadDemo" ( | ||
76 | + SET loadDemo=true | ||
77 | +) | ||
78 | + | ||
79 | +SET BASE=%~dp0 | ||
80 | +SET LOADER_PATH=%BASE%\conf,%BASE%\extensions | ||
81 | +SET jarfile=%BASE%\lib\${pkg.name}.jar | ||
82 | +SET installDir=%BASE%\data | ||
83 | + | ||
84 | +java -cp %jarfile% -Dloader.main=org.thingsboard.server.ThingsboardInstallApplication^ | ||
85 | + -Dinstall.data_dir=%installDir%^ | ||
86 | + -Dinstall.load_demo=%loadDemo%^ | ||
87 | + -Dspring.jpa.hibernate.ddl-auto=none^ | ||
88 | + -Dinstall.upgrade=false^ | ||
89 | + -Dlogging.config=%BASE%\install\logback.xml^ | ||
90 | + org.springframework.boot.loader.PropertiesLauncher | ||
91 | + | ||
92 | +if errorlevel 1 ( | ||
93 | + @echo ThingsBoard installation failed! | ||
94 | + exit /b %errorlevel% | ||
95 | +) | ||
96 | + | ||
97 | +%BASE%${pkg.name}.exe install | ||
98 | + | ||
99 | +@ECHO ThingsBoard installed successfully! | ||
75 | 100 | ||
76 | GOTO END | 101 | GOTO END |
77 | 102 |
1 | +@ECHO OFF | ||
2 | + | ||
3 | +setlocal ENABLEEXTENSIONS | ||
4 | + | ||
5 | +@ECHO Upgrading ${pkg.name} ... | ||
6 | + | ||
7 | +SET BASE=%~dp0 | ||
8 | + | ||
9 | +:loop | ||
10 | +IF NOT "%1"=="" ( | ||
11 | + IF "%1"=="--fromVersion" ( | ||
12 | + SET fromVersion=%2 | ||
13 | + ) | ||
14 | + SHIFT | ||
15 | + GOTO :loop | ||
16 | +) | ||
17 | + | ||
18 | +if not defined fromVersion ( | ||
19 | + echo "--fromVersion parameter is invalid or unspecified!" | ||
20 | + echo "Usage: upgrade.bat --fromVersion {VERSION}" | ||
21 | + exit /b 1 | ||
22 | +) | ||
23 | + | ||
24 | +SET LOADER_PATH=%BASE%\conf,%BASE%\extensions | ||
25 | +SET jarfile=%BASE%\lib\${pkg.name}.jar | ||
26 | +SET installDir=%BASE%\data | ||
27 | + | ||
28 | +java -cp %jarfile% -Dloader.main=org.thingsboard.server.ThingsboardInstallApplication^ | ||
29 | + -Dinstall.data_dir=%installDir%^ | ||
30 | + -Dspring.jpa.hibernate.ddl-auto=none^ | ||
31 | + -Dinstall.upgrade=true^ | ||
32 | + -Dinstall.upgrade.from_version=%fromVersion%^ | ||
33 | + -Dlogging.config=%BASE%\install\logback.xml^ | ||
34 | + org.springframework.boot.loader.PropertiesLauncher | ||
35 | + | ||
36 | +if errorlevel 1 ( | ||
37 | + @echo ThingsBoard upgrade failed! | ||
38 | + exit /b %errorlevel% | ||
39 | +) | ||
40 | + | ||
41 | +@ECHO ThingsBoard upgraded successfully! | ||
42 | + | ||
43 | +GOTO END | ||
44 | + | ||
45 | +:END |