6 changed files with 324 additions and 0 deletions
@ -0,0 +1,22 @@ |
|||
# |
|||
# Copyright © 2016-2024 The Thingsboard Authors |
|||
# |
|||
# Licensed under the Apache License, Version 2.0 (the "License"); |
|||
# you may not use this file except in compliance with the License. |
|||
# You may obtain a copy of the License at |
|||
# |
|||
# http://www.apache.org/licenses/LICENSE-2.0 |
|||
# |
|||
# Unless required by applicable law or agreed to in writing, software |
|||
# distributed under the License is distributed on an "AS IS" BASIS, |
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
# See the License for the specific language governing permissions and |
|||
# limitations under the License. |
|||
# |
|||
|
|||
export JAVA_OPTS="$JAVA_OPTS -Xlog:gc*,heap*,age*,safepoint=debug:file=@pkg.logFolder@/gc.log:time,uptime,level,tags:filecount=10,filesize=10M" |
|||
export JAVA_OPTS="$JAVA_OPTS -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError" |
|||
export JAVA_OPTS="$JAVA_OPTS -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark" |
|||
export JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC -XX:MaxGCPauseMillis=500 -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled -XX:MaxTenuringThreshold=10" |
|||
export LOG_FILENAME=${pkg.name}.out |
|||
export LOADER_PATH=${pkg.installFolder}/conf |
|||
@ -0,0 +1,49 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!-- |
|||
|
|||
Copyright © 2016-2024 The Thingsboard Authors |
|||
|
|||
Licensed under the Apache License, Version 2.0 (the "License"); |
|||
you may not use this file except in compliance with the License. |
|||
You may obtain a copy of the License at |
|||
|
|||
http://www.apache.org/licenses/LICENSE-2.0 |
|||
|
|||
Unless required by applicable law or agreed to in writing, software |
|||
distributed under the License is distributed on an "AS IS" BASIS, |
|||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
See the License for the specific language governing permissions and |
|||
limitations under the License. |
|||
|
|||
--> |
|||
<!DOCTYPE configuration> |
|||
<configuration> |
|||
|
|||
<appender name="fileLogAppender" |
|||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<file>${pkg.logFolder}/${pkg.name}.log</file> |
|||
<rollingPolicy |
|||
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
|||
<fileNamePattern>${pkg.logFolder}/${pkg.name}.%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
|||
<maxFileSize>100MB</maxFileSize> |
|||
<maxHistory>30</maxHistory> |
|||
<totalSizeCap>3GB</totalSizeCap> |
|||
</rollingPolicy> |
|||
<encoder> |
|||
<pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern> |
|||
</encoder> |
|||
</appender> |
|||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
|||
<encoder> |
|||
<pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern> |
|||
</encoder> |
|||
</appender> |
|||
|
|||
<logger name="org.thingsboard.server" level="INFO" /> |
|||
|
|||
<root level="INFO"> |
|||
<appender-ref ref="fileLogAppender"/> |
|||
<appender-ref ref="STDOUT"/> |
|||
</root> |
|||
|
|||
</configuration> |
|||
@ -0,0 +1,31 @@ |
|||
# |
|||
# Copyright © 2016-2024 The Thingsboard Authors |
|||
# |
|||
# Licensed under the Apache License, Version 2.0 (the "License"); |
|||
# you may not use this file except in compliance with the License. |
|||
# You may obtain a copy of the License at |
|||
# |
|||
# http://www.apache.org/licenses/LICENSE-2.0 |
|||
# |
|||
# Unless required by applicable law or agreed to in writing, software |
|||
# distributed under the License is distributed on an "AS IS" BASIS, |
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
# See the License for the specific language governing permissions and |
|||
# limitations under the License. |
|||
# |
|||
|
|||
FROM thingsboard/openjdk17:bookworm-slim |
|||
|
|||
COPY start-tb-edqs.sh ${pkg.name}.deb /tmp/ |
|||
|
|||
RUN chmod a+x /tmp/*.sh \ |
|||
&& mv /tmp/start-tb-edqs.sh /usr/bin && \ |
|||
(yes | dpkg -i /tmp/${pkg.name}.deb) && \ |
|||
rm /tmp/${pkg.name}.deb && \ |
|||
(systemctl --no-reload disable --now ${pkg.name}.service > /dev/null 2>&1 || :) && \ |
|||
chown -R ${pkg.user}:${pkg.user} /tmp && \ |
|||
chmod 555 ${pkg.installFolder}/bin/${pkg.name}.jar |
|||
|
|||
USER ${pkg.user} |
|||
|
|||
CMD ["start-tb-edqs.sh"] |
|||
@ -0,0 +1,31 @@ |
|||
#!/bin/bash |
|||
# |
|||
# Copyright © 2016-2024 The Thingsboard Authors |
|||
# |
|||
# Licensed under the Apache License, Version 2.0 (the "License"); |
|||
# you may not use this file except in compliance with the License. |
|||
# You may obtain a copy of the License at |
|||
# |
|||
# http://www.apache.org/licenses/LICENSE-2.0 |
|||
# |
|||
# Unless required by applicable law or agreed to in writing, software |
|||
# distributed under the License is distributed on an "AS IS" BASIS, |
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
# See the License for the specific language governing permissions and |
|||
# limitations under the License. |
|||
# |
|||
|
|||
CONF_FOLDER=${pkg.installFolder}/conf |
|||
jarfile=${pkg.installFolder}/bin/${pkg.name}.jar |
|||
configfile=${pkg.name}.conf |
|||
|
|||
source "${CONF_FOLDER}/${configfile}" |
|||
|
|||
echo "Starting '${project.name}' ..." |
|||
|
|||
cd ${pkg.installFolder}/bin |
|||
|
|||
exec java -cp ${jarfile} $JAVA_OPTS -Dloader.main=org.thingsboard.server.edqs.ThingsboardEdqsApplication \ |
|||
-Dspring.jpa.hibernate.ddl-auto=none \ |
|||
-Dlogging.config=$CONF_FOLDER/logback.xml \ |
|||
org.springframework.boot.loader.launch.PropertiesLauncher |
|||
@ -0,0 +1,190 @@ |
|||
<!-- |
|||
|
|||
Copyright © 2016-2024 The Thingsboard Authors |
|||
|
|||
Licensed under the Apache License, Version 2.0 (the "License"); |
|||
you may not use this file except in compliance with the License. |
|||
You may obtain a copy of the License at |
|||
|
|||
http://www.apache.org/licenses/LICENSE-2.0 |
|||
|
|||
Unless required by applicable law or agreed to in writing, software |
|||
distributed under the License is distributed on an "AS IS" BASIS, |
|||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
See the License for the specific language governing permissions and |
|||
limitations under the License. |
|||
|
|||
--> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<parent> |
|||
<groupId>org.thingsboard</groupId> |
|||
<version>4.0.0-SNAPSHOT</version> |
|||
<artifactId>msa</artifactId> |
|||
</parent> |
|||
<groupId>org.thingsboard.msa</groupId> |
|||
<artifactId>edqs</artifactId> |
|||
<packaging>pom</packaging> |
|||
|
|||
<name>ThingsBoard Entity Data Query Microservice</name> |
|||
<url>https://thingsboard.io</url> |
|||
<description>ThingsBoard Entity Data Query Microservice</description> |
|||
|
|||
<properties> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
<main.dir>${basedir}/../..</main.dir> |
|||
<pkg.name>edqs</pkg.name> |
|||
<docker.name>edqs</docker.name> |
|||
<pkg.logFolder>/var/log/${pkg.name}</pkg.logFolder> |
|||
<pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder> |
|||
<docker.push-arm-amd-image.phase>pre-integration-test</docker.push-arm-amd-image.phase> |
|||
</properties> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>org.thingsboard</groupId> |
|||
<artifactId>edqs</artifactId> |
|||
<version>${project.version}</version> |
|||
<classifier>deb</classifier> |
|||
<type>deb</type> |
|||
<scope>provided</scope> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
<build> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-dependency-plugin</artifactId> |
|||
<executions> |
|||
<execution> |
|||
<id>copy-edqs</id> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<goal>copy</goal> |
|||
</goals> |
|||
<configuration> |
|||
<artifactItems> |
|||
<artifactItem> |
|||
<groupId>org.thingsboard</groupId> |
|||
<artifactId>edqs</artifactId> |
|||
<classifier>deb</classifier> |
|||
<type>deb</type> |
|||
<destFileName>${pkg.name}.deb</destFileName> |
|||
<outputDirectory>${project.build.directory}</outputDirectory> |
|||
</artifactItem> |
|||
</artifactItems> |
|||
</configuration> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-resources-plugin</artifactId> |
|||
<executions> |
|||
<execution> |
|||
<id>copy-docker-config</id> |
|||
<phase>process-resources</phase> |
|||
<goals> |
|||
<goal>copy-resources</goal> |
|||
</goals> |
|||
<configuration> |
|||
<outputDirectory>${project.build.directory}</outputDirectory> |
|||
<resources> |
|||
<resource> |
|||
<directory>docker</directory> |
|||
<filtering>true</filtering> |
|||
</resource> |
|||
</resources> |
|||
</configuration> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
<plugin> |
|||
<groupId>com.spotify</groupId> |
|||
<artifactId>dockerfile-maven-plugin</artifactId> |
|||
<executions> |
|||
<execution> |
|||
<id>build-docker-image</id> |
|||
<phase>pre-integration-test</phase> |
|||
<goals> |
|||
<goal>build</goal> |
|||
</goals> |
|||
<configuration> |
|||
<skip>${dockerfile.skip}</skip> |
|||
<repository>${docker.repo}/${docker.name}</repository> |
|||
<verbose>true</verbose> |
|||
<googleContainerRegistryEnabled>false</googleContainerRegistryEnabled> |
|||
<contextDirectory>${project.build.directory}</contextDirectory> |
|||
</configuration> |
|||
</execution> |
|||
<execution> |
|||
<id>tag-docker-image</id> |
|||
<phase>pre-integration-test</phase> |
|||
<goals> |
|||
<goal>tag</goal> |
|||
</goals> |
|||
<configuration> |
|||
<skip>${dockerfile.skip}</skip> |
|||
<repository>${docker.repo}/${docker.name}</repository> |
|||
<tag>${project.version}</tag> |
|||
</configuration> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
<profiles> |
|||
<profile> |
|||
<id>push-docker-image</id> |
|||
<activation> |
|||
<property> |
|||
<name>push-docker-image</name> |
|||
</property> |
|||
</activation> |
|||
<build> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>com.spotify</groupId> |
|||
<artifactId>dockerfile-maven-plugin</artifactId> |
|||
<executions> |
|||
<execution> |
|||
<id>push-latest-docker-image</id> |
|||
<phase>pre-integration-test</phase> |
|||
<goals> |
|||
<goal>push</goal> |
|||
</goals> |
|||
<configuration> |
|||
<tag>latest</tag> |
|||
<repository>${docker.repo}/${docker.name}</repository> |
|||
</configuration> |
|||
</execution> |
|||
<execution> |
|||
<id>push-version-docker-image</id> |
|||
<phase>pre-integration-test</phase> |
|||
<goals> |
|||
<goal>push</goal> |
|||
</goals> |
|||
<configuration> |
|||
<tag>${project.version}</tag> |
|||
<repository>${docker.repo}/${docker.name}</repository> |
|||
</configuration> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
</profile> |
|||
</profiles> |
|||
<repositories> |
|||
<repository> |
|||
<id>jenkins</id> |
|||
<name>Jenkins Repository</name> |
|||
<url>https://repo.jenkins-ci.org/releases</url> |
|||
<snapshots> |
|||
<enabled>false</enabled> |
|||
</snapshots> |
|||
</repository> |
|||
</repositories> |
|||
</project> |
|||
Loading…
Reference in new issue