Commit 8e6bd7aebcf5178590db3108cb3f318e792a12f7

Authored by Andrew Shvayka
Committed by GitHub
2 parents 5e40f16d e39d5c9f

Merge pull request #2814 from thingsboard/feature/packaging

Feature/packaging
Showing 100 changed files with 727 additions and 2807 deletions

Too many changes to show.

To preserve performance only 100 of 115 files are displayed.

@@ -34,10 +34,15 @@ @@ -34,10 +34,15 @@
34 <properties> 34 <properties>
35 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 35 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
36 <main.dir>${basedir}/..</main.dir> 36 <main.dir>${basedir}/..</main.dir>
  37 + <pkg.type>java</pkg.type>
  38 + <pkg.disabled>false</pkg.disabled>
  39 + <pkg.process-resources.phase>process-resources</pkg.process-resources.phase>
  40 + <pkg.package.phase>package</pkg.package.phase>
37 <pkg.name>thingsboard</pkg.name> 41 <pkg.name>thingsboard</pkg.name>
38 - <pkg.unixLogFolder>/var/log/${pkg.name}</pkg.unixLogFolder>  
39 - <pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder>  
40 <pkg.win.dist>${project.build.directory}/windows</pkg.win.dist> 42 <pkg.win.dist>${project.build.directory}/windows</pkg.win.dist>
  43 + <pkg.copyInstallScripts>true</pkg.copyInstallScripts>
  44 + <pkg.implementationTitle>ThingsBoard</pkg.implementationTitle>
  45 + <pkg.mainClass>org.thingsboard.server.ThingsboardServerApplication</pkg.mainClass>
41 </properties> 46 </properties>
42 47
43 <dependencies> 48 <dependencies>
@@ -309,6 +314,10 @@ @@ -309,6 +314,10 @@
309 <plugins> 314 <plugins>
310 <plugin> 315 <plugin>
311 <groupId>org.apache.maven.plugins</groupId> 316 <groupId>org.apache.maven.plugins</groupId>
  317 + <artifactId>maven-compiler-plugin</artifactId>
  318 + </plugin>
  319 + <plugin>
  320 + <groupId>org.apache.maven.plugins</groupId>
312 <artifactId>maven-surefire-plugin</artifactId> 321 <artifactId>maven-surefire-plugin</artifactId>
313 <version>${surfire.version}</version> 322 <version>${surfire.version}</version>
314 <configuration> 323 <configuration>
@@ -323,313 +332,30 @@ @@ -323,313 +332,30 @@
323 <plugin> 332 <plugin>
324 <groupId>org.apache.maven.plugins</groupId> 333 <groupId>org.apache.maven.plugins</groupId>
325 <artifactId>maven-resources-plugin</artifactId> 334 <artifactId>maven-resources-plugin</artifactId>
326 - <executions>  
327 - <execution>  
328 - <id>copy-conf</id>  
329 - <phase>process-resources</phase>  
330 - <goals>  
331 - <goal>copy-resources</goal>  
332 - </goals>  
333 - <configuration>  
334 - <outputDirectory>${project.build.directory}/conf</outputDirectory>  
335 - <resources>  
336 - <resource>  
337 - <directory>src/main/resources</directory>  
338 - <excludes>  
339 - <exclude>logback.xml</exclude>  
340 - </excludes>  
341 - <filtering>false</filtering>  
342 - </resource>  
343 - </resources>  
344 - </configuration>  
345 - </execution>  
346 - <execution>  
347 - <id>copy-service-conf</id>  
348 - <phase>process-resources</phase>  
349 - <goals>  
350 - <goal>copy-resources</goal>  
351 - </goals>  
352 - <configuration>  
353 - <outputDirectory>${project.build.directory}/conf</outputDirectory>  
354 - <resources>  
355 - <resource>  
356 - <directory>src/main/conf</directory>  
357 - <filtering>true</filtering>  
358 - </resource>  
359 - </resources>  
360 - <filters>  
361 - <filter>src/main/filters/unix.properties</filter>  
362 - </filters>  
363 - </configuration>  
364 - </execution>  
365 - <execution>  
366 - <id>copy-win-conf</id>  
367 - <phase>process-resources</phase>  
368 - <goals>  
369 - <goal>copy-resources</goal>  
370 - </goals>  
371 - <configuration>  
372 - <outputDirectory>${pkg.win.dist}/conf</outputDirectory>  
373 - <resources>  
374 - <resource>  
375 - <directory>src/main/resources</directory>  
376 - <excludes>  
377 - <exclude>logback.xml</exclude>  
378 - </excludes>  
379 - <filtering>false</filtering>  
380 - </resource>  
381 - <resource>  
382 - <directory>src/main/conf</directory>  
383 - <excludes>  
384 - <exclude>thingsboard.conf</exclude>  
385 - </excludes>  
386 - <filtering>true</filtering>  
387 - </resource>  
388 - </resources>  
389 - <filters>  
390 - <filter>src/main/filters/windows.properties</filter>  
391 - </filters>  
392 - </configuration>  
393 - </execution>  
394 - <execution>  
395 - <id>copy-control</id>  
396 - <phase>process-resources</phase>  
397 - <goals>  
398 - <goal>copy-resources</goal>  
399 - </goals>  
400 - <configuration>  
401 - <outputDirectory>${project.build.directory}/control</outputDirectory>  
402 - <resources>  
403 - <resource>  
404 - <directory>src/main/scripts/control</directory>  
405 - <filtering>true</filtering>  
406 - </resource>  
407 - </resources>  
408 - <filters>  
409 - <filter>src/main/filters/unix.properties</filter>  
410 - </filters>  
411 - </configuration>  
412 - </execution>  
413 - <execution>  
414 - <id>copy-install</id>  
415 - <phase>process-resources</phase>  
416 - <goals>  
417 - <goal>copy-resources</goal>  
418 - </goals>  
419 - <configuration>  
420 - <outputDirectory>${project.build.directory}/bin/install</outputDirectory>  
421 - <resources>  
422 - <resource>  
423 - <directory>src/main/scripts/install</directory>  
424 - <includes>  
425 - <include>**/*.sh</include>  
426 - <include>**/*.xml</include>  
427 - </includes>  
428 - <filtering>true</filtering>  
429 - </resource>  
430 - </resources>  
431 - <filters>  
432 - <filter>src/main/filters/unix.properties</filter>  
433 - </filters>  
434 - </configuration>  
435 - </execution>  
436 - <execution>  
437 - <id>copy-windows-control</id>  
438 - <phase>process-resources</phase>  
439 - <goals>  
440 - <goal>copy-resources</goal>  
441 - </goals>  
442 - <configuration>  
443 - <outputDirectory>${pkg.win.dist}</outputDirectory>  
444 - <resources>  
445 - <resource>  
446 - <directory>src/main/scripts/windows</directory>  
447 - <filtering>true</filtering>  
448 - </resource>  
449 - </resources>  
450 - <filters>  
451 - <filter>src/main/filters/windows.properties</filter>  
452 - </filters>  
453 - </configuration>  
454 - </execution>  
455 - <execution>  
456 - <id>copy-windows-install</id>  
457 - <phase>process-resources</phase>  
458 - <goals>  
459 - <goal>copy-resources</goal>  
460 - </goals>  
461 - <configuration>  
462 - <outputDirectory>${pkg.win.dist}/install</outputDirectory>  
463 - <resources>  
464 - <resource>  
465 - <directory>src/main/scripts/install</directory>  
466 - <includes>  
467 - <include>logback.xml</include>  
468 - </includes>  
469 - <filtering>true</filtering>  
470 - </resource>  
471 - </resources>  
472 - <filters>  
473 - <filter>src/main/filters/windows.properties</filter>  
474 - </filters>  
475 - </configuration>  
476 - </execution>  
477 - <execution>  
478 - <id>copy-data</id>  
479 - <phase>process-resources</phase>  
480 - <goals>  
481 - <goal>copy-resources</goal>  
482 - </goals>  
483 - <configuration>  
484 - <outputDirectory>${project.build.directory}/data</outputDirectory>  
485 - <resources>  
486 - <resource>  
487 - <directory>src/main/data</directory>  
488 - </resource>  
489 - <resource>  
490 - <directory>../dao/src/main/resources</directory>  
491 - <includes>  
492 - <include>**/*.cql</include>  
493 - <include>**/*.sql</include>  
494 - </includes>  
495 - <filtering>false</filtering>  
496 - </resource>  
497 - </resources>  
498 - </configuration>  
499 - </execution>  
500 - </executions>  
501 </plugin> 335 </plugin>
502 <plugin> 336 <plugin>
503 <groupId>org.apache.maven.plugins</groupId> 337 <groupId>org.apache.maven.plugins</groupId>
504 <artifactId>maven-dependency-plugin</artifactId> 338 <artifactId>maven-dependency-plugin</artifactId>
505 - <executions>  
506 - <execution>  
507 - <id>copy-winsw-service</id>  
508 - <phase>package</phase>  
509 - <goals>  
510 - <goal>copy</goal>  
511 - </goals>  
512 - <configuration>  
513 - <artifactItems>  
514 - <artifactItem>  
515 - <groupId>com.sun.winsw</groupId>  
516 - <artifactId>winsw</artifactId>  
517 - <classifier>bin</classifier>  
518 - <type>exe</type>  
519 - <destFileName>service.exe</destFileName>  
520 - </artifactItem>  
521 - </artifactItems>  
522 - <outputDirectory>${pkg.win.dist}</outputDirectory>  
523 - </configuration>  
524 - </execution>  
525 - </executions>  
526 </plugin> 339 </plugin>
527 <plugin> 340 <plugin>
528 <groupId>org.apache.maven.plugins</groupId> 341 <groupId>org.apache.maven.plugins</groupId>
529 <artifactId>maven-jar-plugin</artifactId> 342 <artifactId>maven-jar-plugin</artifactId>
530 - <configuration>  
531 - <excludes>  
532 - <exclude>**/logback.xml</exclude>  
533 - </excludes>  
534 - <archive>  
535 - <manifestEntries>  
536 - <Implementation-Title>ThingsBoard</Implementation-Title>  
537 - <Implementation-Version>${project.version}</Implementation-Version>  
538 - </manifestEntries>  
539 - </archive>  
540 - </configuration>  
541 </plugin> 343 </plugin>
542 <plugin> 344 <plugin>
543 <groupId>org.springframework.boot</groupId> 345 <groupId>org.springframework.boot</groupId>
544 <artifactId>spring-boot-maven-plugin</artifactId> 346 <artifactId>spring-boot-maven-plugin</artifactId>
545 - <configuration>  
546 - <mainClass>org.thingsboard.server.ThingsboardServerApplication</mainClass>  
547 - <classifier>boot</classifier>  
548 - <layout>ZIP</layout>  
549 - <executable>true</executable>  
550 - <excludeDevtools>true</excludeDevtools>  
551 - <embeddedLaunchScriptProperties>  
552 - <confFolder>${pkg.installFolder}/conf</confFolder>  
553 - <logFolder>${pkg.unixLogFolder}</logFolder>  
554 - <logFilename>${pkg.name}.out</logFilename>  
555 - <initInfoProvides>${pkg.name}</initInfoProvides>  
556 - </embeddedLaunchScriptProperties>  
557 - </configuration>  
558 - <executions>  
559 - <execution>  
560 - <goals>  
561 - <goal>repackage</goal>  
562 - </goals>  
563 - </execution>  
564 - </executions>  
565 </plugin> 347 </plugin>
566 <plugin> 348 <plugin>
567 <groupId>org.thingsboard</groupId> 349 <groupId>org.thingsboard</groupId>
568 <artifactId>gradle-maven-plugin</artifactId> 350 <artifactId>gradle-maven-plugin</artifactId>
569 - <configuration>  
570 - <tasks>  
571 - <task>build</task>  
572 - <task>buildDeb</task>  
573 - <task>buildRpm</task>  
574 - </tasks>  
575 - <args>  
576 - <arg>-PprojectBuildDir=${project.build.directory}</arg>  
577 - <arg>-PprojectVersion=${project.version}</arg>  
578 - <arg>-PmainJar=${project.build.directory}/${project.build.finalName}-boot.${project.packaging}  
579 - </arg>  
580 - <arg>-PpkgName=${pkg.name}</arg>  
581 - <arg>-PpkgInstallFolder=${pkg.installFolder}</arg>  
582 - <arg>-PpkgLogFolder=${pkg.unixLogFolder}</arg>  
583 - </args>  
584 - </configuration>  
585 - <executions>  
586 - <execution>  
587 - <phase>package</phase>  
588 - <goals>  
589 - <goal>invoke</goal>  
590 - </goals>  
591 - </execution>  
592 - </executions>  
593 </plugin> 351 </plugin>
594 <plugin> 352 <plugin>
595 <groupId>org.apache.maven.plugins</groupId> 353 <groupId>org.apache.maven.plugins</groupId>
596 <artifactId>maven-assembly-plugin</artifactId> 354 <artifactId>maven-assembly-plugin</artifactId>
597 - <configuration>  
598 - <finalName>${pkg.name}</finalName>  
599 - <descriptors>  
600 - <descriptor>src/main/assembly/windows.xml</descriptor>  
601 - </descriptors>  
602 - </configuration>  
603 - <executions>  
604 - <execution>  
605 - <id>assembly</id>  
606 - <phase>package</phase>  
607 - <goals>  
608 - <goal>single</goal>  
609 - </goals>  
610 - </execution>  
611 - </executions>  
612 </plugin> 355 </plugin>
613 <plugin> 356 <plugin>
614 <groupId>org.apache.maven.plugins</groupId> 357 <groupId>org.apache.maven.plugins</groupId>
615 <artifactId>maven-install-plugin</artifactId> 358 <artifactId>maven-install-plugin</artifactId>
616 - <configuration>  
617 - <file>${project.build.directory}/${pkg.name}.deb</file>  
618 - <artifactId>${project.artifactId}</artifactId>  
619 - <groupId>${project.groupId}</groupId>  
620 - <version>${project.version}</version>  
621 - <classifier>deb</classifier>  
622 - <packaging>deb</packaging>  
623 - </configuration>  
624 - <executions>  
625 - <execution>  
626 - <id>install-deb</id>  
627 - <phase>package</phase>  
628 - <goals>  
629 - <goal>install-file</goal>  
630 - </goals>  
631 - </execution>  
632 - </executions>  
633 </plugin> 359 </plugin>
634 <plugin> 360 <plugin>
635 <groupId>org.xolstice.maven.plugins</groupId> 361 <groupId>org.xolstice.maven.plugins</groupId>
1 -/**  
2 - * Copyright © 2016-2020 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -import org.apache.tools.ant.filters.ReplaceTokens  
17 -  
18 -buildscript {  
19 - ext {  
20 - osPackageVersion = "3.8.0"  
21 - }  
22 - repositories {  
23 - jcenter()  
24 - }  
25 - dependencies {  
26 - classpath("com.netflix.nebula:gradle-ospackage-plugin:${osPackageVersion}")  
27 - }  
28 -}  
29 -  
30 -apply plugin: "nebula.ospackage"  
31 -  
32 -buildDir = projectBuildDir  
33 -version = projectVersion  
34 -distsDirName = "./"  
35 -  
36 -// OS Package plugin configuration  
37 -ospackage {  
38 - packageName = pkgName  
39 - version = "${project.version}"  
40 - release = 1  
41 - os = LINUX  
42 - type = BINARY  
43 -  
44 - into pkgInstallFolder  
45 -  
46 - user pkgUser  
47 - permissionGroup pkgUser  
48 -  
49 - // Copy the executable file  
50 - from("target/package/linux/bin/${pkgName}") {  
51 - fileMode 0500  
52 - into "bin"  
53 - }  
54 -  
55 - // Copy the init file  
56 - from("target/package/linux/init/${pkgName}") {  
57 - fileMode 0500  
58 - into "init"  
59 - }  
60 -  
61 - // Copy the config files  
62 - from("target/package/linux/conf") {  
63 - fileType CONFIG | NOREPLACE  
64 - fileMode 0754  
65 - into "conf"  
66 - }  
67 -  
68 -}  
69 -  
70 -// Configure our RPM build task  
71 -buildRpm {  
72 -  
73 - arch = X86_64  
74 -  
75 - version = projectVersion.replace('-', '')  
76 - archiveName = "${pkgName}.rpm"  
77 -  
78 - preInstall file("${buildDir}/control/rpm/preinst")  
79 - postInstall file("${buildDir}/control/rpm/postinst")  
80 - preUninstall file("${buildDir}/control/rpm/prerm")  
81 - postUninstall file("${buildDir}/control/rpm/postrm")  
82 -  
83 - user pkgUser  
84 - permissionGroup pkgUser  
85 -  
86 - // Copy the system unit files  
87 - from("${buildDir}/control/${pkgName}.service") {  
88 - addParentDirs = false  
89 - fileMode 0644  
90 - into "/usr/lib/systemd/system"  
91 - }  
92 -  
93 - directory(pkgLogFolder, 0755)  
94 - link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")  
95 -}  
96 -  
97 -// Same as the buildRpm task  
98 -buildDeb {  
99 -  
100 - arch = "amd64"  
101 -  
102 - archiveName = "${pkgName}.deb"  
103 -  
104 - configurationFile("${pkgInstallFolder}/conf/${pkgName}.conf")  
105 - configurationFile("${pkgInstallFolder}/conf/custom-environment-variables.yml")  
106 - configurationFile("${pkgInstallFolder}/conf/default.yml")  
107 - configurationFile("${pkgInstallFolder}/conf/logger.js")  
108 -  
109 - preInstall file("${buildDir}/control/deb/preinst")  
110 - postInstall file("${buildDir}/control/deb/postinst")  
111 - preUninstall file("${buildDir}/control/deb/prerm")  
112 - postUninstall file("${buildDir}/control/deb/postrm")  
113 -  
114 - user pkgUser  
115 - permissionGroup pkgUser  
116 -  
117 - directory(pkgLogFolder, 0755)  
118 - link("/etc/init.d/${pkgName}", "${pkgInstallFolder}/init/${pkgName}")  
119 - link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")  
120 -}  
@@ -1461,7 +1461,7 @@ @@ -1461,7 +1461,7 @@
1461 }, 1461 },
1462 "enabled": { 1462 "enabled": {
1463 "version": "1.0.2", 1463 "version": "1.0.2",
1464 - "resolved": "https://registry.npmjs.org/enabled/-/enabled-1.0.2.tgz", 1464 + "resolved": "http://registry.npmjs.org/enabled/-/enabled-1.0.2.tgz",
1465 "integrity": "sha1-ll9lE9LC0cX0ZStkouM5ZGf8L5M=", 1465 "integrity": "sha1-ll9lE9LC0cX0ZStkouM5ZGf8L5M=",
1466 "requires": { 1466 "requires": {
1467 "env-variable": "0.0.x" 1467 "env-variable": "0.0.x"
@@ -1740,7 +1740,7 @@ @@ -1740,7 +1740,7 @@
1740 }, 1740 },
1741 "fecha": { 1741 "fecha": {
1742 "version": "2.3.3", 1742 "version": "2.3.3",
1743 - "resolved": "https://registry.npmjs.org/fecha/-/fecha-2.3.3.tgz", 1743 + "resolved": "http://registry.npmjs.org/fecha/-/fecha-2.3.3.tgz",
1744 "integrity": "sha512-lUGBnIamTAwk4znq5BcqsDaxSmZ9nDVJaij6NvRt/Tg4R69gERA+otPKbS86ROw9nxVMw2/mp1fnaiWqbs6Sdg==" 1744 "integrity": "sha512-lUGBnIamTAwk4znq5BcqsDaxSmZ9nDVJaij6NvRt/Tg4R69gERA+otPKbS86ROw9nxVMw2/mp1fnaiWqbs6Sdg=="
1745 }, 1745 },
1746 "file-stream-rotator": { 1746 "file-stream-rotator": {
@@ -1872,14 +1872,12 @@ @@ -1872,14 +1872,12 @@
1872 "balanced-match": { 1872 "balanced-match": {
1873 "version": "1.0.0", 1873 "version": "1.0.0",
1874 "bundled": true, 1874 "bundled": true,
1875 - "dev": true,  
1876 - "optional": true 1875 + "dev": true
1877 }, 1876 },
1878 "brace-expansion": { 1877 "brace-expansion": {
1879 "version": "1.1.11", 1878 "version": "1.1.11",
1880 "bundled": true, 1879 "bundled": true,
1881 "dev": true, 1880 "dev": true,
1882 - "optional": true,  
1883 "requires": { 1881 "requires": {
1884 "balanced-match": "^1.0.0", 1882 "balanced-match": "^1.0.0",
1885 "concat-map": "0.0.1" 1883 "concat-map": "0.0.1"
@@ -1894,20 +1892,17 @@ @@ -1894,20 +1892,17 @@
1894 "code-point-at": { 1892 "code-point-at": {
1895 "version": "1.1.0", 1893 "version": "1.1.0",
1896 "bundled": true, 1894 "bundled": true,
1897 - "dev": true,  
1898 - "optional": true 1895 + "dev": true
1899 }, 1896 },
1900 "concat-map": { 1897 "concat-map": {
1901 "version": "0.0.1", 1898 "version": "0.0.1",
1902 "bundled": true, 1899 "bundled": true,
1903 - "dev": true,  
1904 - "optional": true 1900 + "dev": true
1905 }, 1901 },
1906 "console-control-strings": { 1902 "console-control-strings": {
1907 "version": "1.1.0", 1903 "version": "1.1.0",
1908 "bundled": true, 1904 "bundled": true,
1909 - "dev": true,  
1910 - "optional": true 1905 + "dev": true
1911 }, 1906 },
1912 "core-util-is": { 1907 "core-util-is": {
1913 "version": "1.0.2", 1908 "version": "1.0.2",
@@ -2024,8 +2019,7 @@ @@ -2024,8 +2019,7 @@
2024 "inherits": { 2019 "inherits": {
2025 "version": "2.0.3", 2020 "version": "2.0.3",
2026 "bundled": true, 2021 "bundled": true,
2027 - "dev": true,  
2028 - "optional": true 2022 + "dev": true
2029 }, 2023 },
2030 "ini": { 2024 "ini": {
2031 "version": "1.3.5", 2025 "version": "1.3.5",
@@ -2037,7 +2031,6 @@ @@ -2037,7 +2031,6 @@
2037 "version": "1.0.0", 2031 "version": "1.0.0",
2038 "bundled": true, 2032 "bundled": true,
2039 "dev": true, 2033 "dev": true,
2040 - "optional": true,  
2041 "requires": { 2034 "requires": {
2042 "number-is-nan": "^1.0.0" 2035 "number-is-nan": "^1.0.0"
2043 } 2036 }
@@ -2052,7 +2045,6 @@ @@ -2052,7 +2045,6 @@
2052 "version": "3.0.4", 2045 "version": "3.0.4",
2053 "bundled": true, 2046 "bundled": true,
2054 "dev": true, 2047 "dev": true,
2055 - "optional": true,  
2056 "requires": { 2048 "requires": {
2057 "brace-expansion": "^1.1.7" 2049 "brace-expansion": "^1.1.7"
2058 } 2050 }
@@ -2164,8 +2156,7 @@ @@ -2164,8 +2156,7 @@
2164 "number-is-nan": { 2156 "number-is-nan": {
2165 "version": "1.0.1", 2157 "version": "1.0.1",
2166 "bundled": true, 2158 "bundled": true,
2167 - "dev": true,  
2168 - "optional": true 2159 + "dev": true
2169 }, 2160 },
2170 "object-assign": { 2161 "object-assign": {
2171 "version": "4.1.1", 2162 "version": "4.1.1",
@@ -2298,7 +2289,6 @@ @@ -2298,7 +2289,6 @@
2298 "version": "1.0.2", 2289 "version": "1.0.2",
2299 "bundled": true, 2290 "bundled": true,
2300 "dev": true, 2291 "dev": true,
2301 - "optional": true,  
2302 "requires": { 2292 "requires": {
2303 "code-point-at": "^1.0.0", 2293 "code-point-at": "^1.0.0",
2304 "is-fullwidth-code-point": "^1.0.0", 2294 "is-fullwidth-code-point": "^1.0.0",
@@ -2400,7 +2390,7 @@ @@ -2400,7 +2390,7 @@
2400 }, 2390 },
2401 "get-stream": { 2391 "get-stream": {
2402 "version": "3.0.0", 2392 "version": "3.0.0",
2403 - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", 2393 + "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
2404 "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", 2394 "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=",
2405 "dev": true 2395 "dev": true
2406 }, 2396 },
@@ -2557,7 +2547,7 @@ @@ -2557,7 +2547,7 @@
2557 }, 2547 },
2558 "got": { 2548 "got": {
2559 "version": "6.7.1", 2549 "version": "6.7.1",
2560 - "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", 2550 + "resolved": "http://registry.npmjs.org/got/-/got-6.7.1.tgz",
2561 "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", 2551 "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=",
2562 "dev": true, 2552 "dev": true,
2563 "requires": { 2553 "requires": {
@@ -2889,7 +2879,7 @@ @@ -2889,7 +2879,7 @@
2889 }, 2879 },
2890 "is-obj": { 2880 "is-obj": {
2891 "version": "1.0.1", 2881 "version": "1.0.1",
2892 - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", 2882 + "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
2893 "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", 2883 "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=",
2894 "dev": true 2884 "dev": true
2895 }, 2885 },
@@ -3251,7 +3241,7 @@ @@ -3251,7 +3241,7 @@
3251 }, 3241 },
3252 "minimist": { 3242 "minimist": {
3253 "version": "1.2.0", 3243 "version": "1.2.0",
3254 - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", 3244 + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
3255 "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" 3245 "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
3256 }, 3246 },
3257 "mixin-deep": { 3247 "mixin-deep": {
@@ -3277,7 +3267,7 @@ @@ -3277,7 +3267,7 @@
3277 }, 3267 },
3278 "mkdirp": { 3268 "mkdirp": {
3279 "version": "0.5.1", 3269 "version": "0.5.1",
3280 - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", 3270 + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
3281 "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", 3271 "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
3282 "dev": true, 3272 "dev": true,
3283 "requires": { 3273 "requires": {
@@ -3286,7 +3276,7 @@ @@ -3286,7 +3276,7 @@
3286 "dependencies": { 3276 "dependencies": {
3287 "minimist": { 3277 "minimist": {
3288 "version": "0.0.8", 3278 "version": "0.0.8",
3289 - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", 3279 + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
3290 "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", 3280 "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
3291 "dev": true 3281 "dev": true
3292 } 3282 }
@@ -3550,7 +3540,7 @@ @@ -3550,7 +3540,7 @@
3550 }, 3540 },
3551 "path-is-absolute": { 3541 "path-is-absolute": {
3552 "version": "1.0.1", 3542 "version": "1.0.1",
3553 - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 3543 + "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
3554 "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", 3544 "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
3555 "dev": true 3545 "dev": true
3556 }, 3546 },
@@ -3989,7 +3979,7 @@ @@ -3989,7 +3979,7 @@
3989 }, 3979 },
3990 "safe-regex": { 3980 "safe-regex": {
3991 "version": "1.1.0", 3981 "version": "1.1.0",
3992 - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", 3982 + "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
3993 "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", 3983 "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
3994 "dev": true, 3984 "dev": true,
3995 "requires": { 3985 "requires": {
@@ -4299,7 +4289,7 @@ @@ -4299,7 +4289,7 @@
4299 }, 4289 },
4300 "strip-eof": { 4290 "strip-eof": {
4301 "version": "1.0.0", 4291 "version": "1.0.0",
4302 - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", 4292 + "resolved": "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
4303 "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", 4293 "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
4304 "dev": true 4294 "dev": true
4305 }, 4295 },
@@ -34,10 +34,12 @@ @@ -34,10 +34,12 @@
34 <properties> 34 <properties>
35 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 35 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
36 <main.dir>${basedir}/../..</main.dir> 36 <main.dir>${basedir}/../..</main.dir>
37 - <pkg.name>tb-js-executor</pkg.name>  
38 <docker.name>tb-js-executor</docker.name> 37 <docker.name>tb-js-executor</docker.name>
39 - <pkg.unixLogFolder>/var/log/${pkg.name}</pkg.unixLogFolder>  
40 - <pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder> 38 + <pkg.name>tb-js-executor</pkg.name>
  39 + <pkg.type>js</pkg.type>
  40 + <pkg.disabled>false</pkg.disabled>
  41 + <pkg.process-resources.phase>process-resources</pkg.process-resources.phase>
  42 + <pkg.package.phase>package</pkg.package.phase>
41 <pkg.linux.dist>${project.build.directory}/package/linux</pkg.linux.dist> 43 <pkg.linux.dist>${project.build.directory}/package/linux</pkg.linux.dist>
42 <pkg.win.dist>${project.build.directory}/package/windows</pkg.win.dist> 44 <pkg.win.dist>${project.build.directory}/package/windows</pkg.win.dist>
43 </properties> 45 </properties>
@@ -87,194 +89,18 @@ @@ -87,194 +89,18 @@
87 <plugin> 89 <plugin>
88 <groupId>org.apache.maven.plugins</groupId> 90 <groupId>org.apache.maven.plugins</groupId>
89 <artifactId>maven-dependency-plugin</artifactId> 91 <artifactId>maven-dependency-plugin</artifactId>
90 - <executions>  
91 - <execution>  
92 - <id>copy-winsw-service</id>  
93 - <phase>package</phase>  
94 - <goals>  
95 - <goal>copy</goal>  
96 - </goals>  
97 - <configuration>  
98 - <artifactItems>  
99 - <artifactItem>  
100 - <groupId>com.sun.winsw</groupId>  
101 - <artifactId>winsw</artifactId>  
102 - <classifier>bin</classifier>  
103 - <type>exe</type>  
104 - <destFileName>service.exe</destFileName>  
105 - </artifactItem>  
106 - </artifactItems>  
107 - <outputDirectory>${pkg.win.dist}</outputDirectory>  
108 - </configuration>  
109 - </execution>  
110 - </executions>  
111 </plugin> 92 </plugin>
112 <plugin> 93 <plugin>
113 <groupId>org.apache.maven.plugins</groupId> 94 <groupId>org.apache.maven.plugins</groupId>
114 <artifactId>maven-resources-plugin</artifactId> 95 <artifactId>maven-resources-plugin</artifactId>
115 - <executions>  
116 - <execution>  
117 - <id>copy-linux-conf</id>  
118 - <phase>process-resources</phase>  
119 - <goals>  
120 - <goal>copy-resources</goal>  
121 - </goals>  
122 - <configuration>  
123 - <outputDirectory>${pkg.linux.dist}/conf</outputDirectory>  
124 - <resources>  
125 - <resource>  
126 - <directory>config</directory>  
127 - <filtering>true</filtering>  
128 - </resource>  
129 - </resources>  
130 - <filters>  
131 - <filter>src/main/filters/unix.properties</filter>  
132 - </filters>  
133 - </configuration>  
134 - </execution>  
135 - <execution>  
136 - <id>copy-linux-init</id>  
137 - <phase>process-resources</phase>  
138 - <goals>  
139 - <goal>copy-resources</goal>  
140 - </goals>  
141 - <configuration>  
142 - <outputDirectory>${pkg.linux.dist}/init</outputDirectory>  
143 - <resources>  
144 - <resource>  
145 - <directory>src/main/scripts/init</directory>  
146 - <filtering>true</filtering>  
147 - </resource>  
148 - </resources>  
149 - <filters>  
150 - <filter>src/main/filters/unix.properties</filter>  
151 - </filters>  
152 - </configuration>  
153 - </execution>  
154 - <execution>  
155 - <id>copy-win-conf</id>  
156 - <phase>process-resources</phase>  
157 - <goals>  
158 - <goal>copy-resources</goal>  
159 - </goals>  
160 - <configuration>  
161 - <outputDirectory>${pkg.win.dist}/conf</outputDirectory>  
162 - <resources>  
163 - <resource>  
164 - <directory>config</directory>  
165 - <excludes>  
166 - <exclude>tb-js-executor.conf</exclude>  
167 - </excludes>  
168 - <filtering>true</filtering>  
169 - </resource>  
170 - </resources>  
171 - <filters>  
172 - <filter>src/main/filters/windows.properties</filter>  
173 - </filters>  
174 - </configuration>  
175 - </execution>  
176 - <execution>  
177 - <id>copy-control</id>  
178 - <phase>process-resources</phase>  
179 - <goals>  
180 - <goal>copy-resources</goal>  
181 - </goals>  
182 - <configuration>  
183 - <outputDirectory>${project.build.directory}/control</outputDirectory>  
184 - <resources>  
185 - <resource>  
186 - <directory>src/main/scripts/control</directory>  
187 - <filtering>true</filtering>  
188 - </resource>  
189 - </resources>  
190 - <filters>  
191 - <filter>src/main/filters/unix.properties</filter>  
192 - </filters>  
193 - </configuration>  
194 - </execution>  
195 - <execution>  
196 - <id>copy-windows-control</id>  
197 - <phase>process-resources</phase>  
198 - <goals>  
199 - <goal>copy-resources</goal>  
200 - </goals>  
201 - <configuration>  
202 - <outputDirectory>${pkg.win.dist}</outputDirectory>  
203 - <resources>  
204 - <resource>  
205 - <directory>src/main/scripts/windows</directory>  
206 - <filtering>true</filtering>  
207 - </resource>  
208 - </resources>  
209 - <filters>  
210 - <filter>src/main/filters/windows.properties</filter>  
211 - </filters>  
212 - </configuration>  
213 - </execution>  
214 - <execution>  
215 - <id>copy-docker-config</id>  
216 - <phase>process-resources</phase>  
217 - <goals>  
218 - <goal>copy-resources</goal>  
219 - </goals>  
220 - <configuration>  
221 - <outputDirectory>${project.build.directory}</outputDirectory>  
222 - <resources>  
223 - <resource>  
224 - <directory>docker</directory>  
225 - <filtering>true</filtering>  
226 - </resource>  
227 - </resources>  
228 - </configuration>  
229 - </execution>  
230 - </executions>  
231 </plugin> 96 </plugin>
232 <plugin> 97 <plugin>
233 <groupId>org.thingsboard</groupId> 98 <groupId>org.thingsboard</groupId>
234 <artifactId>gradle-maven-plugin</artifactId> 99 <artifactId>gradle-maven-plugin</artifactId>
235 - <configuration>  
236 - <tasks>  
237 - <task>build</task>  
238 - <task>buildDeb</task>  
239 - <task>buildRpm</task>  
240 - </tasks>  
241 - <args>  
242 - <arg>-PprojectBuildDir=${project.build.directory}</arg>  
243 - <arg>-PprojectVersion=${project.version}</arg>  
244 - <arg>-PpkgName=${pkg.name}</arg>  
245 - <arg>-PpkgUser=${pkg.user}</arg>  
246 - <arg>-PpkgInstallFolder=${pkg.installFolder}</arg>  
247 - <arg>-PpkgLogFolder=${pkg.unixLogFolder}</arg>  
248 - </args>  
249 - </configuration>  
250 - <executions>  
251 - <execution>  
252 - <phase>package</phase>  
253 - <goals>  
254 - <goal>invoke</goal>  
255 - </goals>  
256 - </execution>  
257 - </executions>  
258 </plugin> 100 </plugin>
259 <plugin> 101 <plugin>
260 <groupId>org.apache.maven.plugins</groupId> 102 <groupId>org.apache.maven.plugins</groupId>
261 <artifactId>maven-assembly-plugin</artifactId> 103 <artifactId>maven-assembly-plugin</artifactId>
262 - <version>3.0.0</version>  
263 - <configuration>  
264 - <finalName>${pkg.name}</finalName>  
265 - <descriptors>  
266 - <descriptor>src/main/assembly/windows.xml</descriptor>  
267 - </descriptors>  
268 - </configuration>  
269 - <executions>  
270 - <execution>  
271 - <id>assembly</id>  
272 - <phase>package</phase>  
273 - <goals>  
274 - <goal>single</goal>  
275 - </goals>  
276 - </execution>  
277 - </executions>  
278 </plugin> 104 </plugin>
279 <plugin> 105 <plugin>
280 <groupId>com.spotify</groupId> 106 <groupId>com.spotify</groupId>
1 -<!--  
2 -  
3 - Copyright © 2016-2020 The Thingsboard Authors  
4 -  
5 - Licensed under the Apache License, Version 2.0 (the "License");  
6 - you may not use this file except in compliance with the License.  
7 - You may obtain a copy of the License at  
8 -  
9 - http://www.apache.org/licenses/LICENSE-2.0  
10 -  
11 - Unless required by applicable law or agreed to in writing, software  
12 - distributed under the License is distributed on an "AS IS" BASIS,  
13 - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
14 - See the License for the specific language governing permissions and  
15 - limitations under the License.  
16 -  
17 --->  
18 -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"  
19 - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
20 - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">  
21 - <id>windows</id>  
22 -  
23 - <formats>  
24 - <format>zip</format>  
25 - </formats>  
26 -  
27 - <!-- Workaround to create logs directory -->  
28 - <fileSets>  
29 - <fileSet>  
30 - <directory>${pkg.win.dist}</directory>  
31 - <outputDirectory>logs</outputDirectory>  
32 - <excludes>  
33 - <exclude>*/**</exclude>  
34 - </excludes>  
35 - </fileSet>  
36 - <fileSet>  
37 - <directory>${pkg.win.dist}/conf</directory>  
38 - <outputDirectory>conf</outputDirectory>  
39 - <lineEnding>windows</lineEnding>  
40 - </fileSet>  
41 - </fileSets>  
42 -  
43 - <files>  
44 - <file>  
45 - <source>${pkg.win.dist}/bin/${pkg.name}.exe</source>  
46 - <outputDirectory>bin</outputDirectory>  
47 - <destName>${pkg.name}.exe</destName>  
48 - </file>  
49 - <file>  
50 - <source>${pkg.win.dist}/service.exe</source>  
51 - <outputDirectory/>  
52 - <destName>${pkg.name}.exe</destName>  
53 - </file>  
54 - <file>  
55 - <source>${pkg.win.dist}/service.xml</source>  
56 - <outputDirectory/>  
57 - <destName>${pkg.name}.xml</destName>  
58 - <lineEnding>windows</lineEnding>  
59 - </file>  
60 - <file>  
61 - <source>${pkg.win.dist}/install.bat</source>  
62 - <outputDirectory/>  
63 - <lineEnding>windows</lineEnding>  
64 - </file>  
65 - <file>  
66 - <source>${pkg.win.dist}/uninstall.bat</source>  
67 - <outputDirectory/>  
68 - <lineEnding>windows</lineEnding>  
69 - </file>  
70 - </files>  
71 -</assembly>  
1 -<!--  
2 -  
3 - Copyright © 2016-2018 The Thingsboard Authors  
4 -  
5 - Licensed under the Apache License, Version 2.0 (the "License");  
6 - you may not use this file except in compliance with the License.  
7 - You may obtain a copy of the License at  
8 -  
9 - http://www.apache.org/licenses/LICENSE-2.0  
10 -  
11 - Unless required by applicable law or agreed to in writing, software  
12 - distributed under the License is distributed on an "AS IS" BASIS,  
13 - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
14 - See the License for the specific language governing permissions and  
15 - limitations under the License.  
16 -  
17 --->  
18 -<service>  
19 - <id>${pkg.name}</id>  
20 - <name>${project.name}</name>  
21 - <description>${project.description}</description>  
22 - <workingdirectory>%BASE%\bin</workingdirectory>  
23 - <logpath>${pkg.winWrapperLogFolder}</logpath>  
24 - <logmode>rotate</logmode>  
25 - <env name="NODE_CONFIG_DIR" value="%BASE%\conf" />  
26 - <env name="LOG_FOLDER" value="${pkg.winWrapperLogFolder}" />  
27 - <env name="NODE_ENV" value="production" />  
28 - <executable>%BASE%\bin\${pkg.name}.exe</executable>  
29 -</service>  
@@ -35,9 +35,13 @@ @@ -35,9 +35,13 @@
35 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 35 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
36 <main.dir>${basedir}/../..</main.dir> 36 <main.dir>${basedir}/../..</main.dir>
37 <pkg.name>tb-web-ui</pkg.name> 37 <pkg.name>tb-web-ui</pkg.name>
  38 + <pkg.type>js</pkg.type>
38 <docker.name>tb-web-ui</docker.name> 39 <docker.name>tb-web-ui</docker.name>
39 - <pkg.unixLogFolder>/var/log/${pkg.name}</pkg.unixLogFolder>  
40 - <pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder> 40 + <pkg.name>tb-web-ui</pkg.name>
  41 + <pkg.type>js</pkg.type>
  42 + <pkg.disabled>false</pkg.disabled>
  43 + <pkg.process-resources.phase>process-resources</pkg.process-resources.phase>
  44 + <pkg.package.phase>package</pkg.package.phase>
41 <pkg.linux.dist>${project.build.directory}/package/linux</pkg.linux.dist> 45 <pkg.linux.dist>${project.build.directory}/package/linux</pkg.linux.dist>
42 <pkg.win.dist>${project.build.directory}/package/windows</pkg.win.dist> 46 <pkg.win.dist>${project.build.directory}/package/windows</pkg.win.dist>
43 </properties> 47 </properties>
@@ -135,171 +139,190 @@ @@ -135,171 +139,190 @@
135 </plugin> 139 </plugin>
136 <plugin> 140 <plugin>
137 <groupId>org.apache.maven.plugins</groupId> 141 <groupId>org.apache.maven.plugins</groupId>
  142 + <artifactId>maven-dependency-plugin</artifactId>
  143 + </plugin>
  144 + <plugin>
  145 + <groupId>org.apache.maven.plugins</groupId>
138 <artifactId>maven-resources-plugin</artifactId> 146 <artifactId>maven-resources-plugin</artifactId>
139 - <executions>  
140 - <execution>  
141 - <id>copy-linux-conf</id>  
142 - <phase>process-resources</phase>  
143 - <goals>  
144 - <goal>copy-resources</goal>  
145 - </goals>  
146 - <configuration>  
147 - <outputDirectory>${pkg.linux.dist}/conf</outputDirectory>  
148 - <resources>  
149 - <resource>  
150 - <directory>config</directory>  
151 - <filtering>true</filtering>  
152 - </resource>  
153 - </resources>  
154 - <filters>  
155 - <filter>src/main/filters/unix.properties</filter>  
156 - </filters>  
157 - </configuration>  
158 - </execution>  
159 - <execution>  
160 - <id>copy-linux-init</id>  
161 - <phase>process-resources</phase>  
162 - <goals>  
163 - <goal>copy-resources</goal>  
164 - </goals>  
165 - <configuration>  
166 - <outputDirectory>${pkg.linux.dist}/init</outputDirectory>  
167 - <resources>  
168 - <resource>  
169 - <directory>src/main/scripts/init</directory>  
170 - <filtering>true</filtering>  
171 - </resource>  
172 - </resources>  
173 - <filters>  
174 - <filter>src/main/filters/unix.properties</filter>  
175 - </filters>  
176 - </configuration>  
177 - </execution>  
178 - <execution>  
179 - <id>copy-win-conf</id>  
180 - <phase>process-resources</phase>  
181 - <goals>  
182 - <goal>copy-resources</goal>  
183 - </goals>  
184 - <configuration>  
185 - <outputDirectory>${pkg.win.dist}/conf</outputDirectory>  
186 - <resources>  
187 - <resource>  
188 - <directory>config</directory>  
189 - <excludes>  
190 - <exclude>tb-web-ui.conf</exclude>  
191 - </excludes>  
192 - <filtering>true</filtering>  
193 - </resource>  
194 - </resources>  
195 - <filters>  
196 - <filter>src/main/filters/windows.properties</filter>  
197 - </filters>  
198 - </configuration>  
199 - </execution>  
200 - <execution>  
201 - <id>copy-control</id>  
202 - <phase>process-resources</phase>  
203 - <goals>  
204 - <goal>copy-resources</goal>  
205 - </goals>  
206 - <configuration>  
207 - <outputDirectory>${project.build.directory}/control</outputDirectory>  
208 - <resources>  
209 - <resource>  
210 - <directory>src/main/scripts/control</directory>  
211 - <filtering>true</filtering>  
212 - </resource>  
213 - </resources>  
214 - <filters>  
215 - <filter>src/main/filters/unix.properties</filter>  
216 - </filters>  
217 - </configuration>  
218 - </execution>  
219 - <execution>  
220 - <id>copy-windows-control</id>  
221 - <phase>process-resources</phase>  
222 - <goals>  
223 - <goal>copy-resources</goal>  
224 - </goals>  
225 - <configuration>  
226 - <outputDirectory>${pkg.win.dist}</outputDirectory>  
227 - <resources>  
228 - <resource>  
229 - <directory>src/main/scripts/windows</directory>  
230 - <filtering>true</filtering>  
231 - </resource>  
232 - </resources>  
233 - <filters>  
234 - <filter>src/main/filters/windows.properties</filter>  
235 - </filters>  
236 - </configuration>  
237 - </execution>  
238 - <execution>  
239 - <id>copy-docker-config</id>  
240 - <phase>process-resources</phase>  
241 - <goals>  
242 - <goal>copy-resources</goal>  
243 - </goals>  
244 - <configuration>  
245 - <outputDirectory>${project.build.directory}</outputDirectory>  
246 - <resources>  
247 - <resource>  
248 - <directory>docker</directory>  
249 - <filtering>true</filtering>  
250 - </resource>  
251 - </resources>  
252 - </configuration>  
253 - </execution>  
254 - </executions>  
255 </plugin> 147 </plugin>
256 <plugin> 148 <plugin>
257 <groupId>org.thingsboard</groupId> 149 <groupId>org.thingsboard</groupId>
258 <artifactId>gradle-maven-plugin</artifactId> 150 <artifactId>gradle-maven-plugin</artifactId>
259 - <configuration>  
260 - <tasks>  
261 - <task>build</task>  
262 - <task>buildDeb</task>  
263 - <task>buildRpm</task>  
264 - </tasks>  
265 - <args>  
266 - <arg>-PprojectBuildDir=${project.build.directory}</arg>  
267 - <arg>-PprojectVersion=${project.version}</arg>  
268 - <arg>-PpkgName=${pkg.name}</arg>  
269 - <arg>-PpkgUser=${pkg.user}</arg>  
270 - <arg>-PpkgInstallFolder=${pkg.installFolder}</arg>  
271 - <arg>-PpkgLogFolder=${pkg.unixLogFolder}</arg>  
272 - </args>  
273 - </configuration>  
274 - <executions>  
275 - <execution>  
276 - <phase>package</phase>  
277 - <goals>  
278 - <goal>invoke</goal>  
279 - </goals>  
280 - </execution>  
281 - </executions>  
282 </plugin> 151 </plugin>
283 <plugin> 152 <plugin>
284 <groupId>org.apache.maven.plugins</groupId> 153 <groupId>org.apache.maven.plugins</groupId>
285 <artifactId>maven-assembly-plugin</artifactId> 154 <artifactId>maven-assembly-plugin</artifactId>
286 - <version>3.0.0</version>  
287 - <configuration>  
288 - <finalName>${pkg.name}</finalName>  
289 - <descriptors>  
290 - <descriptor>src/main/assembly/windows.xml</descriptor>  
291 - </descriptors>  
292 - </configuration>  
293 - <executions>  
294 - <execution>  
295 - <id>assembly</id>  
296 - <phase>package</phase>  
297 - <goals>  
298 - <goal>single</goal>  
299 - </goals>  
300 - </execution>  
301 - </executions>  
302 </plugin> 155 </plugin>
  156 +<!-- <plugin>-->
  157 +<!-- <groupId>org.apache.maven.plugins</groupId>-->
  158 +<!-- <artifactId>maven-resources-plugin</artifactId>-->
  159 +<!-- <executions>-->
  160 +<!-- <execution>-->
  161 +<!-- <id>copy-linux-conf</id>-->
  162 +<!-- <phase>process-resources</phase>-->
  163 +<!-- <goals>-->
  164 +<!-- <goal>copy-resources</goal>-->
  165 +<!-- </goals>-->
  166 +<!-- <configuration>-->
  167 +<!-- <outputDirectory>${pkg.linux.dist}/conf</outputDirectory>-->
  168 +<!-- <resources>-->
  169 +<!-- <resource>-->
  170 +<!-- <directory>config</directory>-->
  171 +<!-- <filtering>true</filtering>-->
  172 +<!-- </resource>-->
  173 +<!-- </resources>-->
  174 +<!-- <filters>-->
  175 +<!-- <filter>src/main/filters/unix.properties</filter>-->
  176 +<!-- </filters>-->
  177 +<!-- </configuration>-->
  178 +<!-- </execution>-->
  179 +<!-- <execution>-->
  180 +<!-- <id>copy-linux-init</id>-->
  181 +<!-- <phase>process-resources</phase>-->
  182 +<!-- <goals>-->
  183 +<!-- <goal>copy-resources</goal>-->
  184 +<!-- </goals>-->
  185 +<!-- <configuration>-->
  186 +<!-- <outputDirectory>${pkg.linux.dist}/init</outputDirectory>-->
  187 +<!-- <resources>-->
  188 +<!-- <resource>-->
  189 +<!-- <directory>src/main/scripts/init</directory>-->
  190 +<!-- <filtering>true</filtering>-->
  191 +<!-- </resource>-->
  192 +<!-- </resources>-->
  193 +<!-- <filters>-->
  194 +<!-- <filter>src/main/filters/unix.properties</filter>-->
  195 +<!-- </filters>-->
  196 +<!-- </configuration>-->
  197 +<!-- </execution>-->
  198 +<!-- <execution>-->
  199 +<!-- <id>copy-win-conf</id>-->
  200 +<!-- <phase>process-resources</phase>-->
  201 +<!-- <goals>-->
  202 +<!-- <goal>copy-resources</goal>-->
  203 +<!-- </goals>-->
  204 +<!-- <configuration>-->
  205 +<!-- <outputDirectory>${pkg.win.dist}/conf</outputDirectory>-->
  206 +<!-- <resources>-->
  207 +<!-- <resource>-->
  208 +<!-- <directory>config</directory>-->
  209 +<!-- <excludes>-->
  210 +<!-- <exclude>tb-web-ui.conf</exclude>-->
  211 +<!-- </excludes>-->
  212 +<!-- <filtering>true</filtering>-->
  213 +<!-- </resource>-->
  214 +<!-- </resources>-->
  215 +<!-- <filters>-->
  216 +<!-- <filter>src/main/filters/windows.properties</filter>-->
  217 +<!-- </filters>-->
  218 +<!-- </configuration>-->
  219 +<!-- </execution>-->
  220 +<!-- <execution>-->
  221 +<!-- <id>copy-control</id>-->
  222 +<!-- <phase>process-resources</phase>-->
  223 +<!-- <goals>-->
  224 +<!-- <goal>copy-resources</goal>-->
  225 +<!-- </goals>-->
  226 +<!-- <configuration>-->
  227 +<!-- <outputDirectory>${project.build.directory}/control</outputDirectory>-->
  228 +<!-- <resources>-->
  229 +<!-- <resource>-->
  230 +<!-- <directory>src/main/scripts/control</directory>-->
  231 +<!-- <filtering>true</filtering>-->
  232 +<!-- </resource>-->
  233 +<!-- </resources>-->
  234 +<!-- <filters>-->
  235 +<!-- <filter>src/main/filters/unix.properties</filter>-->
  236 +<!-- </filters>-->
  237 +<!-- </configuration>-->
  238 +<!-- </execution>-->
  239 +<!-- <execution>-->
  240 +<!-- <id>copy-windows-control</id>-->
  241 +<!-- <phase>process-resources</phase>-->
  242 +<!-- <goals>-->
  243 +<!-- <goal>copy-resources</goal>-->
  244 +<!-- </goals>-->
  245 +<!-- <configuration>-->
  246 +<!-- <outputDirectory>${pkg.win.dist}</outputDirectory>-->
  247 +<!-- <resources>-->
  248 +<!-- <resource>-->
  249 +<!-- <directory>src/main/scripts/windows</directory>-->
  250 +<!-- <filtering>true</filtering>-->
  251 +<!-- </resource>-->
  252 +<!-- </resources>-->
  253 +<!-- <filters>-->
  254 +<!-- <filter>src/main/filters/windows.properties</filter>-->
  255 +<!-- </filters>-->
  256 +<!-- </configuration>-->
  257 +<!-- </execution>-->
  258 +<!-- <execution>-->
  259 +<!-- <id>copy-docker-config</id>-->
  260 +<!-- <phase>process-resources</phase>-->
  261 +<!-- <goals>-->
  262 +<!-- <goal>copy-resources</goal>-->
  263 +<!-- </goals>-->
  264 +<!-- <configuration>-->
  265 +<!-- <outputDirectory>${project.build.directory}</outputDirectory>-->
  266 +<!-- <resources>-->
  267 +<!-- <resource>-->
  268 +<!-- <directory>docker</directory>-->
  269 +<!-- <filtering>true</filtering>-->
  270 +<!-- </resource>-->
  271 +<!-- </resources>-->
  272 +<!-- </configuration>-->
  273 +<!-- </execution>-->
  274 +<!-- </executions>-->
  275 +<!-- </plugin>-->
  276 +<!-- <plugin>-->
  277 +<!-- <groupId>org.thingsboard</groupId>-->
  278 +<!-- <artifactId>gradle-maven-plugin</artifactId>-->
  279 +<!-- <configuration>-->
  280 +<!-- <gradleProjectDirectory>${basedir}</gradleProjectDirectory>-->
  281 +<!-- <tasks>-->
  282 +<!-- <task>build</task>-->
  283 +<!-- <task>buildDeb</task>-->
  284 +<!-- <task>buildRpm</task>-->
  285 +<!-- <task>renameDeb</task>-->
  286 +<!-- <task>renameRpm</task>-->
  287 +<!-- </tasks>-->
  288 +<!-- <args>-->
  289 +<!-- <arg>-PprojectBuildDir=${project.build.directory}</arg>-->
  290 +<!-- <arg>-PprojectVersion=${project.version}</arg>-->
  291 +<!-- <arg>-PpkgName=${pkg.name}</arg>-->
  292 +<!-- <arg>-PpkgUser=${pkg.user}</arg>-->
  293 +<!-- <arg>-PpkgInstallFolder=${pkg.installFolder}</arg>-->
  294 +<!-- <arg>-PpkgLogFolder=${pkg.unixLogFolder}</arg>-->
  295 +<!-- </args>-->
  296 +<!-- </configuration>-->
  297 +<!-- <executions>-->
  298 +<!-- <execution>-->
  299 +<!-- <phase>package</phase>-->
  300 +<!-- <goals>-->
  301 +<!-- <goal>invoke</goal>-->
  302 +<!-- </goals>-->
  303 +<!-- </execution>-->
  304 +<!-- </executions>-->
  305 +<!-- </plugin>-->
  306 +<!-- <plugin>-->
  307 +<!-- <groupId>org.apache.maven.plugins</groupId>-->
  308 +<!-- <artifactId>maven-assembly-plugin</artifactId>-->
  309 +<!-- <version>3.0.0</version>-->
  310 +<!-- <configuration>-->
  311 +<!-- <finalName>${pkg.name}</finalName>-->
  312 +<!-- <descriptors>-->
  313 +<!-- <descriptor>../../packaging/js/assembly/windows.xml</descriptor>-->
  314 +<!-- </descriptors>-->
  315 +<!-- </configuration>-->
  316 +<!-- <executions>-->
  317 +<!-- <execution>-->
  318 +<!-- <id>assembly</id>-->
  319 +<!-- <phase>package</phase>-->
  320 +<!-- <goals>-->
  321 +<!-- <goal>single</goal>-->
  322 +<!-- </goals>-->
  323 +<!-- </execution>-->
  324 +<!-- </executions>-->
  325 +<!-- </plugin>-->
303 <plugin> 326 <plugin>
304 <groupId>com.spotify</groupId> 327 <groupId>com.spotify</groupId>
305 <artifactId>dockerfile-maven-plugin</artifactId> 328 <artifactId>dockerfile-maven-plugin</artifactId>
1 -pkg.logFolder=${pkg.unixLogFolder}  
1 -pkg.logFolder=${BASE}\\logs  
2 -pkg.winWrapperLogFolder=%BASE%\\logs  
1 -#!/bin/sh  
2 -  
3 -chown -R ${pkg.user}: ${pkg.logFolder}  
4 -chown -R ${pkg.user}: ${pkg.installFolder}  
5 -update-rc.d ${pkg.name} defaults  
6 -  
1 -#!/bin/sh  
2 -  
3 -update-rc.d -f ${pkg.name} remove  
1 -#!/bin/sh  
2 -  
3 -if ! getent group ${pkg.user} >/dev/null; then  
4 - addgroup --system ${pkg.user}  
5 -fi  
6 -  
7 -if ! getent passwd ${pkg.user} >/dev/null; then  
8 - adduser --quiet \  
9 - --system \  
10 - --ingroup ${pkg.user} \  
11 - --quiet \  
12 - --disabled-login \  
13 - --disabled-password \  
14 - --home ${pkg.installFolder} \  
15 - --no-create-home \  
16 - -gecos "Thingsboard application" \  
17 - ${pkg.user}  
18 -fi  
1 -#!/bin/sh  
2 -  
3 -if [ -e /var/run/${pkg.name}/${pkg.name}.pid ]; then  
4 - service ${pkg.name} stop  
5 -fi  
1 -#!/bin/sh  
2 -  
3 -chown -R ${pkg.user}: ${pkg.logFolder}  
4 -chown -R ${pkg.user}: ${pkg.installFolder}  
5 -  
6 -if [ $1 -eq 1 ] ; then  
7 - # Initial installation  
8 - systemctl --no-reload enable ${pkg.name}.service >/dev/null 2>&1 || :  
9 -fi  
1 -#!/bin/sh  
2 -  
3 -if [ $1 -ge 1 ] ; then  
4 - # Package upgrade, not uninstall  
5 - systemctl try-restart ${pkg.name}.service >/dev/null 2>&1 || :  
6 -fi  
1 -#!/bin/sh  
2 -  
3 -getent group ${pkg.user} >/dev/null || groupadd -r ${pkg.user}  
4 -getent passwd ${pkg.user} >/dev/null || \  
5 -useradd -d ${pkg.installFolder} -g ${pkg.user} -M -r ${pkg.user} -s /sbin/nologin \  
6 --c "Thingsboard application"  
1 -#!/bin/sh  
2 -  
3 -if [ $1 -eq 0 ] ; then  
4 - # Package removal, not upgrade  
5 - systemctl --no-reload disable --now ${pkg.name}.service > /dev/null 2>&1 || :  
6 -fi  
1 -[Unit]  
2 -Description=${pkg.name}  
3 -After=syslog.target  
4 -  
5 -[Service]  
6 -User=${pkg.user}  
7 -ExecStart=${pkg.installFolder}/init/${pkg.name}  
8 -SuccessExitStatus=143  
9 -  
10 -[Install]  
11 -WantedBy=multi-user.target  
1 -#!/bin/bash  
2 -#  
3 -  
4 -  
5 -### BEGIN INIT INFO  
6 -# Provides: tb-web-ui  
7 -# Required-Start: $remote_fs $syslog $network  
8 -# Required-Stop: $remote_fs $syslog $network  
9 -# Default-Start: 2 3 4 5  
10 -# Default-Stop: 0 1 6  
11 -# Short-Description: ${project.name}  
12 -# Description: ${project.description}  
13 -# chkconfig: 2345 99 01  
14 -### END INIT INFO  
15 -  
16 -[[ -n "$DEBUG" ]] && set -x  
17 -  
18 -# Initialize variables that cannot be provided by a .conf file  
19 -WORKING_DIR="$(pwd)"  
20 -# shellcheck disable=SC2153  
21 -  
22 -mainfile=${pkg.installFolder}/bin/${pkg.name}  
23 -configfile=${pkg.name}.conf  
24 -  
25 -# Follow symlinks to find the real script and detect init.d script  
26 -cd "$(dirname "$0")" || exit 1  
27 -[[ -z "$initfile" ]] && initfile=$(pwd)/$(basename "$0")  
28 -while [[ -L "$initfile" ]]; do  
29 - [[ "$initfile" =~ init\.d ]] && init_script=$(basename "$initfile")  
30 - initfile=$(readlink "$initfile")  
31 - cd "$(dirname "$initfile")" || exit 1  
32 - initfile=$(pwd)/$(basename "$initfile")  
33 -done  
34 -initfolder="$( (cd "$(dirname "initfile")" && pwd -P) )"  
35 -cd "$WORKING_DIR" || exit 1  
36 -  
37 -# Initialize CONF_FOLDER location  
38 -[[ -z "$CONF_FOLDER" ]] && CONF_FOLDER="${pkg.installFolder}/conf"  
39 -  
40 -# shellcheck source=/dev/null  
41 -[[ -r "${CONF_FOLDER}/${configfile}" ]] && source "${CONF_FOLDER}/${configfile}"  
42 -  
43 -# Initialize PID/LOG locations if they weren't provided by the config file  
44 -[[ -z "$PID_FOLDER" ]] && PID_FOLDER="/var/run"  
45 -[[ -z "$LOG_FOLDER" ]] && LOG_FOLDER="${pkg.unixLogFolder}"  
46 -! [[ "$PID_FOLDER" == /* ]] && PID_FOLDER="$(dirname "$mainfile")"/"$PID_FOLDER"  
47 -! [[ "$LOG_FOLDER" == /* ]] && LOG_FOLDER="$(dirname "$mainfile")"/"$LOG_FOLDER"  
48 -! [[ -x "$PID_FOLDER" ]] && PID_FOLDER="/tmp"  
49 -! [[ -x "$LOG_FOLDER" ]] && LOG_FOLDER="/tmp"  
50 -  
51 -# Set up defaults  
52 -[[ -z "$MODE" ]] && MODE="auto" # modes are "auto", "service" or "run"  
53 -[[ -z "$USE_START_STOP_DAEMON" ]] && USE_START_STOP_DAEMON="true"  
54 -  
55 -# Create an identity for log/pid files  
56 -if [[ -z "$identity" ]]; then  
57 - if [[ -n "$init_script" ]]; then  
58 - identity="${init_script}"  
59 - else  
60 - identity=$(basename "${initfile%.*}")_${initfolder//\//}  
61 - fi  
62 -fi  
63 -  
64 -# Initialize log file name if not provided by the config file  
65 -[[ -z "$LOG_FILENAME" ]] && LOG_FILENAME="${identity}.log"  
66 -  
67 -# ANSI Colors  
68 -echoRed() { echo $'\e[0;31m'"$1"$'\e[0m'; }  
69 -echoGreen() { echo $'\e[0;32m'"$1"$'\e[0m'; }  
70 -echoYellow() { echo $'\e[0;33m'"$1"$'\e[0m'; }  
71 -  
72 -# Utility functions  
73 -checkPermissions() {  
74 - touch "$pid_file" &> /dev/null || { echoRed "Operation not permitted (cannot access pid file)"; return 4; }  
75 - touch "$log_file" &> /dev/null || { echoRed "Operation not permitted (cannot access log file)"; return 4; }  
76 -}  
77 -  
78 -isRunning() {  
79 - ps -p "$1" &> /dev/null  
80 -}  
81 -  
82 -await_file() {  
83 - end=$(date +%s)  
84 - let "end+=10"  
85 - while [[ ! -s "$1" ]]  
86 - do  
87 - now=$(date +%s)  
88 - if [[ $now -ge $end ]]; then  
89 - break  
90 - fi  
91 - sleep 1  
92 - done  
93 -}  
94 -  
95 -# Determine the script mode  
96 -action="run"  
97 -if [[ "$MODE" == "auto" && -n "$init_script" ]] || [[ "$MODE" == "service" ]]; then  
98 - action="$1"  
99 - shift  
100 -fi  
101 -  
102 -# Build the pid and log filenames  
103 -if [[ "$identity" == "$init_script" ]] || [[ "$identity" == "$APP_NAME" ]]; then  
104 - PID_FOLDER="$PID_FOLDER/${identity}"  
105 - pid_subfolder=$PID_FOLDER  
106 -fi  
107 -pid_file="$PID_FOLDER/${identity}.pid"  
108 -log_file="$LOG_FOLDER/$LOG_FILENAME"  
109 -  
110 -# Determine the user to run as if we are root  
111 -# shellcheck disable=SC2012  
112 -[[ $(id -u) == "0" ]] && run_user=$(ls -ld "$mainfile" | awk '{print $3}')  
113 -  
114 -arguments=($RUN_ARGS "$@")  
115 -  
116 -# Action functions  
117 -start() {  
118 - if [[ -f "$pid_file" ]]; then  
119 - pid=$(cat "$pid_file")  
120 - isRunning "$pid" && { echoYellow "Already running [$pid]"; return 0; }  
121 - fi  
122 - do_start "$@"  
123 -}  
124 -  
125 -do_start() {  
126 - working_dir=$(dirname "$mainfile")  
127 - pushd "$working_dir" > /dev/null  
128 - mkdir -p "$PID_FOLDER" &> /dev/null  
129 - if [[ -n "$run_user" ]]; then  
130 - checkPermissions || return $?  
131 - if [[ -z "$pid_subfolder" ]]; then  
132 - chown "$run_user" "$pid_subfolder"  
133 - fi  
134 - chown "$run_user" "$pid_file"  
135 - chown "$run_user" "$log_file"  
136 - if [ $USE_START_STOP_DAEMON = true ] && type start-stop-daemon > /dev/null 2>&1; then  
137 - start-stop-daemon --start --quiet \  
138 - --chuid "$run_user" \  
139 - --name "$identity" \  
140 - --make-pidfile --pidfile "$pid_file" \  
141 - --background --no-close \  
142 - --startas "$mainfile" \  
143 - --chdir "$working_dir" \  
144 - -- "${arguments[@]}" \  
145 - >> "$log_file" 2>&1  
146 - await_file "$pid_file"  
147 - else  
148 - su -s /bin/sh -c "$mainfile $(printf "\"%s\" " "${arguments[@]}") >> \"$log_file\" 2>&1 & echo \$!" "$run_user" > "$pid_file"  
149 - fi  
150 - pid=$(cat "$pid_file")  
151 - else  
152 - checkPermissions || return $?  
153 - "$mainfile" "${arguments[@]}" >> "$log_file" 2>&1 &  
154 - pid=$!  
155 - disown $pid  
156 - echo "$pid" > "$pid_file"  
157 - fi  
158 - [[ -z $pid ]] && { echoRed "Failed to start"; return 1; }  
159 - echoGreen "Started [$pid]"  
160 -}  
161 -  
162 -stop() {  
163 - working_dir=$(dirname "$mainfile")  
164 - pushd "$working_dir" > /dev/null  
165 - [[ -f $pid_file ]] || { echoYellow "Not running (pidfile not found)"; return 0; }  
166 - pid=$(cat "$pid_file")  
167 - isRunning "$pid" || { echoYellow "Not running (process ${pid}). Removing stale pid file."; rm -f "$pid_file"; return 0; }  
168 - do_stop "$pid" "$pid_file"  
169 -}  
170 -  
171 -do_stop() {  
172 - kill -2 "$1" &> /dev/null || { echoRed "Unable to kill process $1"; return 1; }  
173 - for i in $(seq 1 60); do  
174 - isRunning "$1" || { echoGreen "Stopped [$1]"; rm -f "$2"; return 0; }  
175 - [[ $i -eq 30 ]] && kill -9 "$1" &> /dev/null  
176 - sleep 1  
177 - done  
178 - echoRed "Unable to kill process $1";  
179 - return 1;  
180 -}  
181 -  
182 -restart() {  
183 - stop && start  
184 -}  
185 -  
186 -orce_reload() {  
187 - working_dir=$(dirname "$mainfile")  
188 - pushd "$working_dir" > /dev/null  
189 - [[ -f $pid_file ]] || { echoRed "Not running (pidfile not found)"; return 7; }  
190 - pid=$(cat "$pid_file")  
191 - rm -f "$pid_file"  
192 - isRunning "$pid" || { echoRed "Not running (process ${pid} not found)"; return 7; }  
193 - do_stop "$pid" "$pid_file"  
194 - do_start  
195 -}  
196 -  
197 -status() {  
198 - working_dir=$(dirname "$mainfile")  
199 - pushd "$working_dir" > /dev/null  
200 - [[ -f "$pid_file" ]] || { echoRed "Not running"; return 3; }  
201 - pid=$(cat "$pid_file")  
202 - isRunning "$pid" || { echoRed "Not running (process ${pid} not found)"; return 1; }  
203 - echoGreen "Running [$pid]"  
204 - return 0  
205 -}  
206 -  
207 -run() {  
208 - pushd "$(dirname "$mainfile")" > /dev/null  
209 - "$mainfile" "${arguments[@]}"  
210 - result=$?  
211 - popd > /dev/null  
212 - return "$result"  
213 -}  
214 -  
215 -# Call the appropriate action function  
216 -case "$action" in  
217 -start)  
218 - start "$@"; exit $?;;  
219 -stop)  
220 - stop "$@"; exit $?;;  
221 -restart)  
222 - restart "$@"; exit $?;;  
223 -force-reload)  
224 - force_reload "$@"; exit $?;;  
225 -status)  
226 - status "$@"; exit $?;;  
227 -run)  
228 - run "$@"; exit $?;;  
229 -*)  
230 - echo "Usage: $0 {start|stop|restart|force-reload|status|run}"; exit 1;  
231 -esac  
232 -  
233 -exit 0  
1 -@REM  
2 -@REM Copyright © 2016-2018 The Thingsboard Authors  
3 -@REM  
4 -@REM Licensed under the Apache License, Version 2.0 (the "License");  
5 -@REM you may not use this file except in compliance with the License.  
6 -@REM You may obtain a copy of the License at  
7 -@REM  
8 -@REM http://www.apache.org/licenses/LICENSE-2.0  
9 -@REM  
10 -@REM Unless required by applicable law or agreed to in writing, software  
11 -@REM distributed under the License is distributed on an "AS IS" BASIS,  
12 -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 -@REM See the License for the specific language governing permissions and  
14 -@REM limitations under the License.  
15 -@REM  
16 -  
17 -@ECHO OFF  
18 -  
19 -setlocal ENABLEEXTENSIONS  
20 -  
21 -@ECHO Installing ${pkg.name} ...  
22 -  
23 -SET BASE=%~dp0  
24 -  
25 -"%BASE%"${pkg.name}.exe install  
26 -  
27 -@ECHO ${pkg.name} installed successfully!  
28 -  
29 -GOTO END  
30 -  
31 -:END  
1 -@REM  
2 -@REM Copyright © 2016-2018 The Thingsboard Authors  
3 -@REM  
4 -@REM Licensed under the Apache License, Version 2.0 (the "License");  
5 -@REM you may not use this file except in compliance with the License.  
6 -@REM You may obtain a copy of the License at  
7 -@REM  
8 -@REM http://www.apache.org/licenses/LICENSE-2.0  
9 -@REM  
10 -@REM Unless required by applicable law or agreed to in writing, software  
11 -@REM distributed under the License is distributed on an "AS IS" BASIS,  
12 -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 -@REM See the License for the specific language governing permissions and  
14 -@REM limitations under the License.  
15 -@REM  
16 -  
17 -@ECHO OFF  
18 -  
19 -@ECHO Stopping ${pkg.name} ...  
20 -net stop ${pkg.name}  
21 -  
22 -@ECHO Uninstalling ${pkg.name} ...  
23 -"%~dp0"${pkg.name}.exe uninstall  
24 -  
25 -@ECHO DONE.  
@@ -22,7 +22,6 @@ @@ -22,7 +22,6 @@
22 <version>2.5.1-SNAPSHOT</version> 22 <version>2.5.1-SNAPSHOT</version>
23 <artifactId>thingsboard</artifactId> 23 <artifactId>thingsboard</artifactId>
24 </parent> 24 </parent>
25 - <groupId>org.thingsboard</groupId>  
26 <artifactId>netty-mqtt</artifactId> 25 <artifactId>netty-mqtt</artifactId>
27 <version>2.5.1-SNAPSHOT</version> 26 <version>2.5.1-SNAPSHOT</version>
28 <packaging>jar</packaging> 27 <packaging>jar</packaging>
packaging/java/assembly/windows.xml renamed from application/src/main/assembly/windows.xml
packaging/java/build.gradle renamed from application/build.gradle
@@ -17,7 +17,7 @@ import org.apache.tools.ant.filters.ReplaceTokens @@ -17,7 +17,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
17 17
18 buildscript { 18 buildscript {
19 ext { 19 ext {
20 - osPackageVersion = "3.8.0" 20 + osPackageVersion = "8.3.0"
21 } 21 }
22 repositories { 22 repositories {
23 jcenter() 23 jcenter()
@@ -43,8 +43,8 @@ ospackage { @@ -43,8 +43,8 @@ ospackage {
43 43
44 into pkgInstallFolder 44 into pkgInstallFolder
45 45
46 - user pkgName  
47 - permissionGroup pkgName 46 + user pkgUser
  47 + permissionGroup pkgUser
48 48
49 // Copy the actual .jar file 49 // Copy the actual .jar file
50 from(mainJar) { 50 from(mainJar) {
@@ -56,23 +56,25 @@ ospackage { @@ -56,23 +56,25 @@ ospackage {
56 into "bin" 56 into "bin"
57 } 57 }
58 58
59 - // Copy the install files  
60 - from("target/bin/install/install.sh") {  
61 - fileMode 0775  
62 - into "bin/install"  
63 - } 59 + if("${pkgCopyInstallScripts}".equalsIgnoreCase("true")) {
  60 + // Copy the install files
  61 + from("${buildDir}/bin/install/install.sh") {
  62 + fileMode 0775
  63 + into "bin/install"
  64 + }
64 65
65 - from("target/bin/install/upgrade.sh") {  
66 - fileMode 0775  
67 - into "bin/install"  
68 - } 66 + from("${buildDir}/bin/install/upgrade.sh") {
  67 + fileMode 0775
  68 + into "bin/install"
  69 + }
69 70
70 - from("target/bin/install/logback.xml") {  
71 - into "bin/install" 71 + from("${buildDir}/bin/install/logback.xml") {
  72 + into "bin/install"
  73 + }
72 } 74 }
73 75
74 // Copy the config files 76 // Copy the config files
75 - from("target/conf") { 77 + from("${buildDir}/conf") {
76 exclude "${pkgName}.conf" 78 exclude "${pkgName}.conf"
77 fileType CONFIG | NOREPLACE 79 fileType CONFIG | NOREPLACE
78 fileMode 0754 80 fileMode 0754
@@ -80,14 +82,14 @@ ospackage { @@ -80,14 +82,14 @@ ospackage {
80 } 82 }
81 83
82 // Copy the data files 84 // Copy the data files
83 - from("target/data") { 85 + from("${buildDir}/data") {
84 fileType CONFIG | NOREPLACE 86 fileType CONFIG | NOREPLACE
85 fileMode 0754 87 fileMode 0754
86 into "data" 88 into "data"
87 } 89 }
88 90
89 // Copy the extensions files 91 // Copy the extensions files
90 - from("target/extensions") { 92 + from("${buildDir}/extensions") {
91 into "extensions" 93 into "extensions"
92 } 94 }
93 } 95 }
@@ -97,12 +99,12 @@ buildRpm { @@ -97,12 +99,12 @@ buildRpm {
97 99
98 arch = NOARCH 100 arch = NOARCH
99 101
100 - version = projectVersion.replace('-', '')  
101 - archiveName = "${pkgName}.rpm" 102 + archiveVersion = projectVersion.replace('-', '')
  103 + archiveFileName = "${pkgName}.rpm"
102 104
103 requires("java-1.8.0") 105 requires("java-1.8.0")
104 106
105 - from("target/conf") { 107 + from("${buildDir}/conf") {
106 include "${pkgName}.conf" 108 include "${pkgName}.conf"
107 filter(ReplaceTokens, tokens: ['pkg.platform': 'rpm']) 109 filter(ReplaceTokens, tokens: ['pkg.platform': 'rpm'])
108 fileType CONFIG | NOREPLACE 110 fileType CONFIG | NOREPLACE
@@ -115,17 +117,19 @@ buildRpm { @@ -115,17 +117,19 @@ buildRpm {
115 preUninstall file("${buildDir}/control/rpm/prerm") 117 preUninstall file("${buildDir}/control/rpm/prerm")
116 postUninstall file("${buildDir}/control/rpm/postrm") 118 postUninstall file("${buildDir}/control/rpm/postrm")
117 119
118 - user pkgName  
119 - permissionGroup pkgName 120 + user pkgUser
  121 + permissionGroup pkgUser
120 122
121 // Copy the system unit files 123 // Copy the system unit files
122 - from("${buildDir}/control/${pkgName}.service") { 124 + from("${buildDir}/control/template.service") {
123 addParentDirs = false 125 addParentDirs = false
124 fileMode 0644 126 fileMode 0644
125 into "/usr/lib/systemd/system" 127 into "/usr/lib/systemd/system"
  128 + rename { String filename ->
  129 + "${pkgName}.service"
  130 + }
126 } 131 }
127 132
128 - directory(pkgLogFolder, 0755)  
129 link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml") 133 link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml")
130 link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf") 134 link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
131 } 135 }
@@ -135,11 +139,11 @@ buildDeb { @@ -135,11 +139,11 @@ buildDeb {
135 139
136 arch = "all" 140 arch = "all"
137 141
138 - archiveName = "${pkgName}.deb" 142 + archiveFileName = "${pkgName}.deb"
139 143
140 requires("openjdk-8-jre").or("java8-runtime").or("oracle-java8-installer").or("openjdk-8-jre-headless") 144 requires("openjdk-8-jre").or("java8-runtime").or("oracle-java8-installer").or("openjdk-8-jre-headless")
141 145
142 - from("target/conf") { 146 + from("${buildDir}/conf") {
143 include "${pkgName}.conf" 147 include "${pkgName}.conf"
144 filter(ReplaceTokens, tokens: ['pkg.platform': 'deb']) 148 filter(ReplaceTokens, tokens: ['pkg.platform': 'deb'])
145 fileType CONFIG | NOREPLACE 149 fileType CONFIG | NOREPLACE
@@ -157,18 +161,40 @@ buildDeb { @@ -157,18 +161,40 @@ buildDeb {
157 preUninstall file("${buildDir}/control/deb/prerm") 161 preUninstall file("${buildDir}/control/deb/prerm")
158 postUninstall file("${buildDir}/control/deb/postrm") 162 postUninstall file("${buildDir}/control/deb/postrm")
159 163
160 - user pkgName  
161 - permissionGroup pkgName 164 + user pkgUser
  165 + permissionGroup pkgUser
162 166
163 // Copy the system unit files 167 // Copy the system unit files
164 - from("${buildDir}/control/${pkgName}.service") { 168 + from("${buildDir}/control/template.service") {
165 addParentDirs = false 169 addParentDirs = false
166 fileMode 0644 170 fileMode 0644
167 into "/lib/systemd/system" 171 into "/lib/systemd/system"
  172 + rename { String filename ->
  173 + "${pkgName}.service"
  174 + }
168 } 175 }
169 176
170 - directory(pkgLogFolder, 0755)  
171 link("/etc/init.d/${pkgName}", "${pkgInstallFolder}/bin/${pkgName}.jar") 177 link("/etc/init.d/${pkgName}", "${pkgInstallFolder}/bin/${pkgName}.jar")
172 link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml") 178 link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml")
173 link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf") 179 link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
174 } 180 }
  181 +
  182 +task renameDeb(type: Copy) {
  183 + from("${buildDir}/") {
  184 + include '*.deb'
  185 + destinationDir file("${buildDir}/")
  186 + rename { String filename ->
  187 + "${pkgName}.deb"
  188 + }
  189 + }
  190 +}
  191 +
  192 +task renameRpm(type: Copy) {
  193 + from("${buildDir}/") {
  194 + include '*.rpm'
  195 + destinationDir file("${buildDir}/")
  196 + rename { String filename ->
  197 + "${pkgName}.rpm"
  198 + }
  199 + }
  200 +}
packaging/java/filters/unix.properties renamed from application/src/main/filters/unix.properties
packaging/java/filters/windows.properties renamed from application/src/main/filters/windows.properties
packaging/java/scripts/control/deb/postinst renamed from application/src/main/scripts/control/deb/postinst
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 set -e 3 set -e
4 4
  5 +mkdir -m 0755 -p ${pkg.logFolder}
5 chown -R ${pkg.user}: ${pkg.logFolder} 6 chown -R ${pkg.user}: ${pkg.logFolder}
6 chown -R ${pkg.user}: ${pkg.installFolder} 7 chown -R ${pkg.user}: ${pkg.installFolder}
7 systemctl --no-reload enable ${pkg.name}.service >/dev/null 2>&1 || : 8 systemctl --no-reload enable ${pkg.name}.service >/dev/null 2>&1 || :
packaging/java/scripts/control/deb/postrm renamed from application/src/main/scripts/control/deb/postrm
packaging/java/scripts/control/deb/preinst renamed from application/src/main/scripts/control/deb/preinst
packaging/java/scripts/control/deb/prerm renamed from application/src/main/scripts/control/deb/prerm
packaging/java/scripts/control/rpm/postinst renamed from application/src/main/scripts/control/rpm/postinst
1 #!/bin/sh 1 #!/bin/sh
2 2
  3 +mkdir -m 0755 -p ${pkg.logFolder}
3 chown -R ${pkg.user}: ${pkg.logFolder} 4 chown -R ${pkg.user}: ${pkg.logFolder}
4 chown -R ${pkg.user}: ${pkg.installFolder} 5 chown -R ${pkg.user}: ${pkg.installFolder}
5 6
packaging/java/scripts/control/rpm/postrm renamed from application/src/main/scripts/control/rpm/postrm
packaging/java/scripts/control/rpm/preinst renamed from application/src/main/scripts/control/rpm/preinst
packaging/java/scripts/control/rpm/prerm renamed from application/src/main/scripts/control/rpm/prerm
packaging/java/scripts/control/template.service renamed from application/src/main/scripts/control/thingsboard.service
packaging/java/scripts/install/install.sh renamed from application/src/main/scripts/install/install.sh
packaging/java/scripts/install/install_dev_db.sh renamed from application/src/main/scripts/install/install_dev_db.sh
packaging/java/scripts/install/logback.xml renamed from application/src/main/scripts/install/logback.xml
packaging/java/scripts/install/upgrade.sh renamed from application/src/main/scripts/install/upgrade.sh
packaging/java/scripts/install/upgrade_dev_db.sh renamed from application/src/main/scripts/install/upgrade_dev_db.sh
packaging/java/scripts/windows/install.bat renamed from application/src/main/scripts/windows/install.bat
packaging/java/scripts/windows/install_dev_db.bat renamed from application/src/main/scripts/windows/install_dev_db.bat
packaging/java/scripts/windows/service.xml renamed from application/src/main/scripts/windows/service.xml
packaging/java/scripts/windows/uninstall.bat renamed from application/src/main/scripts/windows/uninstall.bat
packaging/java/scripts/windows/upgrade.bat renamed from application/src/main/scripts/windows/upgrade.bat
packaging/js/assembly/windows.xml renamed from msa/web-ui/src/main/assembly/windows.xml
packaging/js/build.gradle renamed from msa/web-ui/build.gradle
@@ -17,7 +17,7 @@ import org.apache.tools.ant.filters.ReplaceTokens @@ -17,7 +17,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
17 17
18 buildscript { 18 buildscript {
19 ext { 19 ext {
20 - osPackageVersion = "3.8.0" 20 + osPackageVersion = "8.3.0"
21 } 21 }
22 repositories { 22 repositories {
23 jcenter() 23 jcenter()
@@ -47,26 +47,29 @@ ospackage { @@ -47,26 +47,29 @@ ospackage {
47 permissionGroup pkgUser 47 permissionGroup pkgUser
48 48
49 // Copy the executable file 49 // Copy the executable file
50 - from("target/package/linux/bin/${pkgName}") { 50 + from("${buildDir}/package/linux/bin/${pkgName}") {
51 fileMode 0500 51 fileMode 0500
52 into "bin" 52 into "bin"
53 } 53 }
54 54
55 // Copy the init file 55 // Copy the init file
56 - from("target/package/linux/init/${pkgName}") { 56 + from("${buildDir}/package/linux/init/template") {
57 fileMode 0500 57 fileMode 0500
58 into "init" 58 into "init"
  59 + rename { String filename ->
  60 + "${pkgName}"
  61 + }
59 } 62 }
60 63
61 // Copy the config files 64 // Copy the config files
62 - from("target/package/linux/conf") { 65 + from("${buildDir}/package/linux/conf") {
63 fileType CONFIG | NOREPLACE 66 fileType CONFIG | NOREPLACE
64 fileMode 0754 67 fileMode 0754
65 into "conf" 68 into "conf"
66 } 69 }
67 70
68 // Copy web files 71 // Copy web files
69 - from("target/web") { 72 + from("${buildDir}/web") {
70 into "web" 73 into "web"
71 } 74 }
72 75
@@ -77,8 +80,8 @@ buildRpm { @@ -77,8 +80,8 @@ buildRpm {
77 80
78 arch = X86_64 81 arch = X86_64
79 82
80 - version = projectVersion.replace('-', '')  
81 - archiveName = "${pkgName}.rpm" 83 + archiveVersion = projectVersion.replace('-', '')
  84 + archiveFileName = "${pkgName}.rpm"
82 85
83 preInstall file("${buildDir}/control/rpm/preinst") 86 preInstall file("${buildDir}/control/rpm/preinst")
84 postInstall file("${buildDir}/control/rpm/postinst") 87 postInstall file("${buildDir}/control/rpm/postinst")
@@ -95,7 +98,6 @@ buildRpm { @@ -95,7 +98,6 @@ buildRpm {
95 into "/usr/lib/systemd/system" 98 into "/usr/lib/systemd/system"
96 } 99 }
97 100
98 - directory(pkgLogFolder, 0755)  
99 link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf") 101 link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
100 } 102 }
101 103
@@ -104,7 +106,7 @@ buildDeb { @@ -104,7 +106,7 @@ buildDeb {
104 106
105 arch = "amd64" 107 arch = "amd64"
106 108
107 - archiveName = "${pkgName}.deb" 109 + archiveFileName = "${pkgName}.deb"
108 110
109 configurationFile("${pkgInstallFolder}/conf/${pkgName}.conf") 111 configurationFile("${pkgInstallFolder}/conf/${pkgName}.conf")
110 configurationFile("${pkgInstallFolder}/conf/custom-environment-variables.yml") 112 configurationFile("${pkgInstallFolder}/conf/custom-environment-variables.yml")
@@ -119,7 +121,26 @@ buildDeb { @@ -119,7 +121,26 @@ buildDeb {
119 user pkgUser 121 user pkgUser
120 permissionGroup pkgUser 122 permissionGroup pkgUser
121 123
122 - directory(pkgLogFolder, 0755)  
123 link("/etc/init.d/${pkgName}", "${pkgInstallFolder}/init/${pkgName}") 124 link("/etc/init.d/${pkgName}", "${pkgInstallFolder}/init/${pkgName}")
124 link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf") 125 link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
125 } 126 }
  127 +
  128 +task renameDeb(type: Copy) {
  129 + from("${buildDir}/") {
  130 + include '*.deb'
  131 + destinationDir file("${buildDir}/")
  132 + rename { String filename ->
  133 + "${pkgName}.deb"
  134 + }
  135 + }
  136 +}
  137 +
  138 +task renameRpm(type: Copy) {
  139 + from("${buildDir}/") {
  140 + include '*.rpm'
  141 + destinationDir file("${buildDir}/")
  142 + rename { String filename ->
  143 + "${pkgName}.rpm"
  144 + }
  145 + }
  146 +}
packaging/js/filters/unix.properties renamed from msa/js-executor/src/main/filters/unix.properties
packaging/js/filters/windows.properties renamed from msa/js-executor/src/main/filters/windows.properties
packaging/js/scripts/control/deb/postinst renamed from msa/js-executor/src/main/scripts/control/deb/postinst
1 #!/bin/sh 1 #!/bin/sh
2 2
  3 +mkdir -m 0755 -p ${pkg.logFolder}
3 chown -R ${pkg.user}: ${pkg.logFolder} 4 chown -R ${pkg.user}: ${pkg.logFolder}
4 chown -R ${pkg.user}: ${pkg.installFolder} 5 chown -R ${pkg.user}: ${pkg.installFolder}
5 update-rc.d ${pkg.name} defaults 6 update-rc.d ${pkg.name} defaults
packaging/js/scripts/control/deb/postrm renamed from msa/js-executor/src/main/scripts/control/deb/postrm
packaging/js/scripts/control/deb/preinst renamed from msa/js-executor/src/main/scripts/control/deb/preinst
packaging/js/scripts/control/deb/prerm renamed from msa/js-executor/src/main/scripts/control/deb/prerm
packaging/js/scripts/control/rpm/postinst renamed from msa/js-executor/src/main/scripts/control/rpm/postinst
1 #!/bin/sh 1 #!/bin/sh
2 2
  3 +mkdir -m 0755 -p ${pkg.logFolder}
3 chown -R ${pkg.user}: ${pkg.logFolder} 4 chown -R ${pkg.user}: ${pkg.logFolder}
4 chown -R ${pkg.user}: ${pkg.installFolder} 5 chown -R ${pkg.user}: ${pkg.installFolder}
5 6
packaging/js/scripts/control/rpm/postrm renamed from msa/js-executor/src/main/scripts/control/rpm/postrm
packaging/js/scripts/control/rpm/preinst renamed from msa/js-executor/src/main/scripts/control/rpm/preinst
packaging/js/scripts/control/rpm/prerm renamed from msa/js-executor/src/main/scripts/control/rpm/prerm
packaging/js/scripts/control/template.service renamed from msa/js-executor/src/main/scripts/control/tb-js-executor.service
packaging/js/scripts/init/template renamed from msa/js-executor/src/main/scripts/init/tb-js-executor
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 3
4 4
5 ### BEGIN INIT INFO 5 ### BEGIN INIT INFO
6 -# Provides: tb-js-executor 6 +# Provides: ${pkg.name}
7 # Required-Start: $remote_fs $syslog $network 7 # Required-Start: $remote_fs $syslog $network
8 # Required-Stop: $remote_fs $syslog $network 8 # Required-Stop: $remote_fs $syslog $network
9 # Default-Start: 2 3 4 5 9 # Default-Start: 2 3 4 5
packaging/js/scripts/windows/install.bat renamed from msa/js-executor/src/main/scripts/windows/install.bat
packaging/js/scripts/windows/service.xml renamed from msa/web-ui/src/main/scripts/windows/service.xml
packaging/js/scripts/windows/uninstall.bat renamed from msa/js-executor/src/main/scripts/windows/uninstall.bat
@@ -29,7 +29,13 @@ @@ -29,7 +29,13 @@
29 29
30 <properties> 30 <properties>
31 <main.dir>${basedir}</main.dir> 31 <main.dir>${basedir}</main.dir>
  32 + <pkg.disabled>true</pkg.disabled>
  33 + <pkg.process-resources.phase>none</pkg.process-resources.phase>
  34 + <pkg.package.phase>none</pkg.package.phase>
32 <pkg.user>thingsboard</pkg.user> 35 <pkg.user>thingsboard</pkg.user>
  36 + <pkg.implementationTitle>${project.name}</pkg.implementationTitle>
  37 + <pkg.unixLogFolder>/var/log/${pkg.name}</pkg.unixLogFolder>
  38 + <pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder>
33 <spring-boot.version>2.2.6.RELEASE</spring-boot.version> 39 <spring-boot.version>2.2.6.RELEASE</spring-boot.version>
34 <spring-oauth2.version>2.1.2.RELEASE</spring-oauth2.version> 40 <spring-oauth2.version>2.1.2.RELEASE</spring-oauth2.version>
35 <spring.version>5.2.6.RELEASE</spring.version> 41 <spring.version>5.2.6.RELEASE</spring.version>
@@ -133,6 +139,394 @@ @@ -133,6 +139,394 @@
133 <downloadJavadocs>true</downloadJavadocs> 139 <downloadJavadocs>true</downloadJavadocs>
134 </properties> 140 </properties>
135 </profile> 141 </profile>
  142 +
  143 + <profile>
  144 + <id>packaging</id>
  145 + <activation>
  146 + <activeByDefault>true</activeByDefault>
  147 + </activation>
  148 + <build>
  149 + <pluginManagement>
  150 + <plugins>
  151 + <plugin>
  152 + <groupId>org.apache.maven.plugins</groupId>
  153 + <artifactId>maven-resources-plugin</artifactId>
  154 + <executions>
  155 + <execution>
  156 + <id>copy-conf</id>
  157 + <phase>${pkg.process-resources.phase}</phase>
  158 + <goals>
  159 + <goal>copy-resources</goal>
  160 + </goals>
  161 + <configuration>
  162 + <outputDirectory>${project.build.directory}/conf</outputDirectory>
  163 + <resources>
  164 + <resource>
  165 + <directory>src/main/resources</directory>
  166 + <excludes>
  167 + <exclude>logback.xml</exclude>
  168 + </excludes>
  169 + <filtering>false</filtering>
  170 + </resource>
  171 + </resources>
  172 + </configuration>
  173 + </execution>
  174 + <execution>
  175 + <id>copy-service-conf</id>
  176 + <phase>${pkg.process-resources.phase}</phase>
  177 + <goals>
  178 + <goal>copy-resources</goal>
  179 + </goals>
  180 + <configuration>
  181 + <outputDirectory>${project.build.directory}/conf</outputDirectory>
  182 + <resources>
  183 + <resource>
  184 + <directory>src/main/conf</directory>
  185 + <filtering>true</filtering>
  186 + </resource>
  187 + </resources>
  188 + <filters>
  189 + <filter>${main.dir}/packaging/${pkg.type}/filters/unix.properties</filter>
  190 + </filters>
  191 + </configuration>
  192 + </execution>
  193 + <execution>
  194 + <id>copy-linux-conf</id>
  195 + <phase>${pkg.process-resources.phase}</phase>
  196 + <goals>
  197 + <goal>copy-resources</goal>
  198 + </goals>
  199 + <configuration>
  200 + <outputDirectory>${pkg.linux.dist}/conf</outputDirectory>
  201 + <resources>
  202 + <resource>
  203 + <directory>config</directory>
  204 + <filtering>true</filtering>
  205 + </resource>
  206 + </resources>
  207 + <filters>
  208 + <filter>${main.dir}/packaging/${pkg.type}/filters/unix.properties</filter>
  209 + </filters>
  210 + </configuration>
  211 + </execution>
  212 + <execution>
  213 + <id>copy-linux-init</id>
  214 + <phase>${pkg.process-resources.phase}</phase>
  215 + <goals>
  216 + <goal>copy-resources</goal>
  217 + </goals>
  218 + <configuration>
  219 + <outputDirectory>${pkg.linux.dist}/init</outputDirectory>
  220 + <resources>
  221 + <resource>
  222 + <directory>${main.dir}/packaging/${pkg.type}/scripts/init</directory>
  223 + <filtering>true</filtering>
  224 + </resource>
  225 + </resources>
  226 + <filters>
  227 + <filter>${main.dir}/packaging/${pkg.type}/filters/unix.properties</filter>
  228 + </filters>
  229 + </configuration>
  230 + </execution>
  231 + <execution>
  232 + <id>copy-win-conf</id>
  233 + <phase>${pkg.process-resources.phase}</phase>
  234 + <goals>
  235 + <goal>copy-resources</goal>
  236 + </goals>
  237 + <configuration>
  238 + <outputDirectory>${pkg.win.dist}/conf</outputDirectory>
  239 + <resources>
  240 + <resource>
  241 + <directory>src/main/resources</directory>
  242 + <excludes>
  243 + <exclude>logback.xml</exclude>
  244 + </excludes>
  245 + <filtering>false</filtering>
  246 + </resource>
  247 + <resource>
  248 + <directory>src/main/conf</directory>
  249 + <excludes>
  250 + <exclude>${pkg.name}.conf</exclude>
  251 + </excludes>
  252 + <filtering>true</filtering>
  253 + </resource>
  254 + </resources>
  255 + <filters>
  256 + <filter>${main.dir}/packaging/${pkg.type}/filters/windows.properties</filter>
  257 + </filters>
  258 + </configuration>
  259 + </execution>
  260 + <execution>
  261 + <id>copy-control</id>
  262 + <phase>${pkg.process-resources.phase}</phase>
  263 + <goals>
  264 + <goal>copy-resources</goal>
  265 + </goals>
  266 + <configuration>
  267 + <outputDirectory>${project.build.directory}/control</outputDirectory>
  268 + <resources>
  269 + <resource>
  270 + <directory>${main.dir}/packaging/${pkg.type}/scripts/control</directory>
  271 + <filtering>true</filtering>
  272 + </resource>
  273 + </resources>
  274 + <filters>
  275 + <filter>${main.dir}/packaging/${pkg.type}/filters/unix.properties</filter>
  276 + </filters>
  277 + </configuration>
  278 + </execution>
  279 + <execution>
  280 + <id>copy-install</id>
  281 + <phase>${pkg.process-resources.phase}</phase>
  282 + <goals>
  283 + <goal>copy-resources</goal>
  284 + </goals>
  285 + <configuration>
  286 + <outputDirectory>${project.build.directory}/bin/install</outputDirectory>
  287 + <resources>
  288 + <resource>
  289 + <directory>${main.dir}/packaging/${pkg.type}/scripts/install</directory>
  290 + <includes>
  291 + <include>**/*.sh</include>
  292 + <include>**/*.xml</include>
  293 + </includes>
  294 + <filtering>true</filtering>
  295 + </resource>
  296 + </resources>
  297 + <filters>
  298 + <filter>${main.dir}/packaging/${pkg.type}/filters/unix.properties</filter>
  299 + </filters>
  300 + </configuration>
  301 + </execution>
  302 + <execution>
  303 + <id>copy-windows-control</id>
  304 + <phase>${pkg.process-resources.phase}</phase>
  305 + <goals>
  306 + <goal>copy-resources</goal>
  307 + </goals>
  308 + <configuration>
  309 + <outputDirectory>${pkg.win.dist}</outputDirectory>
  310 + <resources>
  311 + <resource>
  312 + <directory>${main.dir}/packaging/${pkg.type}/scripts/windows</directory>
  313 + <filtering>true</filtering>
  314 + </resource>
  315 + </resources>
  316 + <filters>
  317 + <filter>${main.dir}/packaging/${pkg.type}/filters/windows.properties</filter>
  318 + </filters>
  319 + </configuration>
  320 + </execution>
  321 + <execution>
  322 + <id>copy-windows-install</id>
  323 + <phase>${pkg.process-resources.phase}</phase>
  324 + <goals>
  325 + <goal>copy-resources</goal>
  326 + </goals>
  327 + <configuration>
  328 + <outputDirectory>${pkg.win.dist}/install</outputDirectory>
  329 + <resources>
  330 + <resource>
  331 + <directory>${main.dir}/packaging/${pkg.type}/scripts/install</directory>
  332 + <includes>
  333 + <include>logback.xml</include>
  334 + </includes>
  335 + <filtering>true</filtering>
  336 + </resource>
  337 + </resources>
  338 + <filters>
  339 + <filter>${main.dir}/packaging/${pkg.type}/filters/windows.properties</filter>
  340 + </filters>
  341 + </configuration>
  342 + </execution>
  343 + <execution>
  344 + <id>copy-data</id>
  345 + <phase>${pkg.process-resources.phase}</phase>
  346 + <goals>
  347 + <goal>copy-resources</goal>
  348 + </goals>
  349 + <configuration>
  350 + <outputDirectory>${project.build.directory}/data</outputDirectory>
  351 + <resources>
  352 + <resource>
  353 + <directory>src/main/data</directory>
  354 + </resource>
  355 + <resource>
  356 + <directory>../dao/src/main/resources</directory>
  357 + <includes>
  358 + <include>**/*.cql</include>
  359 + <include>**/*.sql</include>
  360 + </includes>
  361 + <filtering>false</filtering>
  362 + </resource>
  363 + </resources>
  364 + </configuration>
  365 + </execution>
  366 + <execution>
  367 + <id>copy-docker-config</id>
  368 + <phase>${pkg.process-resources.phase}</phase>
  369 + <goals>
  370 + <goal>copy-resources</goal>
  371 + </goals>
  372 + <configuration>
  373 + <outputDirectory>${project.build.directory}</outputDirectory>
  374 + <resources>
  375 + <resource>
  376 + <directory>docker</directory>
  377 + <filtering>true</filtering>
  378 + </resource>
  379 + </resources>
  380 + </configuration>
  381 + </execution>
  382 + </executions>
  383 + </plugin>
  384 + <plugin>
  385 + <groupId>org.apache.maven.plugins</groupId>
  386 + <artifactId>maven-dependency-plugin</artifactId>
  387 + <executions>
  388 + <execution>
  389 + <id>copy-winsw-service</id>
  390 + <phase>${pkg.package.phase}</phase>
  391 + <goals>
  392 + <goal>copy</goal>
  393 + </goals>
  394 + <configuration>
  395 + <artifactItems>
  396 + <artifactItem>
  397 + <groupId>com.sun.winsw</groupId>
  398 + <artifactId>winsw</artifactId>
  399 + <classifier>bin</classifier>
  400 + <type>exe</type>
  401 + <destFileName>service.exe</destFileName>
  402 + </artifactItem>
  403 + </artifactItems>
  404 + <outputDirectory>${pkg.win.dist}</outputDirectory>
  405 + </configuration>
  406 + </execution>
  407 + </executions>
  408 + </plugin>
  409 + <plugin>
  410 + <groupId>org.apache.maven.plugins</groupId>
  411 + <artifactId>maven-jar-plugin</artifactId>
  412 + <configuration>
  413 + <excludes>
  414 + <exclude>**/logback.xml</exclude>
  415 + </excludes>
  416 + <archive>
  417 + <manifestEntries>
  418 + <Implementation-Title>${pkg.implementationTitle}</Implementation-Title>
  419 + <Implementation-Version>${project.version}</Implementation-Version>
  420 + </manifestEntries>
  421 + </archive>
  422 + </configuration>
  423 + </plugin>
  424 + <plugin>
  425 + <groupId>org.springframework.boot</groupId>
  426 + <artifactId>spring-boot-maven-plugin</artifactId>
  427 + <configuration>
  428 + <skip>${pkg.disabled}</skip>
  429 + <mainClass>${pkg.mainClass}</mainClass>
  430 + <classifier>boot</classifier>
  431 + <layout>ZIP</layout>
  432 + <executable>true</executable>
  433 + <excludeDevtools>true</excludeDevtools>
  434 + <embeddedLaunchScriptProperties>
  435 + <confFolder>${pkg.installFolder}/conf</confFolder>
  436 + <logFolder>${pkg.unixLogFolder}</logFolder>
  437 + <logFilename>${pkg.name}.out</logFilename>
  438 + <initInfoProvides>${pkg.name}</initInfoProvides>
  439 + </embeddedLaunchScriptProperties>
  440 + </configuration>
  441 + <executions>
  442 + <execution>
  443 + <goals>
  444 + <goal>repackage</goal>
  445 + </goals>
  446 + </execution>
  447 + </executions>
  448 + </plugin>
  449 + <plugin>
  450 + <groupId>org.thingsboard</groupId>
  451 + <artifactId>gradle-maven-plugin</artifactId>
  452 + <configuration>
  453 + <gradleProjectDirectory>${main.dir}/packaging/${pkg.type}</gradleProjectDirectory>
  454 + <tasks>
  455 + <task>build</task>
  456 + <task>buildDeb</task>
  457 + <task>buildRpm</task>
  458 + <task>renameDeb</task>
  459 + <task>renameRpm</task>
  460 + </tasks>
  461 + <args>
  462 + <arg>-PpackagingDir=${main.dir}/packaging</arg>
  463 + <arg>-PprojectBuildDir=${basedir}/target</arg>
  464 + <arg>-PprojectVersion=${project.version}</arg>
  465 + <arg>
  466 + -PmainJar=${project.build.directory}/${project.build.finalName}-boot.${project.packaging}
  467 + </arg>
  468 + <arg>-PpkgName=${pkg.name}</arg>
  469 + <arg>-PpkgUser=${pkg.user}</arg>
  470 + <arg>-PpkgInstallFolder=${pkg.installFolder}</arg>
  471 + <arg>-PpkgCopyInstallScripts=${pkg.copyInstallScripts}</arg>
  472 + <arg>-PpkgLogFolder=${pkg.unixLogFolder}</arg>
  473 + <arg>--warning-mode</arg>
  474 + <arg>all</arg>
  475 + </args>
  476 + </configuration>
  477 + <executions>
  478 + <execution>
  479 + <phase>${pkg.package.phase}</phase>
  480 + <goals>
  481 + <goal>invoke</goal>
  482 + </goals>
  483 + </execution>
  484 + </executions>
  485 + </plugin>
  486 + <plugin>
  487 + <groupId>org.apache.maven.plugins</groupId>
  488 + <artifactId>maven-assembly-plugin</artifactId>
  489 + <configuration>
  490 + <finalName>${pkg.name}</finalName>
  491 + <descriptors>
  492 + <descriptor>${main.dir}/packaging/${pkg.type}/assembly/windows.xml</descriptor>
  493 + </descriptors>
  494 + </configuration>
  495 + <executions>
  496 + <execution>
  497 + <id>assembly</id>
  498 + <phase>${pkg.package.phase}</phase>
  499 + <goals>
  500 + <goal>single</goal>
  501 + </goals>
  502 + </execution>
  503 + </executions>
  504 + </plugin>
  505 + <plugin>
  506 + <groupId>org.apache.maven.plugins</groupId>
  507 + <artifactId>maven-install-plugin</artifactId>
  508 + <configuration>
  509 + <file>${project.build.directory}/${pkg.name}.deb</file>
  510 + <artifactId>${project.artifactId}</artifactId>
  511 + <groupId>${project.groupId}</groupId>
  512 + <version>${project.version}</version>
  513 + <classifier>deb</classifier>
  514 + <packaging>deb</packaging>
  515 + </configuration>
  516 + <executions>
  517 + <execution>
  518 + <id>install-deb</id>
  519 + <phase>${pkg.package.phase}</phase>
  520 + <goals>
  521 + <goal>install-file</goal>
  522 + </goals>
  523 + </execution>
  524 + </executions>
  525 + </plugin>
  526 + </plugins>
  527 + </pluginManagement>
  528 + </build>
  529 + </profile>
136 </profiles> 530 </profiles>
137 531
138 <build> 532 <build>
@@ -182,7 +576,7 @@ @@ -182,7 +576,7 @@
182 <plugin> 576 <plugin>
183 <groupId>org.thingsboard</groupId> 577 <groupId>org.thingsboard</groupId>
184 <artifactId>gradle-maven-plugin</artifactId> 578 <artifactId>gradle-maven-plugin</artifactId>
185 - <version>1.0.9</version> 579 + <version>1.0.10</version>
186 </plugin> 580 </plugin>
187 <plugin> 581 <plugin>
188 <groupId>org.apache.maven.plugins</groupId> 582 <groupId>org.apache.maven.plugins</groupId>
@@ -321,6 +715,12 @@ @@ -321,6 +715,12 @@
321 <exclude>src/vendor/**</exclude> 715 <exclude>src/vendor/**</exclude>
322 <exclude>src/font/**</exclude> 716 <exclude>src/font/**</exclude>
323 <exclude>src/sh/**</exclude> 717 <exclude>src/sh/**</exclude>
  718 + <exclude>packaging/*/scripts/control/**</exclude>
  719 + <exclude>packaging/*/scripts/windows/**</exclude>
  720 + <exclude>packaging/*/scripts/init/**</exclude>
  721 + <exclude>**/*.log</exclude>
  722 + <exclude>**/*.current</exclude>
  723 + <exclude>.instance_id</exclude>
324 <exclude>src/main/scripts/control/**</exclude> 724 <exclude>src/main/scripts/control/**</exclude>
325 <exclude>src/main/scripts/windows/**</exclude> 725 <exclude>src/main/scripts/windows/**</exclude>
326 <exclude>src/main/resources/public/static/rulenode/**</exclude> 726 <exclude>src/main/resources/public/static/rulenode/**</exclude>
@@ -1032,5 +1432,4 @@ @@ -1032,5 +1432,4 @@
1032 <url>https://oss.sonatype.org/content/groups/public</url> 1432 <url>https://oss.sonatype.org/content/groups/public</url>
1033 </repository> 1433 </repository>
1034 </repositories> 1434 </repositories>
1035 -  
1036 </project> 1435 </project>
@@ -155,31 +155,6 @@ @@ -155,31 +155,6 @@
155 <groupId>org.codehaus.mojo</groupId> 155 <groupId>org.codehaus.mojo</groupId>
156 <artifactId>build-helper-maven-plugin</artifactId> 156 <artifactId>build-helper-maven-plugin</artifactId>
157 </plugin> 157 </plugin>
158 - <plugin>  
159 - <groupId>org.springframework.boot</groupId>  
160 - <artifactId>spring-boot-maven-plugin</artifactId>  
161 - <configuration>  
162 - <mainClass>org.thingsboard.server.dao.queue.QueueBenchmark</mainClass>  
163 - <classifier>boot</classifier>  
164 - <layout>ZIP</layout>  
165 - <executable>true</executable>  
166 - <excludeDevtools>true</excludeDevtools>  
167 - <!--<embeddedLaunchScriptProperties>-->  
168 - <!--<confFolder>${pkg.installFolder}/conf</confFolder>-->  
169 - <!--<logFolder>${pkg.unixLogFolder}</logFolder>-->  
170 - <!--<logFilename>${pkg.name}.out</logFilename>-->  
171 - <!--<initInfoProvides>${pkg.name}</initInfoProvides>-->  
172 - <!--</embeddedLaunchScriptProperties>-->  
173 - </configuration>  
174 - <executions>  
175 - <execution>  
176 - <goals>  
177 - <goal>repackage</goal>  
178 - </goals>  
179 - </execution>  
180 - </executions>  
181 - </plugin>  
182 -  
183 </plugins> 158 </plugins>
184 </build> 159 </build>
185 160
1 -/**  
2 - * Copyright © 2016-2020 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -import org.apache.tools.ant.filters.ReplaceTokens  
17 -  
18 -buildscript {  
19 - ext {  
20 - osPackageVersion = "3.8.0"  
21 - }  
22 - repositories {  
23 - jcenter()  
24 - }  
25 - dependencies {  
26 - classpath("com.netflix.nebula:gradle-ospackage-plugin:${osPackageVersion}")  
27 - }  
28 -}  
29 -  
30 -apply plugin: "nebula.ospackage"  
31 -  
32 -buildDir = projectBuildDir  
33 -version = projectVersion  
34 -distsDirName = "./"  
35 -  
36 -// OS Package plugin configuration  
37 -ospackage {  
38 - packageName = pkgName  
39 - version = "${project.version}"  
40 - release = 1  
41 - os = LINUX  
42 - type = BINARY  
43 -  
44 - into pkgInstallFolder  
45 -  
46 - user pkgName  
47 - permissionGroup pkgName  
48 -  
49 - // Copy the actual .jar file  
50 - from(mainJar) {  
51 - // Strip the version from the jar filename  
52 - rename { String fileName ->  
53 - "${pkgName}.jar"  
54 - }  
55 - fileMode 0500  
56 - into "bin"  
57 - }  
58 -  
59 - // Copy the config files  
60 - from("target/conf") {  
61 - exclude "${pkgName}.conf"  
62 - fileType CONFIG | NOREPLACE  
63 - fileMode 0754  
64 - into "conf"  
65 - }  
66 -  
67 -}  
68 -  
69 -// Configure our RPM build task  
70 -buildRpm {  
71 -  
72 - arch = NOARCH  
73 -  
74 - version = projectVersion.replace('-', '')  
75 - archiveName = "${pkgName}.rpm"  
76 -  
77 - requires("java-1.8.0")  
78 -  
79 - from("target/conf") {  
80 - include "${pkgName}.conf"  
81 - filter(ReplaceTokens, tokens: ['pkg.platform': 'rpm'])  
82 - fileType CONFIG | NOREPLACE  
83 - fileMode 0754  
84 - into "${pkgInstallFolder}/conf"  
85 - }  
86 -  
87 - preInstall file("${buildDir}/control/rpm/preinst")  
88 - postInstall file("${buildDir}/control/rpm/postinst")  
89 - preUninstall file("${buildDir}/control/rpm/prerm")  
90 - postUninstall file("${buildDir}/control/rpm/postrm")  
91 -  
92 - user pkgName  
93 - permissionGroup pkgName  
94 -  
95 - // Copy the system unit files  
96 - from("${buildDir}/control/${pkgName}.service") {  
97 - addParentDirs = false  
98 - fileMode 0644  
99 - into "/usr/lib/systemd/system"  
100 - }  
101 -  
102 - directory(pkgLogFolder, 0755)  
103 - link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml")  
104 - link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")  
105 -}  
106 -  
107 -// Same as the buildRpm task  
108 -buildDeb {  
109 -  
110 - arch = "all"  
111 -  
112 - archiveName = "${pkgName}.deb"  
113 -  
114 - requires("openjdk-8-jre").or("java8-runtime").or("oracle-java8-installer").or("openjdk-8-jre-headless")  
115 -  
116 - from("target/conf") {  
117 - include "${pkgName}.conf"  
118 - filter(ReplaceTokens, tokens: ['pkg.platform': 'deb'])  
119 - fileType CONFIG | NOREPLACE  
120 - fileMode 0754  
121 - into "${pkgInstallFolder}/conf"  
122 - }  
123 -  
124 - configurationFile("${pkgInstallFolder}/conf/${pkgName}.conf")  
125 - configurationFile("${pkgInstallFolder}/conf/${pkgName}.yml")  
126 - configurationFile("${pkgInstallFolder}/conf/logback.xml")  
127 -  
128 - preInstall file("${buildDir}/control/deb/preinst")  
129 - postInstall file("${buildDir}/control/deb/postinst")  
130 - preUninstall file("${buildDir}/control/deb/prerm")  
131 - postUninstall file("${buildDir}/control/deb/postrm")  
132 -  
133 - user pkgName  
134 - permissionGroup pkgName  
135 -  
136 - directory(pkgLogFolder, 0755)  
137 - link("/etc/init.d/${pkgName}", "${pkgInstallFolder}/bin/${pkgName}.jar")  
138 - link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml")  
139 - link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")  
140 -}  
@@ -33,10 +33,15 @@ @@ -33,10 +33,15 @@
33 <properties> 33 <properties>
34 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 34 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
35 <main.dir>${basedir}/../..</main.dir> 35 <main.dir>${basedir}/../..</main.dir>
  36 + <pkg.type>java</pkg.type>
  37 + <pkg.disabled>false</pkg.disabled>
  38 + <pkg.process-resources.phase>process-resources</pkg.process-resources.phase>
  39 + <pkg.package.phase>package</pkg.package.phase>
36 <pkg.name>tb-coap-transport</pkg.name> 40 <pkg.name>tb-coap-transport</pkg.name>
37 - <pkg.unixLogFolder>/var/log/${pkg.name}</pkg.unixLogFolder>  
38 - <pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder> 41 + <pkg.copyInstallScripts>false</pkg.copyInstallScripts>
39 <pkg.win.dist>${project.build.directory}/windows</pkg.win.dist> 42 <pkg.win.dist>${project.build.directory}/windows</pkg.win.dist>
  43 + <pkg.implementationTitle>ThingsBoard CoAP Transport Service</pkg.implementationTitle>
  44 + <pkg.mainClass>org.thingsboard.server.coap.ThingsboardCoapTransportApplication</pkg.mainClass>
40 </properties> 45 </properties>
41 46
42 <dependencies> 47 <dependencies>
@@ -87,244 +92,30 @@ @@ -87,244 +92,30 @@
87 <plugin> 92 <plugin>
88 <groupId>org.apache.maven.plugins</groupId> 93 <groupId>org.apache.maven.plugins</groupId>
89 <artifactId>maven-resources-plugin</artifactId> 94 <artifactId>maven-resources-plugin</artifactId>
90 - <executions>  
91 - <execution>  
92 - <id>copy-conf</id>  
93 - <phase>process-resources</phase>  
94 - <goals>  
95 - <goal>copy-resources</goal>  
96 - </goals>  
97 - <configuration>  
98 - <outputDirectory>${project.build.directory}/conf</outputDirectory>  
99 - <resources>  
100 - <resource>  
101 - <directory>src/main/resources</directory>  
102 - <excludes>  
103 - <exclude>logback.xml</exclude>  
104 - </excludes>  
105 - <filtering>false</filtering>  
106 - </resource>  
107 - </resources>  
108 - </configuration>  
109 - </execution>  
110 - <execution>  
111 - <id>copy-service-conf</id>  
112 - <phase>process-resources</phase>  
113 - <goals>  
114 - <goal>copy-resources</goal>  
115 - </goals>  
116 - <configuration>  
117 - <outputDirectory>${project.build.directory}/conf</outputDirectory>  
118 - <resources>  
119 - <resource>  
120 - <directory>src/main/conf</directory>  
121 - <filtering>true</filtering>  
122 - </resource>  
123 - </resources>  
124 - <filters>  
125 - <filter>src/main/filters/unix.properties</filter>  
126 - </filters>  
127 - </configuration>  
128 - </execution>  
129 - <execution>  
130 - <id>copy-win-conf</id>  
131 - <phase>process-resources</phase>  
132 - <goals>  
133 - <goal>copy-resources</goal>  
134 - </goals>  
135 - <configuration>  
136 - <outputDirectory>${pkg.win.dist}/conf</outputDirectory>  
137 - <resources>  
138 - <resource>  
139 - <directory>src/main/resources</directory>  
140 - <excludes>  
141 - <exclude>logback.xml</exclude>  
142 - </excludes>  
143 - <filtering>false</filtering>  
144 - </resource>  
145 - <resource>  
146 - <directory>src/main/conf</directory>  
147 - <excludes>  
148 - <exclude>tb-coap-transport.conf</exclude>  
149 - </excludes>  
150 - <filtering>true</filtering>  
151 - </resource>  
152 - </resources>  
153 - <filters>  
154 - <filter>src/main/filters/windows.properties</filter>  
155 - </filters>  
156 - </configuration>  
157 - </execution>  
158 - <execution>  
159 - <id>copy-control</id>  
160 - <phase>process-resources</phase>  
161 - <goals>  
162 - <goal>copy-resources</goal>  
163 - </goals>  
164 - <configuration>  
165 - <outputDirectory>${project.build.directory}/control</outputDirectory>  
166 - <resources>  
167 - <resource>  
168 - <directory>src/main/scripts/control</directory>  
169 - <filtering>true</filtering>  
170 - </resource>  
171 - </resources>  
172 - <filters>  
173 - <filter>src/main/filters/unix.properties</filter>  
174 - </filters>  
175 - </configuration>  
176 - </execution>  
177 - <execution>  
178 - <id>copy-windows-control</id>  
179 - <phase>process-resources</phase>  
180 - <goals>  
181 - <goal>copy-resources</goal>  
182 - </goals>  
183 - <configuration>  
184 - <outputDirectory>${pkg.win.dist}</outputDirectory>  
185 - <resources>  
186 - <resource>  
187 - <directory>src/main/scripts/windows</directory>  
188 - <filtering>true</filtering>  
189 - </resource>  
190 - </resources>  
191 - <filters>  
192 - <filter>src/main/filters/windows.properties</filter>  
193 - </filters>  
194 - </configuration>  
195 - </execution>  
196 - </executions>  
197 </plugin> 95 </plugin>
198 <plugin> 96 <plugin>
199 <groupId>org.apache.maven.plugins</groupId> 97 <groupId>org.apache.maven.plugins</groupId>
200 <artifactId>maven-dependency-plugin</artifactId> 98 <artifactId>maven-dependency-plugin</artifactId>
201 - <executions>  
202 - <execution>  
203 - <id>copy-winsw-service</id>  
204 - <phase>package</phase>  
205 - <goals>  
206 - <goal>copy</goal>  
207 - </goals>  
208 - <configuration>  
209 - <artifactItems>  
210 - <artifactItem>  
211 - <groupId>com.sun.winsw</groupId>  
212 - <artifactId>winsw</artifactId>  
213 - <classifier>bin</classifier>  
214 - <type>exe</type>  
215 - <destFileName>service.exe</destFileName>  
216 - </artifactItem>  
217 - </artifactItems>  
218 - <outputDirectory>${pkg.win.dist}</outputDirectory>  
219 - </configuration>  
220 - </execution>  
221 - </executions>  
222 </plugin> 99 </plugin>
223 <plugin> 100 <plugin>
224 <groupId>org.apache.maven.plugins</groupId> 101 <groupId>org.apache.maven.plugins</groupId>
225 <artifactId>maven-jar-plugin</artifactId> 102 <artifactId>maven-jar-plugin</artifactId>
226 - <configuration>  
227 - <excludes>  
228 - <exclude>**/logback.xml</exclude>  
229 - </excludes>  
230 - <archive>  
231 - <manifestEntries>  
232 - <Implementation-Title>ThingsBoard CoAP Transport Service</Implementation-Title>  
233 - <Implementation-Version>${project.version}</Implementation-Version>  
234 - </manifestEntries>  
235 - </archive>  
236 - </configuration>  
237 </plugin> 103 </plugin>
238 <plugin> 104 <plugin>
239 <groupId>org.springframework.boot</groupId> 105 <groupId>org.springframework.boot</groupId>
240 <artifactId>spring-boot-maven-plugin</artifactId> 106 <artifactId>spring-boot-maven-plugin</artifactId>
241 - <configuration>  
242 - <mainClass>org.thingsboard.server.coap.ThingsboardCoapTransportApplication</mainClass>  
243 - <classifier>boot</classifier>  
244 - <layout>ZIP</layout>  
245 - <executable>true</executable>  
246 - <excludeDevtools>true</excludeDevtools>  
247 - <embeddedLaunchScriptProperties>  
248 - <confFolder>${pkg.installFolder}/conf</confFolder>  
249 - <logFolder>${pkg.unixLogFolder}</logFolder>  
250 - <logFilename>${pkg.name}.out</logFilename>  
251 - <initInfoProvides>${pkg.name}</initInfoProvides>  
252 - </embeddedLaunchScriptProperties>  
253 - </configuration>  
254 - <executions>  
255 - <execution>  
256 - <goals>  
257 - <goal>repackage</goal>  
258 - </goals>  
259 - </execution>  
260 - </executions>  
261 </plugin> 107 </plugin>
262 <plugin> 108 <plugin>
263 <groupId>org.thingsboard</groupId> 109 <groupId>org.thingsboard</groupId>
264 <artifactId>gradle-maven-plugin</artifactId> 110 <artifactId>gradle-maven-plugin</artifactId>
265 - <configuration>  
266 - <tasks>  
267 - <task>build</task>  
268 - <task>buildDeb</task>  
269 - <task>buildRpm</task>  
270 - </tasks>  
271 - <args>  
272 - <arg>-PprojectBuildDir=${project.build.directory}</arg>  
273 - <arg>-PprojectVersion=${project.version}</arg>  
274 - <arg>-PmainJar=${project.build.directory}/${project.build.finalName}-boot.${project.packaging}</arg>  
275 - <arg>-PpkgName=${pkg.name}</arg>  
276 - <arg>-PpkgInstallFolder=${pkg.installFolder}</arg>  
277 - <arg>-PpkgLogFolder=${pkg.unixLogFolder}</arg>  
278 - </args>  
279 - </configuration>  
280 - <executions>  
281 - <execution>  
282 - <phase>package</phase>  
283 - <goals>  
284 - <goal>invoke</goal>  
285 - </goals>  
286 - </execution>  
287 - </executions>  
288 </plugin> 111 </plugin>
289 <plugin> 112 <plugin>
290 <groupId>org.apache.maven.plugins</groupId> 113 <groupId>org.apache.maven.plugins</groupId>
291 <artifactId>maven-assembly-plugin</artifactId> 114 <artifactId>maven-assembly-plugin</artifactId>
292 - <configuration>  
293 - <finalName>${pkg.name}</finalName>  
294 - <descriptors>  
295 - <descriptor>src/main/assembly/windows.xml</descriptor>  
296 - </descriptors>  
297 - </configuration>  
298 - <executions>  
299 - <execution>  
300 - <id>assembly</id>  
301 - <phase>package</phase>  
302 - <goals>  
303 - <goal>single</goal>  
304 - </goals>  
305 - </execution>  
306 - </executions>  
307 </plugin> 115 </plugin>
308 <plugin> 116 <plugin>
309 <groupId>org.apache.maven.plugins</groupId> 117 <groupId>org.apache.maven.plugins</groupId>
310 <artifactId>maven-install-plugin</artifactId> 118 <artifactId>maven-install-plugin</artifactId>
311 - <configuration>  
312 - <file>${project.build.directory}/${pkg.name}.deb</file>  
313 - <artifactId>${project.artifactId}</artifactId>  
314 - <groupId>${project.groupId}</groupId>  
315 - <version>${project.version}</version>  
316 - <classifier>deb</classifier>  
317 - <packaging>deb</packaging>  
318 - </configuration>  
319 - <executions>  
320 - <execution>  
321 - <id>install-deb</id>  
322 - <phase>package</phase>  
323 - <goals>  
324 - <goal>install-file</goal>  
325 - </goals>  
326 - </execution>  
327 - </executions>  
328 </plugin> 119 </plugin>
329 </plugins> 120 </plugins>
330 </build> 121 </build>
1 -<!--  
2 -  
3 - Copyright © 2016-2020 The Thingsboard Authors  
4 -  
5 - Licensed under the Apache License, Version 2.0 (the "License");  
6 - you may not use this file except in compliance with the License.  
7 - You may obtain a copy of the License at  
8 -  
9 - http://www.apache.org/licenses/LICENSE-2.0  
10 -  
11 - Unless required by applicable law or agreed to in writing, software  
12 - distributed under the License is distributed on an "AS IS" BASIS,  
13 - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
14 - See the License for the specific language governing permissions and  
15 - limitations under the License.  
16 -  
17 --->  
18 -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"  
19 - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
20 - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">  
21 - <id>windows</id>  
22 -  
23 - <formats>  
24 - <format>zip</format>  
25 - </formats>  
26 -  
27 - <!-- Workaround to create logs directory -->  
28 - <fileSets>  
29 - <fileSet>  
30 - <directory>${pkg.win.dist}</directory>  
31 - <outputDirectory>logs</outputDirectory>  
32 - <excludes>  
33 - <exclude>*/**</exclude>  
34 - </excludes>  
35 - </fileSet>  
36 - <fileSet>  
37 - <directory>${pkg.win.dist}/conf</directory>  
38 - <outputDirectory>conf</outputDirectory>  
39 - <lineEnding>windows</lineEnding>  
40 - </fileSet>  
41 - </fileSets>  
42 -  
43 - <files>  
44 - <file>  
45 - <source>${project.build.directory}/${project.build.finalName}-boot.${project.packaging}</source>  
46 - <outputDirectory>lib</outputDirectory>  
47 - <destName>${pkg.name}.jar</destName>  
48 - </file>  
49 - <file>  
50 - <source>${pkg.win.dist}/service.exe</source>  
51 - <outputDirectory/>  
52 - <destName>${pkg.name}.exe</destName>  
53 - </file>  
54 - <file>  
55 - <source>${pkg.win.dist}/service.xml</source>  
56 - <outputDirectory/>  
57 - <destName>${pkg.name}.xml</destName>  
58 - <lineEnding>windows</lineEnding>  
59 - </file>  
60 - <file>  
61 - <source>${pkg.win.dist}/install.bat</source>  
62 - <outputDirectory/>  
63 - <lineEnding>windows</lineEnding>  
64 - </file>  
65 - <file>  
66 - <source>${pkg.win.dist}/uninstall.bat</source>  
67 - <outputDirectory/>  
68 - <lineEnding>windows</lineEnding>  
69 - </file>  
70 - </files>  
71 -</assembly>  
1 -pkg.logFolder=${pkg.unixLogFolder}  
1 -pkg.logFolder=${BASE}\\logs  
2 -pkg.winWrapperLogFolder=%BASE%\\logs  
1 -#!/bin/sh  
2 -  
3 -chown -R ${pkg.user}: ${pkg.logFolder}  
4 -chown -R ${pkg.user}: ${pkg.installFolder}  
5 -update-rc.d ${pkg.name} defaults  
6 -  
1 -#!/bin/sh  
2 -  
3 -update-rc.d -f ${pkg.name} remove  
1 -#!/bin/sh  
2 -  
3 -if ! getent group ${pkg.user} >/dev/null; then  
4 - addgroup --system ${pkg.user}  
5 -fi  
6 -  
7 -if ! getent passwd ${pkg.user} >/dev/null; then  
8 - adduser --quiet \  
9 - --system \  
10 - --ingroup ${pkg.user} \  
11 - --quiet \  
12 - --disabled-login \  
13 - --disabled-password \  
14 - --home ${pkg.installFolder} \  
15 - --no-create-home \  
16 - -gecos "Thingsboard application" \  
17 - ${pkg.user}  
18 -fi  
1 -#!/bin/sh  
2 -  
3 -if [ -e /var/run/${pkg.name}/${pkg.name}.pid ]; then  
4 - service ${pkg.name} stop  
5 -fi  
1 -#!/bin/sh  
2 -  
3 -chown -R ${pkg.user}: ${pkg.logFolder}  
4 -chown -R ${pkg.user}: ${pkg.installFolder}  
5 -  
6 -if [ $1 -eq 1 ] ; then  
7 - # Initial installation  
8 - systemctl --no-reload enable ${pkg.name}.service >/dev/null 2>&1 || :  
9 -fi  
1 -#!/bin/sh  
2 -  
3 -if [ $1 -ge 1 ] ; then  
4 - # Package upgrade, not uninstall  
5 - systemctl try-restart ${pkg.name}.service >/dev/null 2>&1 || :  
6 -fi  
1 -#!/bin/sh  
2 -  
3 -getent group ${pkg.user} >/dev/null || groupadd -r ${pkg.user}  
4 -getent passwd ${pkg.user} >/dev/null || \  
5 -useradd -d ${pkg.installFolder} -g ${pkg.user} -M -r ${pkg.user} -s /sbin/nologin \  
6 --c "Thingsboard application"  
1 -#!/bin/sh  
2 -  
3 -if [ $1 -eq 0 ] ; then  
4 - # Package removal, not upgrade  
5 - systemctl --no-reload disable --now ${pkg.name}.service > /dev/null 2>&1 || :  
6 -fi  
1 -[Unit]  
2 -Description=${pkg.name}  
3 -After=syslog.target  
4 -  
5 -[Service]  
6 -User=${pkg.user}  
7 -ExecStart=${pkg.installFolder}/bin/${pkg.name}.jar  
8 -SuccessExitStatus=143  
9 -  
10 -[Install]  
11 -WantedBy=multi-user.target  
1 -@ECHO OFF  
2 -  
3 -setlocal ENABLEEXTENSIONS  
4 -  
5 -@ECHO Detecting Java version installed.  
6 -:CHECK_JAVA  
7 -for /f tokens^=2-5^ delims^=.-_^" %%j in ('java -fullversion 2^>^&1') do set "jver=%%j%%k"  
8 -@ECHO CurrentVersion %jver%  
9 -  
10 -if %jver% NEQ 18 GOTO JAVA_NOT_INSTALLED  
11 -  
12 -:JAVA_INSTALLED  
13 -  
14 -@ECHO Java 1.8 found!  
15 -@ECHO Installing ${pkg.name} ...  
16 -  
17 -"%BASE%"${pkg.name}.exe install  
18 -  
19 -@ECHO ${pkg.name} installed successfully!  
20 -  
21 -GOTO END  
22 -  
23 -:JAVA_NOT_INSTALLED  
24 -@ECHO Java 1.8 is not installed. Only Java 1.8 is supported  
25 -@ECHO Please go to https://adoptopenjdk.net/index.html and install Java 1.8. Then retry installation.  
26 -PAUSE  
27 -GOTO END  
28 -  
29 -:END  
30 -  
31 -  
1 -<service>  
2 - <id>${pkg.name}</id>  
3 - <name>${project.name}</name>  
4 - <description>${project.description}</description>  
5 - <workingdirectory>%BASE%\conf</workingdirectory>  
6 - <logpath>${pkg.winWrapperLogFolder}</logpath>  
7 - <logmode>rotate</logmode>  
8 - <env name="LOADER_PATH" value="%BASE%\conf" />  
9 - <executable>java</executable>  
10 - <startargument>-Xloggc:%BASE%\logs\gc.log</startargument>  
11 - <startargument>-XX:+HeapDumpOnOutOfMemoryError</startargument>  
12 - <startargument>-XX:+PrintGCDetails</startargument>  
13 - <startargument>-XX:+PrintGCDateStamps</startargument>  
14 - <startargument>-XX:+PrintHeapAtGC</startargument>  
15 - <startargument>-XX:+PrintTenuringDistribution</startargument>  
16 - <startargument>-XX:+PrintGCApplicationStoppedTime</startargument>  
17 - <startargument>-XX:+UseGCLogFileRotation</startargument>  
18 - <startargument>-XX:NumberOfGCLogFiles=10</startargument>  
19 - <startargument>-XX:GCLogFileSize=10M</startargument>  
20 - <startargument>-XX:-UseBiasedLocking</startargument>  
21 - <startargument>-XX:+UseTLAB</startargument>  
22 - <startargument>-XX:+ResizeTLAB</startargument>  
23 - <startargument>-XX:+PerfDisableSharedMem</startargument>  
24 - <startargument>-XX:+UseCondCardMark</startargument>  
25 - <startargument>-XX:CMSWaitDuration=10000</startargument>  
26 - <startargument>-XX:+UseParNewGC</startargument>  
27 - <startargument>-XX:+UseConcMarkSweepGC</startargument>  
28 - <startargument>-XX:+CMSParallelRemarkEnabled</startargument>  
29 - <startargument>-XX:+CMSParallelInitialMarkEnabled</startargument>  
30 - <startargument>-XX:+CMSEdenChunksRecordAlways</startargument>  
31 - <startargument>-XX:CMSInitiatingOccupancyFraction=75</startargument>  
32 - <startargument>-XX:+UseCMSInitiatingOccupancyOnly</startargument>  
33 - <startargument>-jar</startargument>  
34 - <startargument>%BASE%\lib\${pkg.name}.jar</startargument>  
35 -  
36 -</service>  
1 -@ECHO OFF  
2 -  
3 -@ECHO Stopping ${pkg.name} ...  
4 -net stop ${pkg.name}  
5 -  
6 -@ECHO Uninstalling ${pkg.name} ...  
7 -"%~dp0"${pkg.name}.exe uninstall  
8 -  
9 -@ECHO DONE.  
1 -/**  
2 - * Copyright © 2016-2020 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -import org.apache.tools.ant.filters.ReplaceTokens  
17 -  
18 -buildscript {  
19 - ext {  
20 - osPackageVersion = "3.8.0"  
21 - }  
22 - repositories {  
23 - jcenter()  
24 - }  
25 - dependencies {  
26 - classpath("com.netflix.nebula:gradle-ospackage-plugin:${osPackageVersion}")  
27 - }  
28 -}  
29 -  
30 -apply plugin: "nebula.ospackage"  
31 -  
32 -buildDir = projectBuildDir  
33 -version = projectVersion  
34 -distsDirName = "./"  
35 -  
36 -// OS Package plugin configuration  
37 -ospackage {  
38 - packageName = pkgName  
39 - version = "${project.version}"  
40 - release = 1  
41 - os = LINUX  
42 - type = BINARY  
43 -  
44 - into pkgInstallFolder  
45 -  
46 - user pkgName  
47 - permissionGroup pkgName  
48 -  
49 - // Copy the actual .jar file  
50 - from(mainJar) {  
51 - // Strip the version from the jar filename  
52 - rename { String fileName ->  
53 - "${pkgName}.jar"  
54 - }  
55 - fileMode 0500  
56 - into "bin"  
57 - }  
58 -  
59 - // Copy the config files  
60 - from("target/conf") {  
61 - exclude "${pkgName}.conf"  
62 - fileType CONFIG | NOREPLACE  
63 - fileMode 0754  
64 - into "conf"  
65 - }  
66 -  
67 -}  
68 -  
69 -// Configure our RPM build task  
70 -buildRpm {  
71 -  
72 - arch = NOARCH  
73 -  
74 - version = projectVersion.replace('-', '')  
75 - archiveName = "${pkgName}.rpm"  
76 -  
77 - requires("java-1.8.0")  
78 -  
79 - from("target/conf") {  
80 - include "${pkgName}.conf"  
81 - filter(ReplaceTokens, tokens: ['pkg.platform': 'rpm'])  
82 - fileType CONFIG | NOREPLACE  
83 - fileMode 0754  
84 - into "${pkgInstallFolder}/conf"  
85 - }  
86 -  
87 - preInstall file("${buildDir}/control/rpm/preinst")  
88 - postInstall file("${buildDir}/control/rpm/postinst")  
89 - preUninstall file("${buildDir}/control/rpm/prerm")  
90 - postUninstall file("${buildDir}/control/rpm/postrm")  
91 -  
92 - user pkgName  
93 - permissionGroup pkgName  
94 -  
95 - // Copy the system unit files  
96 - from("${buildDir}/control/${pkgName}.service") {  
97 - addParentDirs = false  
98 - fileMode 0644  
99 - into "/usr/lib/systemd/system"  
100 - }  
101 -  
102 - directory(pkgLogFolder, 0755)  
103 - link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml")  
104 - link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")  
105 -}  
106 -  
107 -// Same as the buildRpm task  
108 -buildDeb {  
109 -  
110 - arch = "all"  
111 -  
112 - archiveName = "${pkgName}.deb"  
113 -  
114 - requires("openjdk-8-jre").or("java8-runtime").or("oracle-java8-installer").or("openjdk-8-jre-headless")  
115 -  
116 - from("target/conf") {  
117 - include "${pkgName}.conf"  
118 - filter(ReplaceTokens, tokens: ['pkg.platform': 'deb'])  
119 - fileType CONFIG | NOREPLACE  
120 - fileMode 0754  
121 - into "${pkgInstallFolder}/conf"  
122 - }  
123 -  
124 - configurationFile("${pkgInstallFolder}/conf/${pkgName}.conf")  
125 - configurationFile("${pkgInstallFolder}/conf/${pkgName}.yml")  
126 - configurationFile("${pkgInstallFolder}/conf/logback.xml")  
127 -  
128 - preInstall file("${buildDir}/control/deb/preinst")  
129 - postInstall file("${buildDir}/control/deb/postinst")  
130 - preUninstall file("${buildDir}/control/deb/prerm")  
131 - postUninstall file("${buildDir}/control/deb/postrm")  
132 -  
133 - user pkgName  
134 - permissionGroup pkgName  
135 -  
136 - directory(pkgLogFolder, 0755)  
137 - link("/etc/init.d/${pkgName}", "${pkgInstallFolder}/bin/${pkgName}.jar")  
138 - link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml")  
139 - link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")  
140 -}  
@@ -33,10 +33,15 @@ @@ -33,10 +33,15 @@
33 <properties> 33 <properties>
34 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 34 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
35 <main.dir>${basedir}/../..</main.dir> 35 <main.dir>${basedir}/../..</main.dir>
  36 + <pkg.type>java</pkg.type>
  37 + <pkg.disabled>false</pkg.disabled>
  38 + <pkg.process-resources.phase>process-resources</pkg.process-resources.phase>
  39 + <pkg.package.phase>package</pkg.package.phase>
36 <pkg.name>tb-http-transport</pkg.name> 40 <pkg.name>tb-http-transport</pkg.name>
37 - <pkg.unixLogFolder>/var/log/${pkg.name}</pkg.unixLogFolder>  
38 - <pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder> 41 + <pkg.copyInstallScripts>false</pkg.copyInstallScripts>
39 <pkg.win.dist>${project.build.directory}/windows</pkg.win.dist> 42 <pkg.win.dist>${project.build.directory}/windows</pkg.win.dist>
  43 + <pkg.implementationTitle>ThingsBoard HTTP Transport Service</pkg.implementationTitle>
  44 + <pkg.mainClass>org.thingsboard.server.http.ThingsboardHttpTransportApplication</pkg.mainClass>
40 </properties> 45 </properties>
41 46
42 <dependencies> 47 <dependencies>
@@ -87,244 +92,30 @@ @@ -87,244 +92,30 @@
87 <plugin> 92 <plugin>
88 <groupId>org.apache.maven.plugins</groupId> 93 <groupId>org.apache.maven.plugins</groupId>
89 <artifactId>maven-resources-plugin</artifactId> 94 <artifactId>maven-resources-plugin</artifactId>
90 - <executions>  
91 - <execution>  
92 - <id>copy-conf</id>  
93 - <phase>process-resources</phase>  
94 - <goals>  
95 - <goal>copy-resources</goal>  
96 - </goals>  
97 - <configuration>  
98 - <outputDirectory>${project.build.directory}/conf</outputDirectory>  
99 - <resources>  
100 - <resource>  
101 - <directory>src/main/resources</directory>  
102 - <excludes>  
103 - <exclude>logback.xml</exclude>  
104 - </excludes>  
105 - <filtering>false</filtering>  
106 - </resource>  
107 - </resources>  
108 - </configuration>  
109 - </execution>  
110 - <execution>  
111 - <id>copy-service-conf</id>  
112 - <phase>process-resources</phase>  
113 - <goals>  
114 - <goal>copy-resources</goal>  
115 - </goals>  
116 - <configuration>  
117 - <outputDirectory>${project.build.directory}/conf</outputDirectory>  
118 - <resources>  
119 - <resource>  
120 - <directory>src/main/conf</directory>  
121 - <filtering>true</filtering>  
122 - </resource>  
123 - </resources>  
124 - <filters>  
125 - <filter>src/main/filters/unix.properties</filter>  
126 - </filters>  
127 - </configuration>  
128 - </execution>  
129 - <execution>  
130 - <id>copy-win-conf</id>  
131 - <phase>process-resources</phase>  
132 - <goals>  
133 - <goal>copy-resources</goal>  
134 - </goals>  
135 - <configuration>  
136 - <outputDirectory>${pkg.win.dist}/conf</outputDirectory>  
137 - <resources>  
138 - <resource>  
139 - <directory>src/main/resources</directory>  
140 - <excludes>  
141 - <exclude>logback.xml</exclude>  
142 - </excludes>  
143 - <filtering>false</filtering>  
144 - </resource>  
145 - <resource>  
146 - <directory>src/main/conf</directory>  
147 - <excludes>  
148 - <exclude>tb-http-transport.conf</exclude>  
149 - </excludes>  
150 - <filtering>true</filtering>  
151 - </resource>  
152 - </resources>  
153 - <filters>  
154 - <filter>src/main/filters/windows.properties</filter>  
155 - </filters>  
156 - </configuration>  
157 - </execution>  
158 - <execution>  
159 - <id>copy-control</id>  
160 - <phase>process-resources</phase>  
161 - <goals>  
162 - <goal>copy-resources</goal>  
163 - </goals>  
164 - <configuration>  
165 - <outputDirectory>${project.build.directory}/control</outputDirectory>  
166 - <resources>  
167 - <resource>  
168 - <directory>src/main/scripts/control</directory>  
169 - <filtering>true</filtering>  
170 - </resource>  
171 - </resources>  
172 - <filters>  
173 - <filter>src/main/filters/unix.properties</filter>  
174 - </filters>  
175 - </configuration>  
176 - </execution>  
177 - <execution>  
178 - <id>copy-windows-control</id>  
179 - <phase>process-resources</phase>  
180 - <goals>  
181 - <goal>copy-resources</goal>  
182 - </goals>  
183 - <configuration>  
184 - <outputDirectory>${pkg.win.dist}</outputDirectory>  
185 - <resources>  
186 - <resource>  
187 - <directory>src/main/scripts/windows</directory>  
188 - <filtering>true</filtering>  
189 - </resource>  
190 - </resources>  
191 - <filters>  
192 - <filter>src/main/filters/windows.properties</filter>  
193 - </filters>  
194 - </configuration>  
195 - </execution>  
196 - </executions>  
197 </plugin> 95 </plugin>
198 <plugin> 96 <plugin>
199 <groupId>org.apache.maven.plugins</groupId> 97 <groupId>org.apache.maven.plugins</groupId>
200 <artifactId>maven-dependency-plugin</artifactId> 98 <artifactId>maven-dependency-plugin</artifactId>
201 - <executions>  
202 - <execution>  
203 - <id>copy-winsw-service</id>  
204 - <phase>package</phase>  
205 - <goals>  
206 - <goal>copy</goal>  
207 - </goals>  
208 - <configuration>  
209 - <artifactItems>  
210 - <artifactItem>  
211 - <groupId>com.sun.winsw</groupId>  
212 - <artifactId>winsw</artifactId>  
213 - <classifier>bin</classifier>  
214 - <type>exe</type>  
215 - <destFileName>service.exe</destFileName>  
216 - </artifactItem>  
217 - </artifactItems>  
218 - <outputDirectory>${pkg.win.dist}</outputDirectory>  
219 - </configuration>  
220 - </execution>  
221 - </executions>  
222 </plugin> 99 </plugin>
223 <plugin> 100 <plugin>
224 <groupId>org.apache.maven.plugins</groupId> 101 <groupId>org.apache.maven.plugins</groupId>
225 <artifactId>maven-jar-plugin</artifactId> 102 <artifactId>maven-jar-plugin</artifactId>
226 - <configuration>  
227 - <excludes>  
228 - <exclude>**/logback.xml</exclude>  
229 - </excludes>  
230 - <archive>  
231 - <manifestEntries>  
232 - <Implementation-Title>ThingsBoard HTTP Transport Service</Implementation-Title>  
233 - <Implementation-Version>${project.version}</Implementation-Version>  
234 - </manifestEntries>  
235 - </archive>  
236 - </configuration>  
237 </plugin> 103 </plugin>
238 <plugin> 104 <plugin>
239 <groupId>org.springframework.boot</groupId> 105 <groupId>org.springframework.boot</groupId>
240 <artifactId>spring-boot-maven-plugin</artifactId> 106 <artifactId>spring-boot-maven-plugin</artifactId>
241 - <configuration>  
242 - <mainClass>org.thingsboard.server.http.ThingsboardHttpTransportApplication</mainClass>  
243 - <classifier>boot</classifier>  
244 - <layout>ZIP</layout>  
245 - <executable>true</executable>  
246 - <excludeDevtools>true</excludeDevtools>  
247 - <embeddedLaunchScriptProperties>  
248 - <confFolder>${pkg.installFolder}/conf</confFolder>  
249 - <logFolder>${pkg.unixLogFolder}</logFolder>  
250 - <logFilename>${pkg.name}.out</logFilename>  
251 - <initInfoProvides>${pkg.name}</initInfoProvides>  
252 - </embeddedLaunchScriptProperties>  
253 - </configuration>  
254 - <executions>  
255 - <execution>  
256 - <goals>  
257 - <goal>repackage</goal>  
258 - </goals>  
259 - </execution>  
260 - </executions>  
261 </plugin> 107 </plugin>
262 <plugin> 108 <plugin>
263 <groupId>org.thingsboard</groupId> 109 <groupId>org.thingsboard</groupId>
264 <artifactId>gradle-maven-plugin</artifactId> 110 <artifactId>gradle-maven-plugin</artifactId>
265 - <configuration>  
266 - <tasks>  
267 - <task>build</task>  
268 - <task>buildDeb</task>  
269 - <task>buildRpm</task>  
270 - </tasks>  
271 - <args>  
272 - <arg>-PprojectBuildDir=${project.build.directory}</arg>  
273 - <arg>-PprojectVersion=${project.version}</arg>  
274 - <arg>-PmainJar=${project.build.directory}/${project.build.finalName}-boot.${project.packaging}</arg>  
275 - <arg>-PpkgName=${pkg.name}</arg>  
276 - <arg>-PpkgInstallFolder=${pkg.installFolder}</arg>  
277 - <arg>-PpkgLogFolder=${pkg.unixLogFolder}</arg>  
278 - </args>  
279 - </configuration>  
280 - <executions>  
281 - <execution>  
282 - <phase>package</phase>  
283 - <goals>  
284 - <goal>invoke</goal>  
285 - </goals>  
286 - </execution>  
287 - </executions>  
288 </plugin> 111 </plugin>
289 <plugin> 112 <plugin>
290 <groupId>org.apache.maven.plugins</groupId> 113 <groupId>org.apache.maven.plugins</groupId>
291 <artifactId>maven-assembly-plugin</artifactId> 114 <artifactId>maven-assembly-plugin</artifactId>
292 - <configuration>  
293 - <finalName>${pkg.name}</finalName>  
294 - <descriptors>  
295 - <descriptor>src/main/assembly/windows.xml</descriptor>  
296 - </descriptors>  
297 - </configuration>  
298 - <executions>  
299 - <execution>  
300 - <id>assembly</id>  
301 - <phase>package</phase>  
302 - <goals>  
303 - <goal>single</goal>  
304 - </goals>  
305 - </execution>  
306 - </executions>  
307 </plugin> 115 </plugin>
308 <plugin> 116 <plugin>
309 <groupId>org.apache.maven.plugins</groupId> 117 <groupId>org.apache.maven.plugins</groupId>
310 <artifactId>maven-install-plugin</artifactId> 118 <artifactId>maven-install-plugin</artifactId>
311 - <configuration>  
312 - <file>${project.build.directory}/${pkg.name}.deb</file>  
313 - <artifactId>${project.artifactId}</artifactId>  
314 - <groupId>${project.groupId}</groupId>  
315 - <version>${project.version}</version>  
316 - <classifier>deb</classifier>  
317 - <packaging>deb</packaging>  
318 - </configuration>  
319 - <executions>  
320 - <execution>  
321 - <id>install-deb</id>  
322 - <phase>package</phase>  
323 - <goals>  
324 - <goal>install-file</goal>  
325 - </goals>  
326 - </execution>  
327 - </executions>  
328 </plugin> 119 </plugin>
329 </plugins> 120 </plugins>
330 </build> 121 </build>
1 -<!--  
2 -  
3 - Copyright © 2016-2020 The Thingsboard Authors  
4 -  
5 - Licensed under the Apache License, Version 2.0 (the "License");  
6 - you may not use this file except in compliance with the License.  
7 - You may obtain a copy of the License at  
8 -  
9 - http://www.apache.org/licenses/LICENSE-2.0  
10 -  
11 - Unless required by applicable law or agreed to in writing, software  
12 - distributed under the License is distributed on an "AS IS" BASIS,  
13 - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
14 - See the License for the specific language governing permissions and  
15 - limitations under the License.  
16 -  
17 --->  
18 -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"  
19 - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
20 - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">  
21 - <id>windows</id>  
22 -  
23 - <formats>  
24 - <format>zip</format>  
25 - </formats>  
26 -  
27 - <!-- Workaround to create logs directory -->  
28 - <fileSets>  
29 - <fileSet>  
30 - <directory>${pkg.win.dist}</directory>  
31 - <outputDirectory>logs</outputDirectory>  
32 - <excludes>  
33 - <exclude>*/**</exclude>  
34 - </excludes>  
35 - </fileSet>  
36 - <fileSet>  
37 - <directory>${pkg.win.dist}/conf</directory>  
38 - <outputDirectory>conf</outputDirectory>  
39 - <lineEnding>windows</lineEnding>  
40 - </fileSet>  
41 - </fileSets>  
42 -  
43 - <files>  
44 - <file>  
45 - <source>${project.build.directory}/${project.build.finalName}-boot.${project.packaging}</source>  
46 - <outputDirectory>lib</outputDirectory>  
47 - <destName>${pkg.name}.jar</destName>  
48 - </file>  
49 - <file>  
50 - <source>${pkg.win.dist}/service.exe</source>  
51 - <outputDirectory/>  
52 - <destName>${pkg.name}.exe</destName>  
53 - </file>  
54 - <file>  
55 - <source>${pkg.win.dist}/service.xml</source>  
56 - <outputDirectory/>  
57 - <destName>${pkg.name}.xml</destName>  
58 - <lineEnding>windows</lineEnding>  
59 - </file>  
60 - <file>  
61 - <source>${pkg.win.dist}/install.bat</source>  
62 - <outputDirectory/>  
63 - <lineEnding>windows</lineEnding>  
64 - </file>  
65 - <file>  
66 - <source>${pkg.win.dist}/uninstall.bat</source>  
67 - <outputDirectory/>  
68 - <lineEnding>windows</lineEnding>  
69 - </file>  
70 - </files>  
71 -</assembly>  
1 -pkg.logFolder=${pkg.unixLogFolder}  
1 -pkg.logFolder=${BASE}\\logs  
2 -pkg.winWrapperLogFolder=%BASE%\\logs  
1 -#!/bin/sh  
2 -  
3 -chown -R ${pkg.user}: ${pkg.logFolder}  
4 -chown -R ${pkg.user}: ${pkg.installFolder}  
5 -update-rc.d ${pkg.name} defaults  
6 -  
1 -#!/bin/sh  
2 -  
3 -update-rc.d -f ${pkg.name} remove  
1 -#!/bin/sh  
2 -  
3 -if ! getent group ${pkg.user} >/dev/null; then  
4 - addgroup --system ${pkg.user}  
5 -fi  
6 -  
7 -if ! getent passwd ${pkg.user} >/dev/null; then  
8 - adduser --quiet \  
9 - --system \  
10 - --ingroup ${pkg.user} \  
11 - --quiet \  
12 - --disabled-login \  
13 - --disabled-password \  
14 - --home ${pkg.installFolder} \  
15 - --no-create-home \  
16 - -gecos "Thingsboard application" \  
17 - ${pkg.user}  
18 -fi  
1 -#!/bin/sh  
2 -  
3 -if [ -e /var/run/${pkg.name}/${pkg.name}.pid ]; then  
4 - service ${pkg.name} stop  
5 -fi  
1 -#!/bin/sh  
2 -  
3 -chown -R ${pkg.user}: ${pkg.logFolder}  
4 -chown -R ${pkg.user}: ${pkg.installFolder}  
5 -  
6 -if [ $1 -eq 1 ] ; then  
7 - # Initial installation  
8 - systemctl --no-reload enable ${pkg.name}.service >/dev/null 2>&1 || :  
9 -fi  
1 -#!/bin/sh  
2 -  
3 -if [ $1 -ge 1 ] ; then  
4 - # Package upgrade, not uninstall  
5 - systemctl try-restart ${pkg.name}.service >/dev/null 2>&1 || :  
6 -fi  
1 -#!/bin/sh  
2 -  
3 -getent group ${pkg.user} >/dev/null || groupadd -r ${pkg.user}  
4 -getent passwd ${pkg.user} >/dev/null || \  
5 -useradd -d ${pkg.installFolder} -g ${pkg.user} -M -r ${pkg.user} -s /sbin/nologin \  
6 --c "Thingsboard application"  
1 -#!/bin/sh  
2 -  
3 -if [ $1 -eq 0 ] ; then  
4 - # Package removal, not upgrade  
5 - systemctl --no-reload disable --now ${pkg.name}.service > /dev/null 2>&1 || :  
6 -fi  
1 -[Unit]  
2 -Description=${pkg.name}  
3 -After=syslog.target  
4 -  
5 -[Service]  
6 -User=${pkg.user}  
7 -ExecStart=${pkg.installFolder}/bin/${pkg.name}.jar  
8 -SuccessExitStatus=143  
9 -  
10 -[Install]  
11 -WantedBy=multi-user.target  
1 -@ECHO OFF  
2 -  
3 -setlocal ENABLEEXTENSIONS  
4 -  
5 -@ECHO Detecting Java version installed.  
6 -:CHECK_JAVA  
7 -for /f tokens^=2-5^ delims^=.-_^" %%j in ('java -fullversion 2^>^&1') do set "jver=%%j%%k"  
8 -@ECHO CurrentVersion %jver%  
9 -  
10 -if %jver% NEQ 18 GOTO JAVA_NOT_INSTALLED  
11 -  
12 -:JAVA_INSTALLED  
13 -  
14 -@ECHO Java 1.8 found!  
15 -@ECHO Installing ${pkg.name} ...  
16 -  
17 -"%BASE%"${pkg.name}.exe install  
18 -  
19 -@ECHO ${pkg.name} installed successfully!  
20 -  
21 -GOTO END  
22 -  
23 -:JAVA_NOT_INSTALLED  
24 -@ECHO Java 1.8 is not installed. Only Java 1.8 is supported  
25 -@ECHO Please go to https://adoptopenjdk.net/index.html and install Java 1.8. Then retry installation.  
26 -PAUSE  
27 -GOTO END  
28 -  
29 -:END  
30 -  
31 -  
1 -<service>  
2 - <id>${pkg.name}</id>  
3 - <name>${project.name}</name>  
4 - <description>${project.description}</description>  
5 - <workingdirectory>%BASE%\conf</workingdirectory>  
6 - <logpath>${pkg.winWrapperLogFolder}</logpath>  
7 - <logmode>rotate</logmode>  
8 - <env name="LOADER_PATH" value="%BASE%\conf" />  
9 - <executable>java</executable>  
10 - <startargument>-Xloggc:%BASE%\logs\gc.log</startargument>  
11 - <startargument>-XX:+HeapDumpOnOutOfMemoryError</startargument>  
12 - <startargument>-XX:+PrintGCDetails</startargument>  
13 - <startargument>-XX:+PrintGCDateStamps</startargument>  
14 - <startargument>-XX:+PrintHeapAtGC</startargument>  
15 - <startargument>-XX:+PrintTenuringDistribution</startargument>  
16 - <startargument>-XX:+PrintGCApplicationStoppedTime</startargument>  
17 - <startargument>-XX:+UseGCLogFileRotation</startargument>  
18 - <startargument>-XX:NumberOfGCLogFiles=10</startargument>  
19 - <startargument>-XX:GCLogFileSize=10M</startargument>  
20 - <startargument>-XX:-UseBiasedLocking</startargument>  
21 - <startargument>-XX:+UseTLAB</startargument>  
22 - <startargument>-XX:+ResizeTLAB</startargument>  
23 - <startargument>-XX:+PerfDisableSharedMem</startargument>  
24 - <startargument>-XX:+UseCondCardMark</startargument>  
25 - <startargument>-XX:CMSWaitDuration=10000</startargument>  
26 - <startargument>-XX:+UseParNewGC</startargument>  
27 - <startargument>-XX:+UseConcMarkSweepGC</startargument>  
28 - <startargument>-XX:+CMSParallelRemarkEnabled</startargument>  
29 - <startargument>-XX:+CMSParallelInitialMarkEnabled</startargument>  
30 - <startargument>-XX:+CMSEdenChunksRecordAlways</startargument>  
31 - <startargument>-XX:CMSInitiatingOccupancyFraction=75</startargument>  
32 - <startargument>-XX:+UseCMSInitiatingOccupancyOnly</startargument>  
33 - <startargument>-jar</startargument>  
34 - <startargument>%BASE%\lib\${pkg.name}.jar</startargument>  
35 -  
36 -</service>  
1 -@ECHO OFF  
2 -  
3 -@ECHO Stopping ${pkg.name} ...  
4 -net stop ${pkg.name}  
5 -  
6 -@ECHO Uninstalling ${pkg.name} ...  
7 -"%~dp0"${pkg.name}.exe uninstall  
8 -  
9 -@ECHO DONE.  
1 -/**  
2 - * Copyright © 2016-2020 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -import org.apache.tools.ant.filters.ReplaceTokens  
17 -  
18 -buildscript {  
19 - ext {  
20 - osPackageVersion = "3.8.0"  
21 - }  
22 - repositories {  
23 - jcenter()  
24 - }  
25 - dependencies {  
26 - classpath("com.netflix.nebula:gradle-ospackage-plugin:${osPackageVersion}")  
27 - }  
28 -}  
29 -  
30 -apply plugin: "nebula.ospackage"  
31 -  
32 -buildDir = projectBuildDir  
33 -version = projectVersion  
34 -distsDirName = "./"  
35 -  
36 -// OS Package plugin configuration  
37 -ospackage {  
38 - packageName = pkgName  
39 - version = "${project.version}"  
40 - release = 1  
41 - os = LINUX  
42 - type = BINARY  
43 -  
44 - into pkgInstallFolder  
45 -  
46 - user pkgName  
47 - permissionGroup pkgName  
48 -  
49 - // Copy the actual .jar file  
50 - from(mainJar) {  
51 - // Strip the version from the jar filename  
52 - rename { String fileName ->  
53 - "${pkgName}.jar"  
54 - }  
55 - fileMode 0500  
56 - into "bin"  
57 - }  
58 -  
59 - // Copy the config files  
60 - from("target/conf") {  
61 - exclude "${pkgName}.conf"  
62 - fileType CONFIG | NOREPLACE  
63 - fileMode 0754  
64 - into "conf"  
65 - }  
66 -  
67 -}  
68 -  
69 -// Configure our RPM build task  
70 -buildRpm {  
71 -  
72 - arch = NOARCH  
73 -  
74 - version = projectVersion.replace('-', '')  
75 - archiveName = "${pkgName}.rpm"  
76 -  
77 - requires("java-1.8.0")  
78 -  
79 - from("target/conf") {  
80 - include "${pkgName}.conf"  
81 - filter(ReplaceTokens, tokens: ['pkg.platform': 'rpm'])  
82 - fileType CONFIG | NOREPLACE  
83 - fileMode 0754  
84 - into "${pkgInstallFolder}/conf"  
85 - }  
86 -  
87 - preInstall file("${buildDir}/control/rpm/preinst")  
88 - postInstall file("${buildDir}/control/rpm/postinst")  
89 - preUninstall file("${buildDir}/control/rpm/prerm")  
90 - postUninstall file("${buildDir}/control/rpm/postrm")  
91 -  
92 - user pkgName  
93 - permissionGroup pkgName  
94 -  
95 - // Copy the system unit files  
96 - from("${buildDir}/control/${pkgName}.service") {  
97 - addParentDirs = false  
98 - fileMode 0644  
99 - into "/usr/lib/systemd/system"  
100 - }  
101 -  
102 - directory(pkgLogFolder, 0755)  
103 - link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml")  
104 - link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")  
105 -}  
106 -  
107 -// Same as the buildRpm task  
108 -buildDeb {  
109 -  
110 - arch = "all"  
111 -  
112 - archiveName = "${pkgName}.deb"  
113 -  
114 - requires("openjdk-8-jre").or("java8-runtime").or("oracle-java8-installer").or("openjdk-8-jre-headless")  
115 -  
116 - from("target/conf") {  
117 - include "${pkgName}.conf"  
118 - filter(ReplaceTokens, tokens: ['pkg.platform': 'deb'])  
119 - fileType CONFIG | NOREPLACE  
120 - fileMode 0754  
121 - into "${pkgInstallFolder}/conf"  
122 - }  
123 -  
124 - configurationFile("${pkgInstallFolder}/conf/${pkgName}.conf")  
125 - configurationFile("${pkgInstallFolder}/conf/${pkgName}.yml")  
126 - configurationFile("${pkgInstallFolder}/conf/logback.xml")  
127 -  
128 - preInstall file("${buildDir}/control/deb/preinst")  
129 - postInstall file("${buildDir}/control/deb/postinst")  
130 - preUninstall file("${buildDir}/control/deb/prerm")  
131 - postUninstall file("${buildDir}/control/deb/postrm")  
132 -  
133 - user pkgName  
134 - permissionGroup pkgName  
135 -  
136 - directory(pkgLogFolder, 0755)  
137 - link("/etc/init.d/${pkgName}", "${pkgInstallFolder}/bin/${pkgName}.jar")  
138 - link("${pkgInstallFolder}/bin/${pkgName}.yml", "${pkgInstallFolder}/conf/${pkgName}.yml")  
139 - link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")  
140 -}  
@@ -33,10 +33,15 @@ @@ -33,10 +33,15 @@
33 <properties> 33 <properties>
34 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 34 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
35 <main.dir>${basedir}/../..</main.dir> 35 <main.dir>${basedir}/../..</main.dir>
  36 + <pkg.type>java</pkg.type>
  37 + <pkg.disabled>false</pkg.disabled>
  38 + <pkg.process-resources.phase>process-resources</pkg.process-resources.phase>
  39 + <pkg.package.phase>package</pkg.package.phase>
36 <pkg.name>tb-mqtt-transport</pkg.name> 40 <pkg.name>tb-mqtt-transport</pkg.name>
37 - <pkg.unixLogFolder>/var/log/${pkg.name}</pkg.unixLogFolder>  
38 - <pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder> 41 + <pkg.copyInstallScripts>false</pkg.copyInstallScripts>
39 <pkg.win.dist>${project.build.directory}/windows</pkg.win.dist> 42 <pkg.win.dist>${project.build.directory}/windows</pkg.win.dist>
  43 + <pkg.implementationTitle>ThingsBoard MQTT Transport Service</pkg.implementationTitle>
  44 + <pkg.mainClass>org.thingsboard.server.mqtt.ThingsboardMqttTransportApplication</pkg.mainClass>
40 </properties> 45 </properties>
41 46
42 <dependencies> 47 <dependencies>
@@ -87,244 +92,30 @@ @@ -87,244 +92,30 @@
87 <plugin> 92 <plugin>
88 <groupId>org.apache.maven.plugins</groupId> 93 <groupId>org.apache.maven.plugins</groupId>
89 <artifactId>maven-resources-plugin</artifactId> 94 <artifactId>maven-resources-plugin</artifactId>
90 - <executions>  
91 - <execution>  
92 - <id>copy-conf</id>  
93 - <phase>process-resources</phase>  
94 - <goals>  
95 - <goal>copy-resources</goal>  
96 - </goals>  
97 - <configuration>  
98 - <outputDirectory>${project.build.directory}/conf</outputDirectory>  
99 - <resources>  
100 - <resource>  
101 - <directory>src/main/resources</directory>  
102 - <excludes>  
103 - <exclude>logback.xml</exclude>  
104 - </excludes>  
105 - <filtering>false</filtering>  
106 - </resource>  
107 - </resources>  
108 - </configuration>  
109 - </execution>  
110 - <execution>  
111 - <id>copy-service-conf</id>  
112 - <phase>process-resources</phase>  
113 - <goals>  
114 - <goal>copy-resources</goal>  
115 - </goals>  
116 - <configuration>  
117 - <outputDirectory>${project.build.directory}/conf</outputDirectory>  
118 - <resources>  
119 - <resource>  
120 - <directory>src/main/conf</directory>  
121 - <filtering>true</filtering>  
122 - </resource>  
123 - </resources>  
124 - <filters>  
125 - <filter>src/main/filters/unix.properties</filter>  
126 - </filters>  
127 - </configuration>  
128 - </execution>  
129 - <execution>  
130 - <id>copy-win-conf</id>  
131 - <phase>process-resources</phase>  
132 - <goals>  
133 - <goal>copy-resources</goal>  
134 - </goals>  
135 - <configuration>  
136 - <outputDirectory>${pkg.win.dist}/conf</outputDirectory>  
137 - <resources>  
138 - <resource>  
139 - <directory>src/main/resources</directory>  
140 - <excludes>  
141 - <exclude>logback.xml</exclude>  
142 - </excludes>  
143 - <filtering>false</filtering>  
144 - </resource>  
145 - <resource>  
146 - <directory>src/main/conf</directory>  
147 - <excludes>  
148 - <exclude>tb-mqtt-transport.conf</exclude>  
149 - </excludes>  
150 - <filtering>true</filtering>  
151 - </resource>  
152 - </resources>  
153 - <filters>  
154 - <filter>src/main/filters/windows.properties</filter>  
155 - </filters>  
156 - </configuration>  
157 - </execution>  
158 - <execution>  
159 - <id>copy-control</id>  
160 - <phase>process-resources</phase>  
161 - <goals>  
162 - <goal>copy-resources</goal>  
163 - </goals>  
164 - <configuration>  
165 - <outputDirectory>${project.build.directory}/control</outputDirectory>  
166 - <resources>  
167 - <resource>  
168 - <directory>src/main/scripts/control</directory>  
169 - <filtering>true</filtering>  
170 - </resource>  
171 - </resources>  
172 - <filters>  
173 - <filter>src/main/filters/unix.properties</filter>  
174 - </filters>  
175 - </configuration>  
176 - </execution>  
177 - <execution>  
178 - <id>copy-windows-control</id>  
179 - <phase>process-resources</phase>  
180 - <goals>  
181 - <goal>copy-resources</goal>  
182 - </goals>  
183 - <configuration>  
184 - <outputDirectory>${pkg.win.dist}</outputDirectory>  
185 - <resources>  
186 - <resource>  
187 - <directory>src/main/scripts/windows</directory>  
188 - <filtering>true</filtering>  
189 - </resource>  
190 - </resources>  
191 - <filters>  
192 - <filter>src/main/filters/windows.properties</filter>  
193 - </filters>  
194 - </configuration>  
195 - </execution>  
196 - </executions>  
197 </plugin> 95 </plugin>
198 <plugin> 96 <plugin>
199 <groupId>org.apache.maven.plugins</groupId> 97 <groupId>org.apache.maven.plugins</groupId>
200 <artifactId>maven-dependency-plugin</artifactId> 98 <artifactId>maven-dependency-plugin</artifactId>
201 - <executions>  
202 - <execution>  
203 - <id>copy-winsw-service</id>  
204 - <phase>package</phase>  
205 - <goals>  
206 - <goal>copy</goal>  
207 - </goals>  
208 - <configuration>  
209 - <artifactItems>  
210 - <artifactItem>  
211 - <groupId>com.sun.winsw</groupId>  
212 - <artifactId>winsw</artifactId>  
213 - <classifier>bin</classifier>  
214 - <type>exe</type>  
215 - <destFileName>service.exe</destFileName>  
216 - </artifactItem>  
217 - </artifactItems>  
218 - <outputDirectory>${pkg.win.dist}</outputDirectory>  
219 - </configuration>  
220 - </execution>  
221 - </executions>  
222 </plugin> 99 </plugin>
223 <plugin> 100 <plugin>
224 <groupId>org.apache.maven.plugins</groupId> 101 <groupId>org.apache.maven.plugins</groupId>
225 <artifactId>maven-jar-plugin</artifactId> 102 <artifactId>maven-jar-plugin</artifactId>
226 - <configuration>  
227 - <excludes>  
228 - <exclude>**/logback.xml</exclude>  
229 - </excludes>  
230 - <archive>  
231 - <manifestEntries>  
232 - <Implementation-Title>ThingsBoard MQTT Transport Service</Implementation-Title>  
233 - <Implementation-Version>${project.version}</Implementation-Version>  
234 - </manifestEntries>  
235 - </archive>  
236 - </configuration>  
237 </plugin> 103 </plugin>
238 <plugin> 104 <plugin>
239 <groupId>org.springframework.boot</groupId> 105 <groupId>org.springframework.boot</groupId>
240 <artifactId>spring-boot-maven-plugin</artifactId> 106 <artifactId>spring-boot-maven-plugin</artifactId>
241 - <configuration>  
242 - <mainClass>org.thingsboard.server.mqtt.ThingsboardMqttTransportApplication</mainClass>  
243 - <classifier>boot</classifier>  
244 - <layout>ZIP</layout>  
245 - <executable>true</executable>  
246 - <excludeDevtools>true</excludeDevtools>  
247 - <embeddedLaunchScriptProperties>  
248 - <confFolder>${pkg.installFolder}/conf</confFolder>  
249 - <logFolder>${pkg.unixLogFolder}</logFolder>  
250 - <logFilename>${pkg.name}.out</logFilename>  
251 - <initInfoProvides>${pkg.name}</initInfoProvides>  
252 - </embeddedLaunchScriptProperties>  
253 - </configuration>  
254 - <executions>  
255 - <execution>  
256 - <goals>  
257 - <goal>repackage</goal>  
258 - </goals>  
259 - </execution>  
260 - </executions>  
261 </plugin> 107 </plugin>
262 <plugin> 108 <plugin>
263 <groupId>org.thingsboard</groupId> 109 <groupId>org.thingsboard</groupId>
264 <artifactId>gradle-maven-plugin</artifactId> 110 <artifactId>gradle-maven-plugin</artifactId>
265 - <configuration>  
266 - <tasks>  
267 - <task>build</task>  
268 - <task>buildDeb</task>  
269 - <task>buildRpm</task>  
270 - </tasks>  
271 - <args>  
272 - <arg>-PprojectBuildDir=${project.build.directory}</arg>  
273 - <arg>-PprojectVersion=${project.version}</arg>  
274 - <arg>-PmainJar=${project.build.directory}/${project.build.finalName}-boot.${project.packaging}</arg>  
275 - <arg>-PpkgName=${pkg.name}</arg>  
276 - <arg>-PpkgInstallFolder=${pkg.installFolder}</arg>  
277 - <arg>-PpkgLogFolder=${pkg.unixLogFolder}</arg>  
278 - </args>  
279 - </configuration>  
280 - <executions>  
281 - <execution>  
282 - <phase>package</phase>  
283 - <goals>  
284 - <goal>invoke</goal>  
285 - </goals>  
286 - </execution>  
287 - </executions>  
288 </plugin> 111 </plugin>
289 <plugin> 112 <plugin>
290 <groupId>org.apache.maven.plugins</groupId> 113 <groupId>org.apache.maven.plugins</groupId>
291 <artifactId>maven-assembly-plugin</artifactId> 114 <artifactId>maven-assembly-plugin</artifactId>
292 - <configuration>  
293 - <finalName>${pkg.name}</finalName>  
294 - <descriptors>  
295 - <descriptor>src/main/assembly/windows.xml</descriptor>  
296 - </descriptors>  
297 - </configuration>  
298 - <executions>  
299 - <execution>  
300 - <id>assembly</id>  
301 - <phase>package</phase>  
302 - <goals>  
303 - <goal>single</goal>  
304 - </goals>  
305 - </execution>  
306 - </executions>  
307 </plugin> 115 </plugin>
308 <plugin> 116 <plugin>
309 <groupId>org.apache.maven.plugins</groupId> 117 <groupId>org.apache.maven.plugins</groupId>
310 <artifactId>maven-install-plugin</artifactId> 118 <artifactId>maven-install-plugin</artifactId>
311 - <configuration>  
312 - <file>${project.build.directory}/${pkg.name}.deb</file>  
313 - <artifactId>${project.artifactId}</artifactId>  
314 - <groupId>${project.groupId}</groupId>  
315 - <version>${project.version}</version>  
316 - <classifier>deb</classifier>  
317 - <packaging>deb</packaging>  
318 - </configuration>  
319 - <executions>  
320 - <execution>  
321 - <id>install-deb</id>  
322 - <phase>package</phase>  
323 - <goals>  
324 - <goal>install-file</goal>  
325 - </goals>  
326 - </execution>  
327 - </executions>  
328 </plugin> 119 </plugin>
329 </plugins> 120 </plugins>
330 </build> 121 </build>