diff --git a/common/version-control/pom.xml b/common/version-control/pom.xml
index f29b7db81a..164640fe73 100644
--- a/common/version-control/pom.xml
+++ b/common/version-control/pom.xml
@@ -86,6 +86,21 @@
org.eclipse.jgit
org.eclipse.jgit
+
+ io.grpc
+ grpc-netty-shaded
+ provided
+
+
+ io.grpc
+ grpc-protobuf
+ provided
+
+
+ io.grpc
+ grpc-stub
+ provided
+
org.springframework.boot
spring-boot-starter-test
@@ -109,7 +124,19 @@
+
+ org.xolstice.maven.plugins
+ protobuf-maven-plugin
+
+
+
+ thingsboard-repo-deploy
+ ThingsBoard Repo Deployment
+ https://repo.thingsboard.io/artifactory/libs-release-public
+
+
+
diff --git a/common/version-control/src/main/java/org/thingsboard/server/service/sync/vc/DefaultGitRepositoryService.java b/common/version-control/src/main/java/org/thingsboard/server/service/sync/vc/DefaultGitRepositoryService.java
index d22fcf5d94..c93b4ae76d 100644
--- a/common/version-control/src/main/java/org/thingsboard/server/service/sync/vc/DefaultGitRepositoryService.java
+++ b/common/version-control/src/main/java/org/thingsboard/server/service/sync/vc/DefaultGitRepositoryService.java
@@ -226,7 +226,6 @@ public class DefaultGitRepositoryService implements GitRepositoryService {
}
}
-
private EntityVersion toVersion(GitRepository.Commit commit) {
return new EntityVersion(commit.getId(), commit.getMessage());
}
diff --git a/common/version-control/src/main/proto/vc.proto b/common/version-control/src/main/proto/vc.proto
new file mode 100644
index 0000000000..e8c7e09384
--- /dev/null
+++ b/common/version-control/src/main/proto/vc.proto
@@ -0,0 +1,71 @@
+/**
+ * Copyright © 2016-2022 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.
+ */
+syntax = "proto3";
+
+option java_package = "org.thingsboard.server.gen.vc.v1";
+option java_multiple_files = true;
+option java_outer_classname = "EdgeProtos";
+
+package vc;
+
+// Interface exported by the ThingsBoard Core.
+service TbGitRpcService {
+
+ rpc commit(stream CommitRequestMsg) returns (CommitResponseMsg) {}
+
+}
+
+
+/**
+ * Data Structures;
+ */
+message CommitRequestMsg {
+ string txId = 1;
+ PrepareMsg prepareMsg = 2;
+ AddMsg addMsg = 3;
+ DeleteMsg deleteMsg = 4;
+ PushMsg pushMsg = 5;
+ AbortMsg abortMsg = 6;
+}
+
+message CommitResponseMsg {
+ string id = 1;
+ string name = 2;
+ int32 added = 3;
+ int32 modified = 4;
+ int32 removed = 5;
+}
+
+message PrepareMsg {
+ string tenantId = 1;
+ string commitMsg = 2;
+ string branchName = 3;
+}
+
+message AddMsg {
+ string relativePath = 1;
+ string entityDataJson = 2;
+}
+
+message DeleteMsg {
+ string relativePath = 1;
+}
+
+message PushMsg {
+}
+
+message AbortMsg {
+}
\ No newline at end of file
diff --git a/msa/pom.xml b/msa/pom.xml
index 106f2be2a3..888291502b 100644
--- a/msa/pom.xml
+++ b/msa/pom.xml
@@ -40,6 +40,7 @@
tb
+ vc-executor
js-executor
web-ui
tb-node
diff --git a/msa/vc-executor/pom.xml b/msa/vc-executor/pom.xml
new file mode 100644
index 0000000000..7e4df36117
--- /dev/null
+++ b/msa/vc-executor/pom.xml
@@ -0,0 +1,136 @@
+
+
+ 4.0.0
+
+
+ org.thingsboard
+ 3.4.0-SNAPSHOT
+ msa
+
+ org.thingsboard.msa
+ vc-executor
+
+ ThingsBoard Version Control Executor
+ https://thingsboard.io
+ Project for ThingsBoard version control microservice
+
+
+ UTF-8
+ ${basedir}/../..
+ java
+ false
+ process-resources
+ package
+ tb-mqtt-transport
+ false
+ ${project.build.directory}/windows
+ ThingsBoard Version Control Executor Service
+ org.thingsboard.server.vc.ThingsboardVersionControlExecutorApplication
+
+
+
+
+ org.thingsboard.common
+ version-control
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ io.grpc
+ grpc-netty-shaded
+
+
+ io.grpc
+ grpc-protobuf
+
+
+ io.grpc
+ grpc-stub
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.junit.vintage
+ junit-vintage-engine
+ test
+
+
+ org.awaitility
+ awaitility
+ test
+
+
+
+
+ ${pkg.name}-${project.version}
+
+
+ ${project.basedir}/src/main/resources
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ org.thingsboard
+ gradle-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ org.apache.maven.plugins
+ maven-install-plugin
+
+
+
+
+
+ jenkins
+ Jenkins Repository
+ https://repo.jenkins-ci.org/releases
+
+ false
+
+
+
+
+
+
diff --git a/msa/vc-executor/src/main/conf/logback.xml b/msa/vc-executor/src/main/conf/logback.xml
new file mode 100644
index 0000000000..d62cf2b3f5
--- /dev/null
+++ b/msa/vc-executor/src/main/conf/logback.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+ ${pkg.logFolder}/${pkg.name}.log
+
+ ${pkg.logFolder}/${pkg.name}.%d{yyyy-MM-dd}.%i.log
+ 100MB
+ 30
+ 3GB
+
+
+ %d{ISO8601} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
+
+
diff --git a/msa/vc-executor/src/main/conf/tb-vc-executor.conf b/msa/vc-executor/src/main/conf/tb-vc-executor.conf
new file mode 100644
index 0000000000..83287286bb
--- /dev/null
+++ b/msa/vc-executor/src/main/conf/tb-vc-executor.conf
@@ -0,0 +1,22 @@
+#
+# Copyright © 2016-2022 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
diff --git a/msa/vc-executor/src/main/java/org/thingsboard/server/vc/ThingsboardVersionControlExecutorApplication.java b/msa/vc-executor/src/main/java/org/thingsboard/server/vc/ThingsboardVersionControlExecutorApplication.java
new file mode 100644
index 0000000000..2724a566ee
--- /dev/null
+++ b/msa/vc-executor/src/main/java/org/thingsboard/server/vc/ThingsboardVersionControlExecutorApplication.java
@@ -0,0 +1,47 @@
+package org.thingsboard.server.vc; /**
+ * Copyright © 2016-2022 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.
+ */
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.SpringBootConfiguration;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+import java.util.Arrays;
+
+@SpringBootConfiguration
+@EnableAsync
+@EnableScheduling
+@ComponentScan({"org.thingsboard.server.vc", "org.thingsboard.server.common", "org.thingsboard.server.sync.vc"})
+public class ThingsboardVersionControlExecutorApplication {
+
+ private static final String SPRING_CONFIG_NAME_KEY = "--spring.config.name";
+ private static final String DEFAULT_SPRING_CONFIG_PARAM = SPRING_CONFIG_NAME_KEY + "=" + "tb-vc-executor";
+
+ public static void main(String[] args) {
+ SpringApplication.run(ThingsboardVersionControlExecutorApplication.class, updateArguments(args));
+ }
+
+ private static String[] updateArguments(String[] args) {
+ if (Arrays.stream(args).noneMatch(arg -> arg.startsWith(SPRING_CONFIG_NAME_KEY))) {
+ String[] modifiedArgs = new String[args.length + 1];
+ System.arraycopy(args, 0, modifiedArgs, 0, args.length);
+ modifiedArgs[args.length] = DEFAULT_SPRING_CONFIG_PARAM;
+ return modifiedArgs;
+ }
+ return args;
+ }
+}
diff --git a/msa/vc-executor/src/main/resources/logback.xml b/msa/vc-executor/src/main/resources/logback.xml
new file mode 100644
index 0000000000..2834934ee0
--- /dev/null
+++ b/msa/vc-executor/src/main/resources/logback.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+ %d{ISO8601} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/msa/vc-executor/src/main/resources/tb-vc-executor.yml b/msa/vc-executor/src/main/resources/tb-vc-executor.yml
new file mode 100644
index 0000000000..1de47e2750
--- /dev/null
+++ b/msa/vc-executor/src/main/resources/tb-vc-executor.yml
@@ -0,0 +1,27 @@
+#
+# Copyright © 2016-2022 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.
+#
+
+# If you enabled process metrics you should also enable 'web-environment'.
+spring.main.web-environment: "${WEB_APPLICATION_ENABLE:false}"
+# If you enabled process metrics you should set 'web-application-type' to 'servlet' value.
+spring.main.web-application-type: "${WEB_APPLICATION_TYPE:none}"
+
+server:
+ # Server bind address (has no effect if web-environment is disabled).
+ address: "${HTTP_BIND_ADDRESS:0.0.0.0}"
+ # Server bind port (has no effect if web-environment is disabled).
+ port: "${HTTP_BIND_PORT:8080}"
+