Showing
37 changed files
with
1041 additions
and
47 deletions
1 | 1 | /** |
2 | 2 | * Copyright © 2016-2018 The Thingsboard Authors |
3 | - * <p> | |
3 | + * | |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
6 | 6 | * You may obtain a copy of the License at |
7 | - * <p> | |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | - * <p> | |
7 | + * | |
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | + * | |
10 | 10 | * Unless required by applicable law or agreed to in writing, software |
11 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ... | ... |
... | ... | @@ -58,8 +58,6 @@ import java.util.function.Consumer; |
58 | 58 | @ConditionalOnProperty(prefix = "transport", value = "type", havingValue = "remote") |
59 | 59 | public class RemoteRuleEngineTransportService implements RuleEngineTransportService { |
60 | 60 | |
61 | - private static final ObjectMapper mapper = new ObjectMapper(); | |
62 | - | |
63 | 61 | @Value("${transport.remote.rule_engine.topic}") |
64 | 62 | private String ruleEngineTopic; |
65 | 63 | @Value("${transport.remote.notifications.topic}") | ... | ... |
... | ... | @@ -386,6 +386,19 @@ kafka: |
386 | 386 | batch.size: "${TB_KAFKA_BATCH_SIZE:16384}" |
387 | 387 | linger.ms: "${TB_KAFKA_LINGER_MS:1}" |
388 | 388 | buffer.memory: "${TB_BUFFER_MEMORY:33554432}" |
389 | + transport_api: | |
390 | + requests_topic: "${TB_TRANSPORT_API_REQUEST_TOPIC:tb.transport.api.requests}" | |
391 | + responses_topic: "${TB_TRANSPORT_API_RESPONSE_TOPIC:tb.transport.api.responses}" | |
392 | + max_pending_requests: "${TB_TRANSPORT_MAX_PENDING_REQUESTS:10000}" | |
393 | + request_timeout: "${TB_TRANSPORT_MAX_REQUEST_TIMEOUT:10000}" | |
394 | + request_poll_interval: "${TB_TRANSPORT_REQUEST_POLL_INTERVAL_MS:25}" | |
395 | + request_auto_commit_interval: "${TB_TRANSPORT_REQUEST_AUTO_COMMIT_INTERVAL_MS:100}" | |
396 | + rule_engine: | |
397 | + topic: "${TB_RULE_ENGINE_TOPIC:tb.rule-engine}" | |
398 | + poll_interval: "${TB_RULE_ENGINE_POLL_INTERVAL_MS:25}" | |
399 | + auto_commit_interval: "${TB_RULE_ENGINE_AUTO_COMMIT_INTERVAL_MS:100}" | |
400 | + notifications: | |
401 | + topic: "${TB_TRANSPORT_NOTIFICATIONS_TOPIC:tb.transport.notifications}" | |
389 | 402 | |
390 | 403 | js: |
391 | 404 | evaluator: "${JS_EVALUATOR:local}" # local/remote |
... | ... | @@ -434,12 +447,12 @@ transport: |
434 | 447 | topic: "${TB_TRANSPORT_NOTIFICATIONS_TOPIC:tb.transport.notifications}" |
435 | 448 | # Local HTTP transport parameters |
436 | 449 | http: |
437 | - enabled: "${MQTT_ENABLED:true}" | |
450 | + enabled: "${HTTP_ENABLED:true}" | |
438 | 451 | request_timeout: "${HTTP_REQUEST_TIMEOUT:60000}" |
439 | 452 | # Local MQTT transport parameters |
440 | 453 | mqtt: |
441 | 454 | # Enable/disable mqtt transport protocol. |
442 | - enabled: "${MQTT_ENABLED:false}" | |
455 | + enabled: "${MQTT_ENABLED:true}" | |
443 | 456 | bind_address: "${MQTT_BIND_ADDRESS:0.0.0.0}" |
444 | 457 | bind_port: "${MQTT_BIND_PORT:1883}" |
445 | 458 | adaptor: "${MQTT_ADAPTOR_NAME:JsonMqttAdaptor}" | ... | ... |
1 | 1 | /** |
2 | 2 | * Copyright © 2016-2018 The Thingsboard Authors |
3 | - * <p> | |
3 | + * | |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
6 | 6 | * You may obtain a copy of the License at |
7 | - * <p> | |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | - * <p> | |
7 | + * | |
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | + * | |
10 | 10 | * Unless required by applicable law or agreed to in writing, software |
11 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
... | ... | @@ -19,6 +19,7 @@ import com.google.gson.JsonObject; |
19 | 19 | import com.google.gson.JsonParser; |
20 | 20 | import lombok.extern.slf4j.Slf4j; |
21 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
22 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; | |
22 | 23 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
23 | 24 | import org.springframework.http.HttpStatus; |
24 | 25 | import org.springframework.http.ResponseEntity; |
... | ... | @@ -60,7 +61,7 @@ import java.util.function.Consumer; |
60 | 61 | * @author Andrew Shvayka |
61 | 62 | */ |
62 | 63 | @RestController |
63 | -@ConditionalOnProperty(prefix = "transport.http", value = "enabled", havingValue = "true", matchIfMissing = true) | |
64 | +@ConditionalOnExpression("'${transport.type:null}'=='null' || ('${transport.type}'=='local' && '${transport.http.enabled}'=='true')") | |
64 | 65 | @RequestMapping("/api/v1") |
65 | 66 | @Slf4j |
66 | 67 | public class DeviceApiController { | ... | ... |
1 | 1 | /** |
2 | 2 | * Copyright © 2016-2018 The Thingsboard Authors |
3 | - * <p> | |
3 | + * | |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
6 | 6 | * You may obtain a copy of the License at |
7 | - * <p> | |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | - * <p> | |
7 | + * | |
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | + * | |
10 | 10 | * Unless required by applicable law or agreed to in writing, software |
11 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
... | ... | @@ -18,15 +18,18 @@ package org.thingsboard.server.transport.http; |
18 | 18 | import lombok.Getter; |
19 | 19 | import lombok.extern.slf4j.Slf4j; |
20 | 20 | import org.springframework.beans.factory.annotation.Value; |
21 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; | |
21 | 22 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
22 | 23 | import org.springframework.stereotype.Component; |
23 | 24 | import org.thingsboard.server.common.transport.TransportContext; |
24 | 25 | |
26 | +import javax.annotation.PostConstruct; | |
27 | + | |
25 | 28 | /** |
26 | 29 | * Created by ashvayka on 04.10.18. |
27 | 30 | */ |
28 | 31 | @Slf4j |
29 | -@ConditionalOnProperty(prefix = "transport.http", value = "enabled", havingValue = "true", matchIfMissing = true) | |
32 | +@ConditionalOnExpression("'${transport.type:null}'=='null' || ('${transport.type}'=='local' && '${transport.http.enabled}'=='true')") | |
30 | 33 | @Component |
31 | 34 | public class HttpTransportContext extends TransportContext { |
32 | 35 | ... | ... |
... | ... | @@ -20,6 +20,7 @@ import io.netty.handler.ssl.SslHandler; |
20 | 20 | import lombok.extern.slf4j.Slf4j; |
21 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
22 | 22 | import org.springframework.beans.factory.annotation.Value; |
23 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; | |
23 | 24 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
24 | 25 | import org.springframework.stereotype.Component; |
25 | 26 | import org.springframework.util.StringUtils; |
... | ... | @@ -52,6 +53,7 @@ import java.util.concurrent.TimeUnit; |
52 | 53 | */ |
53 | 54 | @Slf4j |
54 | 55 | @Component("MqttSslHandlerProvider") |
56 | +@ConditionalOnExpression("'${transport.type:null}'=='null' || ('${transport.type}'=='local' && '${transport.http.enabled}'=='true')") | |
55 | 57 | @ConditionalOnProperty(prefix = "mqtt.ssl", value = "enabled", havingValue = "true", matchIfMissing = false) |
56 | 58 | public class MqttSslHandlerProvider { |
57 | 59 | ... | ... |
... | ... | @@ -23,6 +23,7 @@ import lombok.Setter; |
23 | 23 | import lombok.extern.slf4j.Slf4j; |
24 | 24 | import org.springframework.beans.factory.annotation.Autowired; |
25 | 25 | import org.springframework.beans.factory.annotation.Value; |
26 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; | |
26 | 27 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
27 | 28 | import org.springframework.stereotype.Component; |
28 | 29 | import org.thingsboard.server.common.transport.TransportContext; |
... | ... | @@ -40,7 +41,7 @@ import java.util.concurrent.Executors; |
40 | 41 | * Created by ashvayka on 04.10.18. |
41 | 42 | */ |
42 | 43 | @Slf4j |
43 | -@ConditionalOnProperty(prefix = "transport.mqtt", value = "enabled", havingValue = "true", matchIfMissing = true) | |
44 | +@ConditionalOnExpression("'${transport.type:null}'=='null' || ('${transport.type}'=='local' && '${transport.mqtt.enabled}'=='true')") | |
44 | 45 | @Component |
45 | 46 | public class MqttTransportContext extends TransportContext { |
46 | 47 | ... | ... |
1 | 1 | /** |
2 | 2 | * Copyright © 2016-2018 The Thingsboard Authors |
3 | - * <p> | |
3 | + * | |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
6 | 6 | * You may obtain a copy of the License at |
7 | - * <p> | |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | - * <p> | |
7 | + * | |
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | + * | |
10 | 10 | * Unless required by applicable law or agreed to in writing, software |
11 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ... | ... |
... | ... | @@ -24,6 +24,7 @@ import io.netty.util.ResourceLeakDetector; |
24 | 24 | import lombok.extern.slf4j.Slf4j; |
25 | 25 | import org.springframework.beans.factory.annotation.Autowired; |
26 | 26 | import org.springframework.beans.factory.annotation.Value; |
27 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; | |
27 | 28 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
28 | 29 | import org.springframework.stereotype.Service; |
29 | 30 | |
... | ... | @@ -34,7 +35,7 @@ import javax.annotation.PreDestroy; |
34 | 35 | * @author Andrew Shvayka |
35 | 36 | */ |
36 | 37 | @Service("MqttTransportService") |
37 | -@ConditionalOnProperty(prefix = "transport.mqtt", value = "enabled", havingValue = "true", matchIfMissing = true) | |
38 | +@ConditionalOnExpression("'${transport.type:null}'=='null' || ('${transport.type}'=='local' && '${transport.mqtt.enabled}'=='true')") | |
38 | 39 | @Slf4j |
39 | 40 | public class MqttTransportService { |
40 | 41 | ... | ... |
1 | 1 | /** |
2 | 2 | * Copyright © 2016-2018 The Thingsboard Authors |
3 | - * <p> | |
3 | + * | |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
6 | 6 | * You may obtain a copy of the License at |
7 | - * <p> | |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | - * <p> | |
7 | + * | |
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | + * | |
10 | 10 | * Unless required by applicable law or agreed to in writing, software |
11 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ... | ... |
1 | +/** | |
2 | + * Copyright © 2016-2018 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 | + */ | |
1 | 16 | package org.thingsboard.server.common.transport.service; |
2 | 17 | |
3 | 18 | import lombok.extern.slf4j.Slf4j; | ... | ... |
... | ... | @@ -21,6 +21,7 @@ import org.apache.kafka.clients.producer.Callback; |
21 | 21 | import org.apache.kafka.clients.producer.RecordMetadata; |
22 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
23 | 23 | import org.springframework.beans.factory.annotation.Value; |
24 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; | |
24 | 25 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
25 | 26 | import org.springframework.stereotype.Service; |
26 | 27 | import org.thingsboard.server.common.transport.SessionMsgListener; |
... | ... | @@ -60,7 +61,7 @@ import java.util.concurrent.Executors; |
60 | 61 | /** |
61 | 62 | * Created by ashvayka on 05.10.18. |
62 | 63 | */ |
63 | -@ConditionalOnProperty(prefix = "transport", value = "type", havingValue = "remote", matchIfMissing = true) | |
64 | +@ConditionalOnExpression("'${transport.type:null}'=='null'") | |
64 | 65 | @Service |
65 | 66 | @Slf4j |
66 | 67 | public class RemoteTransportService extends AbstractTransportService { | ... | ... |
transport/http/build.gradle
0 → 100644
1 | +/** | |
2 | + * Copyright © 2016-2018 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 | +} | ... | ... |
transport/http/pom.xml
0 → 100644
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 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
20 | + <modelVersion>4.0.0</modelVersion> | |
21 | + <parent> | |
22 | + <groupId>org.thingsboard</groupId> | |
23 | + <version>2.2.0-SNAPSHOT</version> | |
24 | + <artifactId>transport</artifactId> | |
25 | + </parent> | |
26 | + <groupId>org.thingsboard.transport</groupId> | |
27 | + <artifactId>http</artifactId> | |
28 | + <packaging>jar</packaging> | |
29 | + | |
30 | + <name>Thingsboard HTTP Transport Service</name> | |
31 | + <url>https://thingsboard.io</url> | |
32 | + | |
33 | + <properties> | |
34 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
35 | + <main.dir>${basedir}/../..</main.dir> | |
36 | + <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> | |
39 | + <pkg.win.dist>${project.build.directory}/windows</pkg.win.dist> | |
40 | + </properties> | |
41 | + | |
42 | + <dependencies> | |
43 | + <dependency> | |
44 | + <groupId>org.thingsboard.common.transport</groupId> | |
45 | + <artifactId>http</artifactId> | |
46 | + </dependency> | |
47 | + <dependency> | |
48 | + <groupId>org.thingsboard.common</groupId> | |
49 | + <artifactId>queue</artifactId> | |
50 | + </dependency> | |
51 | + <dependency> | |
52 | + <groupId>com.sun.winsw</groupId> | |
53 | + <artifactId>winsw</artifactId> | |
54 | + <classifier>bin</classifier> | |
55 | + <type>exe</type> | |
56 | + <scope>provided</scope> | |
57 | + </dependency> | |
58 | + <dependency> | |
59 | + <groupId>org.springframework.boot</groupId> | |
60 | + <artifactId>spring-boot-starter-web</artifactId> | |
61 | + </dependency> | |
62 | + <dependency> | |
63 | + <groupId>org.springframework.boot</groupId> | |
64 | + <artifactId>spring-boot-starter-test</artifactId> | |
65 | + <scope>test</scope> | |
66 | + </dependency> | |
67 | + <dependency> | |
68 | + <groupId>junit</groupId> | |
69 | + <artifactId>junit</artifactId> | |
70 | + <scope>test</scope> | |
71 | + </dependency> | |
72 | + <dependency> | |
73 | + <groupId>org.mockito</groupId> | |
74 | + <artifactId>mockito-all</artifactId> | |
75 | + <scope>test</scope> | |
76 | + </dependency> | |
77 | + </dependencies> | |
78 | + | |
79 | + <build> | |
80 | + <finalName>${pkg.name}-${project.version}</finalName> | |
81 | + <resources> | |
82 | + <resource> | |
83 | + <directory>${project.basedir}/src/main/resources</directory> | |
84 | + </resource> | |
85 | + </resources> | |
86 | + <plugins> | |
87 | + <plugin> | |
88 | + <groupId>org.apache.maven.plugins</groupId> | |
89 | + <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> | |
198 | + <plugin> | |
199 | + <groupId>org.apache.maven.plugins</groupId> | |
200 | + <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> | |
223 | + <plugin> | |
224 | + <groupId>org.apache.maven.plugins</groupId> | |
225 | + <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> | |
238 | + <plugin> | |
239 | + <groupId>org.springframework.boot</groupId> | |
240 | + <artifactId>spring-boot-maven-plugin</artifactId> | |
241 | + <configuration> | |
242 | + <mainClass>org.thingsboard.server.mqtt.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> | |
262 | + <plugin> | |
263 | + <groupId>org.fortasoft</groupId> | |
264 | + <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> | |
289 | + <plugin> | |
290 | + <groupId>org.apache.maven.plugins</groupId> | |
291 | + <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> | |
308 | + <plugin> | |
309 | + <groupId>org.apache.maven.plugins</groupId> | |
310 | + <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> | |
329 | + </plugins> | |
330 | + </build> | |
331 | + <repositories> | |
332 | + <repository> | |
333 | + <id>jenkins</id> | |
334 | + <name>Jenkins Repository</name> | |
335 | + <url>http://repo.jenkins-ci.org/releases</url> | |
336 | + <snapshots> | |
337 | + <enabled>false</enabled> | |
338 | + </snapshots> | |
339 | + </repository> | |
340 | + </repositories> | |
341 | +</project> | ... | ... |
transport/http/src/main/assembly/windows.xml
0 → 100644
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 | +<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> | ... | ... |
transport/http/src/main/conf/logback.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<!-- | |
3 | + | |
4 | + Copyright © 2016-2018 The Thingsboard Authors | |
5 | + | |
6 | + Licensed under the Apache License, Version 2.0 (the "License"); | |
7 | + you may not use this file except in compliance with the License. | |
8 | + You may obtain a copy of the License at | |
9 | + | |
10 | + http://www.apache.org/licenses/LICENSE-2.0 | |
11 | + | |
12 | + Unless required by applicable law or agreed to in writing, software | |
13 | + distributed under the License is distributed on an "AS IS" BASIS, | |
14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | + See the License for the specific language governing permissions and | |
16 | + limitations under the License. | |
17 | + | |
18 | +--> | |
19 | +<!DOCTYPE configuration> | |
20 | +<configuration> | |
21 | + | |
22 | + <appender name="fileLogAppender" | |
23 | + class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
24 | + <file>${pkg.logFolder}/${pkg.name}.log</file> | |
25 | + <rollingPolicy | |
26 | + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | |
27 | + <fileNamePattern>${pkg.logFolder}/${pkg.name}.%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |
28 | + <maxFileSize>100MB</maxFileSize> | |
29 | + <maxHistory>30</maxHistory> | |
30 | + <totalSizeCap>3GB</totalSizeCap> | |
31 | + </rollingPolicy> | |
32 | + <encoder> | |
33 | + <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern> | |
34 | + </encoder> | |
35 | + </appender> | |
36 | + | |
37 | + <logger name="org.thingsboard.server" level="INFO" /> | |
38 | + | |
39 | + <root level="INFO"> | |
40 | + <appender-ref ref="fileLogAppender"/> | |
41 | + </root> | |
42 | + | |
43 | +</configuration> | ... | ... |
1 | +# | |
2 | +# Copyright © 2016-2018 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 | + | |
17 | +export JAVA_OPTS="$JAVA_OPTS -Xloggc:@pkg.logFolder@/gc.log -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDetails -XX:+PrintGCDateStamps" | |
18 | +export JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10" | |
19 | +export JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=10M -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark" | |
20 | +export JAVA_OPTS="$JAVA_OPTS -XX:CMSWaitDuration=10000 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSParallelInitialMarkEnabled" | |
21 | +export JAVA_OPTS="$JAVA_OPTS -XX:+CMSEdenChunksRecordAlways -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly" | |
22 | +export LOG_FILENAME=${pkg.name}.out | |
23 | +export LOADER_PATH=${pkg.installFolder}/conf | ... | ... |
1 | +pkg.logFolder=${pkg.unixLogFolder} | |
\ No newline at end of file | ... | ... |
transport/http/src/main/java/org/thingsboard/server/mqtt/ThingsboardHttpTransportApplication.java
0 → 100644
1 | +package org.thingsboard.server.mqtt; /** | |
2 | + * Copyright © 2016-2018 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 | + | |
17 | +import org.springframework.boot.SpringApplication; | |
18 | +import org.springframework.boot.SpringBootConfiguration; | |
19 | +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | |
20 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | |
21 | +import org.springframework.context.annotation.ComponentScan; | |
22 | +import org.springframework.scheduling.annotation.EnableAsync; | |
23 | +import org.springframework.scheduling.annotation.EnableScheduling; | |
24 | + | |
25 | +import java.util.Arrays; | |
26 | + | |
27 | +@SpringBootApplication | |
28 | +@EnableAsync | |
29 | +@ComponentScan({"org.thingsboard.server.http", "org.thingsboard.server.common", "org.thingsboard.server.transport.http", "org.thingsboard.server.kafka"}) | |
30 | +public class ThingsboardHttpTransportApplication { | |
31 | + | |
32 | + private static final String SPRING_CONFIG_NAME_KEY = "--spring.config.name"; | |
33 | + private static final String DEFAULT_SPRING_CONFIG_PARAM = SPRING_CONFIG_NAME_KEY + "=" + "tb-http-transport"; | |
34 | + | |
35 | + public static void main(String[] args) { | |
36 | + SpringApplication.run(ThingsboardHttpTransportApplication.class, updateArguments(args)); | |
37 | + } | |
38 | + | |
39 | + private static String[] updateArguments(String[] args) { | |
40 | + if (Arrays.stream(args).noneMatch(arg -> arg.startsWith(SPRING_CONFIG_NAME_KEY))) { | |
41 | + String[] modifiedArgs = new String[args.length + 1]; | |
42 | + System.arraycopy(args, 0, modifiedArgs, 0, args.length); | |
43 | + modifiedArgs[args.length] = DEFAULT_SPRING_CONFIG_PARAM; | |
44 | + return modifiedArgs; | |
45 | + } | |
46 | + return args; | |
47 | + } | |
48 | +} | ... | ... |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
2 | +<!-- | |
3 | + | |
4 | + Copyright © 2016-2018 The Thingsboard Authors | |
5 | + | |
6 | + Licensed under the Apache License, Version 2.0 (the "License"); | |
7 | + you may not use this file except in compliance with the License. | |
8 | + You may obtain a copy of the License at | |
9 | + | |
10 | + http://www.apache.org/licenses/LICENSE-2.0 | |
11 | + | |
12 | + Unless required by applicable law or agreed to in writing, software | |
13 | + distributed under the License is distributed on an "AS IS" BASIS, | |
14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | + See the License for the specific language governing permissions and | |
16 | + limitations under the License. | |
17 | + | |
18 | +--> | |
19 | +<!DOCTYPE configuration> | |
20 | +<configuration scan="true" scanPeriod="10 seconds"> | |
21 | + | |
22 | + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | |
23 | + <encoder> | |
24 | + <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern> | |
25 | + </encoder> | |
26 | + </appender> | |
27 | + | |
28 | + <logger name="org.thingsboard.server" level="TRACE" /> | |
29 | + | |
30 | + <root level="INFO"> | |
31 | + <appender-ref ref="STDOUT"/> | |
32 | + </root> | |
33 | + | |
34 | +</configuration> | |
\ No newline at end of file | ... | ... |
1 | +# | |
2 | +# Copyright © 2016-2018 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 | + | |
17 | +server: | |
18 | + # Server bind address | |
19 | + address: "${HTTP_BIND_ADDRESS:0.0.0.0}" | |
20 | + # Server bind port | |
21 | + port: "${HTTP_BIND_PORT:8081}" | |
22 | + | |
23 | +# HTTP server parameters | |
24 | +transport: | |
25 | + http: | |
26 | + request_timeout: "${HTTP_REQUEST_TIMEOUT:60000}" | |
27 | + | |
28 | +#Quota parameters | |
29 | +quota: | |
30 | + host: | |
31 | + # Max allowed number of API requests in interval for single host | |
32 | + limit: "${QUOTA_HOST_LIMIT:10000}" | |
33 | + # Interval duration | |
34 | + intervalMs: "${QUOTA_HOST_INTERVAL_MS:60000}" | |
35 | + # Maximum silence duration for host after which Host removed from QuotaService. Must be bigger than intervalMs | |
36 | + ttlMs: "${QUOTA_HOST_TTL_MS:60000}" | |
37 | + # Interval for scheduled task that cleans expired records. TTL is used for expiring | |
38 | + cleanPeriodMs: "${QUOTA_HOST_CLEAN_PERIOD_MS:300000}" | |
39 | + # Enable Host API Limits | |
40 | + enabled: "${QUOTA_HOST_ENABLED:true}" | |
41 | + # Array of whitelist hosts | |
42 | + whitelist: "${QUOTA_HOST_WHITELIST:localhost,127.0.0.1}" | |
43 | + # Array of blacklist hosts | |
44 | + blacklist: "${QUOTA_HOST_BLACKLIST:}" | |
45 | + log: | |
46 | + topSize: 10 | |
47 | + intervalMin: 2 | |
48 | + | |
49 | +kafka: | |
50 | + enabled: true | |
51 | + bootstrap.servers: "${TB_KAFKA_SERVERS:localhost:9092}" | |
52 | + acks: "${TB_KAFKA_ACKS:all}" | |
53 | + retries: "${TB_KAFKA_RETRIES:1}" | |
54 | + batch.size: "${TB_KAFKA_BATCH_SIZE:16384}" | |
55 | + linger.ms: "${TB_KAFKA_LINGER_MS:1}" | |
56 | + buffer.memory: "${TB_BUFFER_MEMORY:33554432}" | |
57 | + transport_api: | |
58 | + requests_topic: "${TB_TRANSPORT_API_REQUEST_TOPIC:tb.transport.api.requests}" | |
59 | + responses_topic: "${TB_TRANSPORT_API_RESPONSE_TOPIC:tb.transport.api.responses}" | |
60 | + max_pending_requests: "${TB_TRANSPORT_MAX_PENDING_REQUESTS:10000}" | |
61 | + max_requests_timeout: "${TB_TRANSPORT_MAX_REQUEST_TIMEOUT:10000}" | |
62 | + response_poll_interval: "${TB_TRANSPORT_RESPONSE_POLL_INTERVAL_MS:25}" | |
63 | + response_auto_commit_interval: "${TB_TRANSPORT_RESPONSE_AUTO_COMMIT_INTERVAL_MS:100}" | |
64 | + rule_engine: | |
65 | + topic: "${TB_RULE_ENGINE_TOPIC:tb.rule-engine}" | |
66 | + notifications: | |
67 | + topic: "${TB_TRANSPORT_NOTIFICATIONS_TOPIC:tb.transport.notifications}" | |
68 | + poll_interval: "${TB_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS:25}" | |
69 | + auto_commit_interval: "${TB_TRANSPORT_NOTIFICATIONS_AUTO_COMMIT_INTERVAL_MS:100}" | ... | ... |
1 | +#!/bin/sh | |
2 | + | |
3 | +if ! getent group ${pkg.name} >/dev/null; then | |
4 | + addgroup --system ${pkg.name} | |
5 | +fi | |
6 | + | |
7 | +if ! getent passwd ${pkg.name} >/dev/null; then | |
8 | + adduser --quiet \ | |
9 | + --system \ | |
10 | + --ingroup ${pkg.name} \ | |
11 | + --quiet \ | |
12 | + --disabled-login \ | |
13 | + --disabled-password \ | |
14 | + --home ${pkg.installFolder} \ | |
15 | + --no-create-home \ | |
16 | + -gecos "Thingsboard application" \ | |
17 | + ${pkg.name} | |
18 | +fi | ... | ... |
1 | +@ECHO OFF | |
2 | + | |
3 | +setlocal ENABLEEXTENSIONS | |
4 | + | |
5 | +@ECHO Detecting Java version installed. | |
6 | +:CHECK_JAVA_64 | |
7 | +@ECHO Detecting if it is 64 bit machine | |
8 | +set KEY_NAME="HKEY_LOCAL_MACHINE\Software\Wow6432Node\JavaSoft\Java Runtime Environment" | |
9 | +set VALUE_NAME=CurrentVersion | |
10 | + | |
11 | +FOR /F "usebackq skip=2 tokens=1-3" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO ( | |
12 | + set ValueName=%%A | |
13 | + set ValueType=%%B | |
14 | + set ValueValue=%%C | |
15 | +) | |
16 | +@ECHO CurrentVersion %ValueValue% | |
17 | + | |
18 | +SET KEY_NAME="%KEY_NAME:~1,-1%\%ValueValue%" | |
19 | +SET VALUE_NAME=JavaHome | |
20 | + | |
21 | +if defined ValueName ( | |
22 | + FOR /F "usebackq skip=2 tokens=1,2*" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO ( | |
23 | + set ValueName2=%%A | |
24 | + set ValueType2=%%B | |
25 | + set JRE_PATH2=%%C | |
26 | + | |
27 | + if defined ValueName2 ( | |
28 | + set ValueName = %ValueName2% | |
29 | + set ValueType = %ValueType2% | |
30 | + set ValueValue = %JRE_PATH2% | |
31 | + ) | |
32 | + ) | |
33 | +) | |
34 | + | |
35 | +IF NOT "%JRE_PATH2%" == "" GOTO JAVA_INSTALLED | |
36 | + | |
37 | +:CHECK_JAVA_32 | |
38 | +@ECHO Detecting if it is 32 bit machine | |
39 | +set KEY_NAME="HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment" | |
40 | +set VALUE_NAME=CurrentVersion | |
41 | + | |
42 | +FOR /F "usebackq skip=2 tokens=1-3" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO ( | |
43 | + set ValueName=%%A | |
44 | + set ValueType=%%B | |
45 | + set ValueValue=%%C | |
46 | +) | |
47 | +@ECHO CurrentVersion %ValueValue% | |
48 | + | |
49 | +SET KEY_NAME="%KEY_NAME:~1,-1%\%ValueValue%" | |
50 | +SET VALUE_NAME=JavaHome | |
51 | + | |
52 | +if defined ValueName ( | |
53 | + FOR /F "usebackq skip=2 tokens=1,2*" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO ( | |
54 | + set ValueName2=%%A | |
55 | + set ValueType2=%%B | |
56 | + set JRE_PATH2=%%C | |
57 | + | |
58 | + if defined ValueName2 ( | |
59 | + set ValueName = %ValueName2% | |
60 | + set ValueType = %ValueType2% | |
61 | + set ValueValue = %JRE_PATH2% | |
62 | + ) | |
63 | + ) | |
64 | +) | |
65 | + | |
66 | +IF "%JRE_PATH2%" == "" GOTO JAVA_NOT_INSTALLED | |
67 | + | |
68 | +:JAVA_INSTALLED | |
69 | + | |
70 | +@ECHO Java 1.8 found! | |
71 | +@ECHO Installing ${pkg.name} ... | |
72 | + | |
73 | +%BASE%${pkg.name}.exe install | |
74 | + | |
75 | +@ECHO ${pkg.name} installed successfully! | |
76 | + | |
77 | +GOTO END | |
78 | + | |
79 | +:JAVA_NOT_INSTALLED | |
80 | +@ECHO Java 1.8 or above is not installed | |
81 | +@ECHO Please go to https://java.com/ and install Java. Then retry installation. | |
82 | +PAUSE | |
83 | +GOTO END | |
84 | + | |
85 | +:END | |
86 | + | |
87 | + | ... | ... |
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> | ... | ... |
... | ... | @@ -34,23 +34,8 @@ |
34 | 34 | </properties> |
35 | 35 | |
36 | 36 | <modules> |
37 | - <!--<module>coap</module>--> | |
37 | + <module>http</module> | |
38 | 38 | <module>mqtt</module> |
39 | 39 | </modules> |
40 | 40 | |
41 | - <dependencies> | |
42 | - <dependency> | |
43 | - <groupId>org.thingsboard</groupId> | |
44 | - <artifactId>dao</artifactId> | |
45 | - </dependency> | |
46 | - <dependency> | |
47 | - <groupId>org.springframework.boot</groupId> | |
48 | - <artifactId>spring-boot-autoconfigure</artifactId> | |
49 | - </dependency> | |
50 | - <dependency> | |
51 | - <groupId>org.bouncycastle</groupId> | |
52 | - <artifactId>bcprov-jdk15on</artifactId> | |
53 | - </dependency> | |
54 | - </dependencies> | |
55 | - | |
56 | 41 | </project> | ... | ... |