Commit 68151e6561ddf3c97bc548ea301bcc65aedd357d

Authored by Andrii Shvaika
1 parent 3ea881f0

Refactored DEB/RPM builds for Java-based components

Showing 62 changed files with 436 additions and 2061 deletions
... ... @@ -34,10 +34,16 @@
34 34 <properties>
35 35 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
36 36 <main.dir>${basedir}/..</main.dir>
  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>
37 40 <pkg.name>thingsboard</pkg.name>
38 41 <pkg.unixLogFolder>/var/log/${pkg.name}</pkg.unixLogFolder>
39 42 <pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder>
  43 + <pkg.copyInstallScripts>true</pkg.copyInstallScripts>
40 44 <pkg.win.dist>${project.build.directory}/windows</pkg.win.dist>
  45 + <pkg.implementationTitle>ThingsBoard</pkg.implementationTitle>
  46 + <pkg.mainClass>org.thingsboard.server.ThingsboardServerApplication</pkg.mainClass>
41 47 </properties>
42 48
43 49 <dependencies>
... ... @@ -309,6 +315,10 @@
309 315 <plugins>
310 316 <plugin>
311 317 <groupId>org.apache.maven.plugins</groupId>
  318 + <artifactId>maven-compiler-plugin</artifactId>
  319 + </plugin>
  320 + <plugin>
  321 + <groupId>org.apache.maven.plugins</groupId>
312 322 <artifactId>maven-surefire-plugin</artifactId>
313 323 <version>${surfire.version}</version>
314 324 <configuration>
... ... @@ -323,320 +333,30 @@
323 333 <plugin>
324 334 <groupId>org.apache.maven.plugins</groupId>
325 335 <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>${main.dir}/packaging/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>${main.dir}/packaging/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>${main.dir}/packaging/scripts/control</directory>
405   - <filtering>true</filtering>
406   - </resource>
407   - </resources>
408   - <filters>
409   - <filter>${main.dir}/packaging/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>${main.dir}/packaging/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>${main.dir}/packaging/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>${main.dir}/packaging/scripts/windows</directory>
447   - <filtering>true</filtering>
448   - </resource>
449   - </resources>
450   - <filters>
451   - <filter>${main.dir}/packaging/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>${main.dir}/packaging/scripts/install</directory>
466   - <includes>
467   - <include>logback.xml</include>
468   - </includes>
469   - <filtering>true</filtering>
470   - </resource>
471   - </resources>
472   - <filters>
473   - <filter>${main.dir}/packaging/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 336 </plugin>
502 337 <plugin>
503 338 <groupId>org.apache.maven.plugins</groupId>
504 339 <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 340 </plugin>
527 341 <plugin>
528 342 <groupId>org.apache.maven.plugins</groupId>
529 343 <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 344 </plugin>
542 345 <plugin>
543 346 <groupId>org.springframework.boot</groupId>
544 347 <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 348 </plugin>
566 349 <plugin>
567 350 <groupId>org.thingsboard</groupId>
568 351 <artifactId>gradle-maven-plugin</artifactId>
569   - <configuration>
570   - <gradleProjectDirectory>${main.dir}/packaging</gradleProjectDirectory>
571   - <tasks>
572   - <task>build</task>
573   - <task>buildDeb</task>
574   - <task>buildRpm</task>
575   - <task>renameDeb</task>
576   - <task>renameRpm</task>
577   - </tasks>
578   - <args>
579   - <arg>-PpackagingDir=${main.dir}/packaging</arg>
580   - <arg>-PprojectBuildDir=${basedir}/target</arg>
581   - <arg>-PprojectVersion=${project.version}</arg>
582   - <arg>-PmainJar=${project.build.directory}/${project.build.finalName}-boot.${project.packaging}
583   - </arg>
584   - <arg>-PpkgName=${pkg.name}</arg>
585   - <arg>-PpkgUser=${pkg.user}</arg>
586   - <arg>-PpkgInstallFolder=${pkg.installFolder}</arg>
587   - <arg>-PpkgLogFolder=${pkg.unixLogFolder}</arg>
588   - <arg>--warning-mode</arg>
589   - <arg>all</arg>
590   - </args>
591   - </configuration>
592   - <executions>
593   - <execution>
594   - <phase>package</phase>
595   - <goals>
596   - <goal>invoke</goal>
597   - </goals>
598   - </execution>
599   - </executions>
600 352 </plugin>
601 353 <plugin>
602 354 <groupId>org.apache.maven.plugins</groupId>
603 355 <artifactId>maven-assembly-plugin</artifactId>
604   - <configuration>
605   - <finalName>${pkg.name}</finalName>
606   - <descriptors>
607   - <descriptor>../packaging/assembly/windows.xml</descriptor>
608   - </descriptors>
609   - </configuration>
610   - <executions>
611   - <execution>
612   - <id>assembly</id>
613   - <phase>package</phase>
614   - <goals>
615   - <goal>single</goal>
616   - </goals>
617   - </execution>
618   - </executions>
619 356 </plugin>
620 357 <plugin>
621 358 <groupId>org.apache.maven.plugins</groupId>
622 359 <artifactId>maven-install-plugin</artifactId>
623   - <configuration>
624   - <file>${project.build.directory}/${pkg.name}.deb</file>
625   - <artifactId>${project.artifactId}</artifactId>
626   - <groupId>${project.groupId}</groupId>
627   - <version>${project.version}</version>
628   - <classifier>deb</classifier>
629   - <packaging>deb</packaging>
630   - </configuration>
631   - <executions>
632   - <execution>
633   - <id>install-deb</id>
634   - <phase>package</phase>
635   - <goals>
636   - <goal>install-file</goal>
637   - </goals>
638   - </execution>
639   - </executions>
640 360 </plugin>
641 361 <plugin>
642 362 <groupId>org.xolstice.maven.plugins</groupId>
... ...
... ... @@ -17,7 +17,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
17 17
18 18 buildscript {
19 19 ext {
20   - osPackageVersion = "3.8.0"
  20 + osPackageVersion = "8.3.0"
21 21 }
22 22 repositories {
23 23 jcenter()
... ... @@ -72,8 +72,8 @@ buildRpm {
72 72
73 73 arch = X86_64
74 74
75   - version = projectVersion.replace('-', '')
76   - archiveName = "${pkgName}.rpm"
  75 + archiveVersion = projectVersion.replace('-', '')
  76 + archiveFileName = "${pkgName}.rpm"
77 77
78 78 preInstall file("${buildDir}/control/rpm/preinst")
79 79 postInstall file("${buildDir}/control/rpm/postinst")
... ... @@ -90,7 +90,6 @@ buildRpm {
90 90 into "/usr/lib/systemd/system"
91 91 }
92 92
93   - directory(pkgLogFolder, 0755)
94 93 link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
95 94 }
96 95
... ... @@ -99,7 +98,7 @@ buildDeb {
99 98
100 99 arch = "amd64"
101 100
102   - archiveName = "${pkgName}.deb"
  101 + archiveFileName = "${pkgName}.deb"
103 102
104 103 configurationFile("${pkgInstallFolder}/conf/${pkgName}.conf")
105 104 configurationFile("${pkgInstallFolder}/conf/custom-environment-variables.yml")
... ... @@ -114,7 +113,27 @@ buildDeb {
114 113 user pkgUser
115 114 permissionGroup pkgUser
116 115
117   - directory(pkgLogFolder, 0755)
118 116 link("/etc/init.d/${pkgName}", "${pkgInstallFolder}/init/${pkgName}")
119 117 link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
120 118 }
  119 +
  120 +task renameDeb(type: Copy) {
  121 + from("${buildDir}/") {
  122 + include '*.deb'
  123 + destinationDir file("${buildDir}/")
  124 + rename { String filename ->
  125 + "${pkgName}.deb"
  126 + }
  127 + }
  128 +}
  129 +
  130 +task renameRpm(type: Copy) {
  131 + from("${buildDir}/") {
  132 + include '*.rpm'
  133 + destinationDir file("${buildDir}/")
  134 + rename { String filename ->
  135 + "${pkgName}.rpm"
  136 + }
  137 + }
  138 +}
  139 +
... ...
... ... @@ -233,10 +233,13 @@
233 233 <groupId>org.thingsboard</groupId>
234 234 <artifactId>gradle-maven-plugin</artifactId>
235 235 <configuration>
  236 + <gradleProjectDirectory>${basedir}</gradleProjectDirectory>
236 237 <tasks>
237 238 <task>build</task>
238 239 <task>buildDeb</task>
239 240 <task>buildRpm</task>
  241 + <task>renameDeb</task>
  242 + <task>renameRpm</task>
240 243 </tasks>
241 244 <args>
242 245 <arg>-PprojectBuildDir=${project.build.directory}</arg>
... ...
1 1 #!/bin/sh
2 2
  3 +mkdir -m 0755 -p ${pkg.logFolder}
3 4 chown -R ${pkg.user}: ${pkg.logFolder}
4 5 chown -R ${pkg.user}: ${pkg.installFolder}
5 6 update-rc.d ${pkg.name} defaults
... ...
1 1 #!/bin/sh
2 2
  3 +mkdir -m 0755 -p ${pkg.logFolder}
3 4 chown -R ${pkg.user}: ${pkg.logFolder}
4 5 chown -R ${pkg.user}: ${pkg.installFolder}
5 6
... ...
... ... @@ -17,7 +17,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
17 17
18 18 buildscript {
19 19 ext {
20   - osPackageVersion = "3.8.0"
  20 + osPackageVersion = "8.3.0"
21 21 }
22 22 repositories {
23 23 jcenter()
... ... @@ -77,8 +77,8 @@ buildRpm {
77 77
78 78 arch = X86_64
79 79
80   - version = projectVersion.replace('-', '')
81   - archiveName = "${pkgName}.rpm"
  80 + archiveVersion = projectVersion.replace('-', '')
  81 + archiveFileName = "${pkgName}.rpm"
82 82
83 83 preInstall file("${buildDir}/control/rpm/preinst")
84 84 postInstall file("${buildDir}/control/rpm/postinst")
... ... @@ -95,7 +95,6 @@ buildRpm {
95 95 into "/usr/lib/systemd/system"
96 96 }
97 97
98   - directory(pkgLogFolder, 0755)
99 98 link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
100 99 }
101 100
... ... @@ -104,7 +103,7 @@ buildDeb {
104 103
105 104 arch = "amd64"
106 105
107   - archiveName = "${pkgName}.deb"
  106 + archiveFileName = "${pkgName}.deb"
108 107
109 108 configurationFile("${pkgInstallFolder}/conf/${pkgName}.conf")
110 109 configurationFile("${pkgInstallFolder}/conf/custom-environment-variables.yml")
... ... @@ -119,7 +118,26 @@ buildDeb {
119 118 user pkgUser
120 119 permissionGroup pkgUser
121 120
122   - directory(pkgLogFolder, 0755)
123 121 link("/etc/init.d/${pkgName}", "${pkgInstallFolder}/init/${pkgName}")
124 122 link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
125 123 }
  124 +
  125 +task renameDeb(type: Copy) {
  126 + from("${buildDir}/") {
  127 + include '*.deb'
  128 + destinationDir file("${buildDir}/")
  129 + rename { String filename ->
  130 + "${pkgName}.deb"
  131 + }
  132 + }
  133 +}
  134 +
  135 +task renameRpm(type: Copy) {
  136 + from("${buildDir}/") {
  137 + include '*.rpm'
  138 + destinationDir file("${buildDir}/")
  139 + rename { String filename ->
  140 + "${pkgName}.rpm"
  141 + }
  142 + }
  143 +}
... ...
... ... @@ -257,10 +257,13 @@
257 257 <groupId>org.thingsboard</groupId>
258 258 <artifactId>gradle-maven-plugin</artifactId>
259 259 <configuration>
  260 + <gradleProjectDirectory>${basedir}</gradleProjectDirectory>
260 261 <tasks>
261 262 <task>build</task>
262 263 <task>buildDeb</task>
263 264 <task>buildRpm</task>
  265 + <task>renameDeb</task>
  266 + <task>renameRpm</task>
264 267 </tasks>
265 268 <args>
266 269 <arg>-PprojectBuildDir=${project.build.directory}</arg>
... ...
... ... @@ -22,7 +22,6 @@
22 22 <version>2.5.1-SNAPSHOT</version>
23 23 <artifactId>thingsboard</artifactId>
24 24 </parent>
25   - <groupId>org.thingsboard</groupId>
26 25 <artifactId>netty-mqtt</artifactId>
27 26 <version>2.5.1-SNAPSHOT</version>
28 27 <packaging>jar</packaging>
... ...
... ... @@ -56,19 +56,21 @@ ospackage {
56 56 into "bin"
57 57 }
58 58
59   - // Copy the install files
60   - from("${buildDir}/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("${buildDir}/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("${buildDir}/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 76 // Copy the config files
... ...
... ... @@ -29,7 +29,11 @@
29 29
30 30 <properties>
31 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 35 <pkg.user>thingsboard</pkg.user>
  36 + <pkg.implementationTitle>${project.name}</pkg.implementationTitle>
33 37 <spring-boot.version>2.2.6.RELEASE</spring-boot.version>
34 38 <spring-oauth2.version>2.1.2.RELEASE</spring-oauth2.version>
35 39 <spring.version>5.2.6.RELEASE</spring.version>
... ... @@ -133,6 +137,340 @@
133 137 <downloadJavadocs>true</downloadJavadocs>
134 138 </properties>
135 139 </profile>
  140 +
  141 + <profile>
  142 + <id>packaging</id>
  143 + <activation>
  144 + <activeByDefault>true</activeByDefault>
  145 + </activation>
  146 + <build>
  147 + <pluginManagement>
  148 + <plugins>
  149 + <plugin>
  150 + <groupId>org.apache.maven.plugins</groupId>
  151 + <artifactId>maven-resources-plugin</artifactId>
  152 + <executions>
  153 + <execution>
  154 + <id>copy-conf</id>
  155 + <phase>${pkg.process-resources.phase}</phase>
  156 + <goals>
  157 + <goal>copy-resources</goal>
  158 + </goals>
  159 + <configuration>
  160 + <outputDirectory>${project.build.directory}/conf</outputDirectory>
  161 + <resources>
  162 + <resource>
  163 + <directory>src/main/resources</directory>
  164 + <excludes>
  165 + <exclude>logback.xml</exclude>
  166 + </excludes>
  167 + <filtering>false</filtering>
  168 + </resource>
  169 + </resources>
  170 + </configuration>
  171 + </execution>
  172 + <execution>
  173 + <id>copy-service-conf</id>
  174 + <phase>${pkg.process-resources.phase}</phase>
  175 + <goals>
  176 + <goal>copy-resources</goal>
  177 + </goals>
  178 + <configuration>
  179 + <outputDirectory>${project.build.directory}/conf</outputDirectory>
  180 + <resources>
  181 + <resource>
  182 + <directory>src/main/conf</directory>
  183 + <filtering>true</filtering>
  184 + </resource>
  185 + </resources>
  186 + <filters>
  187 + <filter>${main.dir}/packaging/filters/unix.properties</filter>
  188 + </filters>
  189 + </configuration>
  190 + </execution>
  191 + <execution>
  192 + <id>copy-win-conf</id>
  193 + <phase>${pkg.process-resources.phase}</phase>
  194 + <goals>
  195 + <goal>copy-resources</goal>
  196 + </goals>
  197 + <configuration>
  198 + <outputDirectory>${pkg.win.dist}/conf</outputDirectory>
  199 + <resources>
  200 + <resource>
  201 + <directory>src/main/resources</directory>
  202 + <excludes>
  203 + <exclude>logback.xml</exclude>
  204 + </excludes>
  205 + <filtering>false</filtering>
  206 + </resource>
  207 + <resource>
  208 + <directory>src/main/conf</directory>
  209 + <excludes>
  210 + <exclude>thingsboard.conf</exclude>
  211 + </excludes>
  212 + <filtering>true</filtering>
  213 + </resource>
  214 + </resources>
  215 + <filters>
  216 + <filter>${main.dir}/packaging/filters/windows.properties</filter>
  217 + </filters>
  218 + </configuration>
  219 + </execution>
  220 + <execution>
  221 + <id>copy-control</id>
  222 + <phase>${pkg.process-resources.phase}</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>${main.dir}/packaging/scripts/control</directory>
  231 + <filtering>true</filtering>
  232 + </resource>
  233 + </resources>
  234 + <filters>
  235 + <filter>${main.dir}/packaging/filters/unix.properties</filter>
  236 + </filters>
  237 + </configuration>
  238 + </execution>
  239 + <execution>
  240 + <id>copy-install</id>
  241 + <phase>${pkg.process-resources.phase}</phase>
  242 + <goals>
  243 + <goal>copy-resources</goal>
  244 + </goals>
  245 + <configuration>
  246 + <outputDirectory>${project.build.directory}/bin/install</outputDirectory>
  247 + <resources>
  248 + <resource>
  249 + <directory>${main.dir}/packaging/scripts/install</directory>
  250 + <includes>
  251 + <include>**/*.sh</include>
  252 + <include>**/*.xml</include>
  253 + </includes>
  254 + <filtering>true</filtering>
  255 + </resource>
  256 + </resources>
  257 + <filters>
  258 + <filter>${main.dir}/packaging/filters/unix.properties</filter>
  259 + </filters>
  260 + </configuration>
  261 + </execution>
  262 + <execution>
  263 + <id>copy-windows-control</id>
  264 + <phase>${pkg.process-resources.phase}</phase>
  265 + <goals>
  266 + <goal>copy-resources</goal>
  267 + </goals>
  268 + <configuration>
  269 + <outputDirectory>${pkg.win.dist}</outputDirectory>
  270 + <resources>
  271 + <resource>
  272 + <directory>${main.dir}/packaging/scripts/windows</directory>
  273 + <filtering>true</filtering>
  274 + </resource>
  275 + </resources>
  276 + <filters>
  277 + <filter>${main.dir}/packaging/filters/windows.properties</filter>
  278 + </filters>
  279 + </configuration>
  280 + </execution>
  281 + <execution>
  282 + <id>copy-windows-install</id>
  283 + <phase>${pkg.process-resources.phase}</phase>
  284 + <goals>
  285 + <goal>copy-resources</goal>
  286 + </goals>
  287 + <configuration>
  288 + <outputDirectory>${pkg.win.dist}/install</outputDirectory>
  289 + <resources>
  290 + <resource>
  291 + <directory>${main.dir}/packaging/scripts/install</directory>
  292 + <includes>
  293 + <include>logback.xml</include>
  294 + </includes>
  295 + <filtering>true</filtering>
  296 + </resource>
  297 + </resources>
  298 + <filters>
  299 + <filter>${main.dir}/packaging/filters/windows.properties</filter>
  300 + </filters>
  301 + </configuration>
  302 + </execution>
  303 + <execution>
  304 + <id>copy-data</id>
  305 + <phase>${pkg.process-resources.phase}</phase>
  306 + <goals>
  307 + <goal>copy-resources</goal>
  308 + </goals>
  309 + <configuration>
  310 + <outputDirectory>${project.build.directory}/data</outputDirectory>
  311 + <resources>
  312 + <resource>
  313 + <directory>src/main/data</directory>
  314 + </resource>
  315 + <resource>
  316 + <directory>../dao/src/main/resources</directory>
  317 + <includes>
  318 + <include>**/*.cql</include>
  319 + <include>**/*.sql</include>
  320 + </includes>
  321 + <filtering>false</filtering>
  322 + </resource>
  323 + </resources>
  324 + </configuration>
  325 + </execution>
  326 + </executions>
  327 + </plugin>
  328 + <plugin>
  329 + <groupId>org.apache.maven.plugins</groupId>
  330 + <artifactId>maven-dependency-plugin</artifactId>
  331 + <executions>
  332 + <execution>
  333 + <id>copy-winsw-service</id>
  334 + <phase>${pkg.package.phase}</phase>
  335 + <goals>
  336 + <goal>copy</goal>
  337 + </goals>
  338 + <configuration>
  339 + <artifactItems>
  340 + <artifactItem>
  341 + <groupId>com.sun.winsw</groupId>
  342 + <artifactId>winsw</artifactId>
  343 + <classifier>bin</classifier>
  344 + <type>exe</type>
  345 + <destFileName>service.exe</destFileName>
  346 + </artifactItem>
  347 + </artifactItems>
  348 + <outputDirectory>${pkg.win.dist}</outputDirectory>
  349 + </configuration>
  350 + </execution>
  351 + </executions>
  352 + </plugin>
  353 + <plugin>
  354 + <groupId>org.apache.maven.plugins</groupId>
  355 + <artifactId>maven-jar-plugin</artifactId>
  356 + <configuration>
  357 + <excludes>
  358 + <exclude>**/logback.xml</exclude>
  359 + </excludes>
  360 + <archive>
  361 + <manifestEntries>
  362 + <Implementation-Title>${pkg.implementationTitle}</Implementation-Title>
  363 + <Implementation-Version>${project.version}</Implementation-Version>
  364 + </manifestEntries>
  365 + </archive>
  366 + </configuration>
  367 + </plugin>
  368 + <plugin>
  369 + <groupId>org.springframework.boot</groupId>
  370 + <artifactId>spring-boot-maven-plugin</artifactId>
  371 + <configuration>
  372 + <skip>${pkg.disabled}</skip>
  373 + <mainClass>${pkg.mainClass}</mainClass>
  374 + <classifier>boot</classifier>
  375 + <layout>ZIP</layout>
  376 + <executable>true</executable>
  377 + <excludeDevtools>true</excludeDevtools>
  378 + <embeddedLaunchScriptProperties>
  379 + <confFolder>${pkg.installFolder}/conf</confFolder>
  380 + <logFolder>${pkg.unixLogFolder}</logFolder>
  381 + <logFilename>${pkg.name}.out</logFilename>
  382 + <initInfoProvides>${pkg.name}</initInfoProvides>
  383 + </embeddedLaunchScriptProperties>
  384 + </configuration>
  385 + <executions>
  386 + <execution>
  387 + <goals>
  388 + <goal>repackage</goal>
  389 + </goals>
  390 + </execution>
  391 + </executions>
  392 + </plugin>
  393 + <plugin>
  394 + <groupId>org.thingsboard</groupId>
  395 + <artifactId>gradle-maven-plugin</artifactId>
  396 + <configuration>
  397 + <gradleProjectDirectory>${main.dir}/packaging</gradleProjectDirectory>
  398 + <tasks>
  399 + <task>build</task>
  400 + <task>buildDeb</task>
  401 + <task>buildRpm</task>
  402 + <task>renameDeb</task>
  403 + <task>renameRpm</task>
  404 + </tasks>
  405 + <args>
  406 + <arg>-PpackagingDir=${main.dir}/packaging</arg>
  407 + <arg>-PprojectBuildDir=${basedir}/target</arg>
  408 + <arg>-PprojectVersion=${project.version}</arg>
  409 + <arg>
  410 + -PmainJar=${project.build.directory}/${project.build.finalName}-boot.${project.packaging}
  411 + </arg>
  412 + <arg>-PpkgName=${pkg.name}</arg>
  413 + <arg>-PpkgUser=${pkg.user}</arg>
  414 + <arg>-PpkgInstallFolder=${pkg.installFolder}</arg>
  415 + <arg>-PpkgCopyInstallScripts=${pkg.copyInstallScripts}</arg>
  416 + <arg>-PpkgLogFolder=${pkg.unixLogFolder}</arg>
  417 + <arg>--warning-mode</arg>
  418 + <arg>all</arg>
  419 + </args>
  420 + </configuration>
  421 + <executions>
  422 + <execution>
  423 + <phase>${pkg.package.phase}</phase>
  424 + <goals>
  425 + <goal>invoke</goal>
  426 + </goals>
  427 + </execution>
  428 + </executions>
  429 + </plugin>
  430 + <plugin>
  431 + <groupId>org.apache.maven.plugins</groupId>
  432 + <artifactId>maven-assembly-plugin</artifactId>
  433 + <configuration>
  434 + <finalName>${pkg.name}</finalName>
  435 + <descriptors>
  436 + <descriptor>${main.dir}/packaging/assembly/windows.xml</descriptor>
  437 + </descriptors>
  438 + </configuration>
  439 + <executions>
  440 + <execution>
  441 + <id>assembly</id>
  442 + <phase>${pkg.package.phase}</phase>
  443 + <goals>
  444 + <goal>single</goal>
  445 + </goals>
  446 + </execution>
  447 + </executions>
  448 + </plugin>
  449 + <plugin>
  450 + <groupId>org.apache.maven.plugins</groupId>
  451 + <artifactId>maven-install-plugin</artifactId>
  452 + <configuration>
  453 + <file>${project.build.directory}/${pkg.name}.deb</file>
  454 + <artifactId>${project.artifactId}</artifactId>
  455 + <groupId>${project.groupId}</groupId>
  456 + <version>${project.version}</version>
  457 + <classifier>deb</classifier>
  458 + <packaging>deb</packaging>
  459 + </configuration>
  460 + <executions>
  461 + <execution>
  462 + <id>install-deb</id>
  463 + <phase>${pkg.package.phase}</phase>
  464 + <goals>
  465 + <goal>install-file</goal>
  466 + </goals>
  467 + </execution>
  468 + </executions>
  469 + </plugin>
  470 + </plugins>
  471 + </pluginManagement>
  472 + </build>
  473 + </profile>
136 474 </profiles>
137 475
138 476 <build>
... ...
... ... @@ -155,31 +155,6 @@
155 155 <groupId>org.codehaus.mojo</groupId>
156 156 <artifactId>build-helper-maven-plugin</artifactId>
157 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 158 </plugins>
184 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,16 @@
33 33 <properties>
34 34 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
35 35 <main.dir>${basedir}/../..</main.dir>
  36 + <pkg.disabled>false</pkg.disabled>
  37 + <pkg.process-resources.phase>process-resources</pkg.process-resources.phase>
  38 + <pkg.package.phase>package</pkg.package.phase>
36 39 <pkg.name>tb-coap-transport</pkg.name>
37 40 <pkg.unixLogFolder>/var/log/${pkg.name}</pkg.unixLogFolder>
38 41 <pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder>
  42 + <pkg.copyInstallScripts>false</pkg.copyInstallScripts>
39 43 <pkg.win.dist>${project.build.directory}/windows</pkg.win.dist>
  44 + <pkg.implementationTitle>ThingsBoard CoAP Transport Service</pkg.implementationTitle>
  45 + <pkg.mainClass>org.thingsboard.server.coap.ThingsboardCoapTransportApplication</pkg.mainClass>
40 46 </properties>
41 47
42 48 <dependencies>
... ... @@ -87,244 +93,30 @@
87 93 <plugin>
88 94 <groupId>org.apache.maven.plugins</groupId>
89 95 <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 96 </plugin>
198 97 <plugin>
199 98 <groupId>org.apache.maven.plugins</groupId>
200 99 <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 100 </plugin>
223 101 <plugin>
224 102 <groupId>org.apache.maven.plugins</groupId>
225 103 <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 104 </plugin>
238 105 <plugin>
239 106 <groupId>org.springframework.boot</groupId>
240 107 <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 108 </plugin>
262 109 <plugin>
263 110 <groupId>org.thingsboard</groupId>
264 111 <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 112 </plugin>
289 113 <plugin>
290 114 <groupId>org.apache.maven.plugins</groupId>
291 115 <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 116 </plugin>
308 117 <plugin>
309 118 <groupId>org.apache.maven.plugins</groupId>
310 119 <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 120 </plugin>
329 121 </plugins>
330 122 </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}
\ No newline at end of file
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.
\ No newline at end of file
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,16 @@
33 33 <properties>
34 34 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
35 35 <main.dir>${basedir}/../..</main.dir>
  36 + <pkg.disabled>false</pkg.disabled>
  37 + <pkg.process-resources.phase>process-resources</pkg.process-resources.phase>
  38 + <pkg.package.phase>package</pkg.package.phase>
36 39 <pkg.name>tb-http-transport</pkg.name>
37 40 <pkg.unixLogFolder>/var/log/${pkg.name}</pkg.unixLogFolder>
38 41 <pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder>
  42 + <pkg.copyInstallScripts>false</pkg.copyInstallScripts>
39 43 <pkg.win.dist>${project.build.directory}/windows</pkg.win.dist>
  44 + <pkg.implementationTitle>ThingsBoard HTTP Transport Service</pkg.implementationTitle>
  45 + <pkg.mainClass>org.thingsboard.server.http.ThingsboardHttpTransportApplication</pkg.mainClass>
40 46 </properties>
41 47
42 48 <dependencies>
... ... @@ -87,244 +93,30 @@
87 93 <plugin>
88 94 <groupId>org.apache.maven.plugins</groupId>
89 95 <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 96 </plugin>
198 97 <plugin>
199 98 <groupId>org.apache.maven.plugins</groupId>
200 99 <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 100 </plugin>
223 101 <plugin>
224 102 <groupId>org.apache.maven.plugins</groupId>
225 103 <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 104 </plugin>
238 105 <plugin>
239 106 <groupId>org.springframework.boot</groupId>
240 107 <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 108 </plugin>
262 109 <plugin>
263 110 <groupId>org.thingsboard</groupId>
264 111 <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 112 </plugin>
289 113 <plugin>
290 114 <groupId>org.apache.maven.plugins</groupId>
291 115 <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 116 </plugin>
308 117 <plugin>
309 118 <groupId>org.apache.maven.plugins</groupId>
310 119 <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 120 </plugin>
329 121 </plugins>
330 122 </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}
\ No newline at end of file
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.
\ No newline at end of file
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,16 @@
33 33 <properties>
34 34 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
35 35 <main.dir>${basedir}/../..</main.dir>
  36 + <pkg.disabled>false</pkg.disabled>
  37 + <pkg.process-resources.phase>process-resources</pkg.process-resources.phase>
  38 + <pkg.package.phase>package</pkg.package.phase>
36 39 <pkg.name>tb-mqtt-transport</pkg.name>
37 40 <pkg.unixLogFolder>/var/log/${pkg.name}</pkg.unixLogFolder>
38 41 <pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder>
  42 + <pkg.copyInstallScripts>false</pkg.copyInstallScripts>
39 43 <pkg.win.dist>${project.build.directory}/windows</pkg.win.dist>
  44 + <pkg.implementationTitle>ThingsBoard MQTT Transport Service</pkg.implementationTitle>
  45 + <pkg.mainClass>org.thingsboard.server.mqtt.ThingsboardMqttTransportApplication</pkg.mainClass>
40 46 </properties>
41 47
42 48 <dependencies>
... ... @@ -87,244 +93,30 @@
87 93 <plugin>
88 94 <groupId>org.apache.maven.plugins</groupId>
89 95 <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 96 </plugin>
198 97 <plugin>
199 98 <groupId>org.apache.maven.plugins</groupId>
200 99 <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 100 </plugin>
223 101 <plugin>
224 102 <groupId>org.apache.maven.plugins</groupId>
225 103 <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 104 </plugin>
238 105 <plugin>
239 106 <groupId>org.springframework.boot</groupId>
240 107 <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 108 </plugin>
262 109 <plugin>
263 110 <groupId>org.thingsboard</groupId>
264 111 <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 112 </plugin>
289 113 <plugin>
290 114 <groupId>org.apache.maven.plugins</groupId>
291 115 <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 116 </plugin>
308 117 <plugin>
309 118 <groupId>org.apache.maven.plugins</groupId>
310 119 <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 120 </plugin>
329 121 </plugins>
330 122 </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}
\ No newline at end of file
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.
\ No newline at end of file