diff --git a/msa/js-executor/docker/Dockerfile b/msa/js-executor/docker/Dockerfile
index 92b2229e79..3a808944b6 100644
--- a/msa/js-executor/docker/Dockerfile
+++ b/msa/js-executor/docker/Dockerfile
@@ -14,26 +14,29 @@
# limitations under the License.
#
-FROM thingsboard/base
+FROM node:16.13.1-buster-slim
-ARG TARGETPLATFORM
-
-COPY start-js-executor.sh ${pkg.name}.deb ${pkg.name}-arm64.deb /tmp/
+COPY start-js-executor.sh /tmp/
RUN chmod a+x /tmp/*.sh \
&& mv /tmp/start-js-executor.sh /usr/bin
-RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; \
- then yes | dpkg -i /tmp/${pkg.name}-arm64.deb; \
- else yes | dpkg -i /tmp/${pkg.name}.deb; \
- fi
-RUN rm /tmp/${pkg.name}.deb
-RUN rm /tmp/${pkg.name}-arm64.deb
+ENV NODE_ENV production
-RUN systemctl --no-reload disable --now ${pkg.name}.service > /dev/null 2>&1 || :
+WORKDIR ${pkg.installFolder}
-RUN chmod 555 ${pkg.installFolder}/bin/${pkg.name}
+COPY ["src/package.json", "src/yarn.lock", "./"]
-USER ${pkg.user}
+COPY package/linux/conf ./conf
+COPY package/linux/conf ./config
+COPY src/api ./api
+COPY src/queue ./queue
+COPY src/server.js ./
+
+RUN chown -R node:node ${pkg.installFolder}
+
+RUN yarn install --production && yarn cache clean --all
+
+USER node
CMD ["start-js-executor.sh"]
diff --git a/msa/js-executor/docker/start-js-executor.sh b/msa/js-executor/docker/start-js-executor.sh
index a57b441db1..ba0c3eaeed 100755
--- a/msa/js-executor/docker/start-js-executor.sh
+++ b/msa/js-executor/docker/start-js-executor.sh
@@ -20,12 +20,10 @@ echo "Starting '${project.name}' ..."
CONF_FOLDER="${pkg.installFolder}/conf"
-mainfile=${pkg.installFolder}/bin/${pkg.name}
configfile=${pkg.name}.conf
-identity=${pkg.name}
source "${CONF_FOLDER}/${configfile}"
-cd ${pkg.installFolder}/bin
+cd ${pkg.installFolder}
-exec /bin/sh -c "$mainfile"
+exec /bin/sh -c "node server.js"
diff --git a/msa/js-executor/install.js b/msa/js-executor/install.js
index 9fe911e7b2..d180a5247a 100644
--- a/msa/js-executor/install.js
+++ b/msa/js-executor/install.js
@@ -21,13 +21,10 @@ let _projectRoot = null;
(async() => {
- await fse.move(path.join(projectRoot(), 'target', 'thingsboard-js-executor-linux-x64'),
+ await fse.move(path.join(projectRoot(), 'target', 'thingsboard-js-executor-linux'),
path.join(targetPackageDir('linux'), 'bin', 'tb-js-executor'),
{overwrite: true});
- await fse.move(path.join(projectRoot(), 'target', 'thingsboard-js-executor-linux-arm64'),
- path.join(targetPackageDir('linux'), 'bin-arm64', 'tb-js-executor'),
- {overwrite: true});
- await fse.move(path.join(projectRoot(), 'target', 'thingsboard-js-executor-win-x64.exe'),
+ await fse.move(path.join(projectRoot(), 'target', 'thingsboard-js-executor-win.exe'),
path.join(targetPackageDir('windows'), 'bin', 'tb-js-executor.exe'),
{overwrite: true});
})();
diff --git a/msa/js-executor/package.json b/msa/js-executor/package.json
index 0e2cee6e54..69fc59eed2 100644
--- a/msa/js-executor/package.json
+++ b/msa/js-executor/package.json
@@ -6,7 +6,7 @@
"main": "server.js",
"bin": "server.js",
"scripts": {
- "install": "pkg -t node12-linux-x64,node12-linux-arm64,node12-win-x64 --out-path ./target . && node install.js",
+ "pkg": "pkg -t node12-linux-x64,node12-win-x64 --out-path ./target . && node install.js",
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon server.js",
"start-prod": "NODE_ENV=production nodemon server.js"
@@ -27,9 +27,6 @@
"winston": "^3.3.3",
"winston-daily-rotate-file": "^4.5.0"
},
- "engines": {
- "node": ">=12.0.0 <14.0.0"
- },
"nyc": {
"exclude": [
"test",
diff --git a/msa/js-executor/pom.xml b/msa/js-executor/pom.xml
index 16f1f0293b..72adb41d76 100644
--- a/msa/js-executor/pom.xml
+++ b/msa/js-executor/pom.xml
@@ -84,6 +84,15 @@
install
+
+ yarn pkg
+
+ yarn
+
+
+ run pkg
+
+
@@ -93,6 +102,61 @@
org.apache.maven.plugins
maven-resources-plugin
+
+
+ copy-src-api
+ process-resources
+
+ copy-resources
+
+
+ ${project.build.directory}/src/api
+
+
+ api
+ false
+
+
+
+
+
+ copy-src-queue
+ process-resources
+
+ copy-resources
+
+
+ ${project.build.directory}/src/queue
+
+
+ queue
+ false
+
+
+
+
+
+ copy-src-root
+ process-resources
+
+ copy-resources
+
+
+ ${project.build.directory}/src
+
+
+ ${basedir}
+
+ server.js
+ package.json
+ yarn.lock
+
+ false
+
+
+
+
+
org.thingsboard
diff --git a/msa/web-ui/docker/Dockerfile b/msa/web-ui/docker/Dockerfile
index 5b4acf9eb3..9532e5093a 100644
--- a/msa/web-ui/docker/Dockerfile
+++ b/msa/web-ui/docker/Dockerfile
@@ -14,26 +14,28 @@
# limitations under the License.
#
-FROM thingsboard/base
+FROM node:16.13.1-buster-slim
-ARG TARGETPLATFORM
-
-COPY start-web-ui.sh ${pkg.name}.deb ${pkg.name}-arm64.deb /tmp/
+COPY start-web-ui.sh /tmp/
RUN chmod a+x /tmp/*.sh \
&& mv /tmp/start-web-ui.sh /usr/bin
-RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; \
- then yes | dpkg -i /tmp/${pkg.name}-arm64.deb; \
- else yes | dpkg -i /tmp/${pkg.name}.deb; \
- fi
-RUN rm /tmp/${pkg.name}.deb
-RUN rm /tmp/${pkg.name}-arm64.deb
+ENV NODE_ENV production
-RUN systemctl --no-reload disable --now ${pkg.name}.service > /dev/null 2>&1 || :
+WORKDIR ${pkg.installFolder}
-RUN chmod 555 ${pkg.installFolder}/bin/${pkg.name}
+COPY ["src/package.json", "src/yarn.lock", "./"]
-USER ${pkg.user}
+COPY package/linux/conf ./conf
+COPY package/linux/conf ./config
+COPY web ./web
+COPY src/server.js ./
+
+RUN chown -R node:node ${pkg.installFolder}
+
+RUN yarn install --production && yarn cache clean --all
+
+USER node
CMD ["start-web-ui.sh"]
diff --git a/msa/web-ui/docker/start-web-ui.sh b/msa/web-ui/docker/start-web-ui.sh
index a57b441db1..ba0c3eaeed 100755
--- a/msa/web-ui/docker/start-web-ui.sh
+++ b/msa/web-ui/docker/start-web-ui.sh
@@ -20,12 +20,10 @@ echo "Starting '${project.name}' ..."
CONF_FOLDER="${pkg.installFolder}/conf"
-mainfile=${pkg.installFolder}/bin/${pkg.name}
configfile=${pkg.name}.conf
-identity=${pkg.name}
source "${CONF_FOLDER}/${configfile}"
-cd ${pkg.installFolder}/bin
+cd ${pkg.installFolder}
-exec /bin/sh -c "$mainfile"
+exec /bin/sh -c "node server.js"
diff --git a/msa/web-ui/install.js b/msa/web-ui/install.js
index f0021d64f7..36b2311bb0 100644
--- a/msa/web-ui/install.js
+++ b/msa/web-ui/install.js
@@ -21,13 +21,10 @@ let _projectRoot = null;
(async() => {
- await fse.move(path.join(projectRoot(), 'target', 'thingsboard-web-ui-linux-x64'),
+ await fse.move(path.join(projectRoot(), 'target', 'thingsboard-web-ui-linux'),
path.join(targetPackageDir('linux'), 'bin', 'tb-web-ui'),
{overwrite: true});
- await fse.move(path.join(projectRoot(), 'target', 'thingsboard-web-ui-linux-arm64'),
- path.join(targetPackageDir('linux'), 'bin-arm64', 'tb-web-ui'),
- {overwrite: true});
- await fse.move(path.join(projectRoot(), 'target', 'thingsboard-web-ui-win-x64.exe'),
+ await fse.move(path.join(projectRoot(), 'target', 'thingsboard-web-ui-win.exe'),
path.join(targetPackageDir('windows'), 'bin', 'tb-web-ui.exe'),
{overwrite: true});
})();
diff --git a/msa/web-ui/package.json b/msa/web-ui/package.json
index 9e2075010a..9fa272d9b7 100644
--- a/msa/web-ui/package.json
+++ b/msa/web-ui/package.json
@@ -6,7 +6,7 @@
"main": "server.js",
"bin": "server.js",
"scripts": {
- "install": "pkg -t node12-linux-x64,node12-linux-arm64,node12-win-x64 --out-path ./target . && node install.js",
+ "pkg": "pkg -t node12-linux-x64,node12-win-x64 --out-path ./target . && node install.js",
"test": "echo \"Error: no test specified\" && exit 1",
"start": "WEB_FOLDER=./target/web nodemon server.js",
"start-prod": "NODE_ENV=production nodemon server.js"
@@ -22,9 +22,6 @@
"winston": "^3.3.3",
"winston-daily-rotate-file": "^4.5.0"
},
- "engines": {
- "node": ">=12.0.0 <14.0.0"
- },
"nyc": {
"exclude": [
"test",
diff --git a/msa/web-ui/pom.xml b/msa/web-ui/pom.xml
index bf311df492..864d5e2c56 100644
--- a/msa/web-ui/pom.xml
+++ b/msa/web-ui/pom.xml
@@ -93,6 +93,15 @@
install
+
+ yarn pkg
+
+ yarn
+
+
+ run pkg
+
+
@@ -140,6 +149,29 @@
org.apache.maven.plugins
maven-resources-plugin
+
+
+ copy-src-root
+ process-resources
+
+ copy-resources
+
+
+ ${project.build.directory}/src
+
+
+ ${basedir}
+
+ server.js
+ package.json
+ yarn.lock
+
+ false
+
+
+
+
+
org.thingsboard
diff --git a/packaging/js/build.gradle b/packaging/js/build.gradle
index df9d86dde7..929b7ed9d7 100644
--- a/packaging/js/build.gradle
+++ b/packaging/js/build.gradle
@@ -36,6 +36,12 @@ ospackage {
user pkgUser
permissionGroup pkgUser
+ // Copy the executable file
+ from("${buildDir}/package/linux/bin/${pkgName}") {
+ fileMode 0500
+ into "bin"
+ }
+
// Copy the init file
from("${buildDir}/package/linux/init/template") {
fileMode 0500
@@ -72,17 +78,9 @@ buildRpm {
preUninstall file("${buildDir}/control/rpm/prerm")
postUninstall file("${buildDir}/control/rpm/postrm")
- into pkgInstallFolder
-
user pkgUser
permissionGroup pkgUser
- // Copy the executable file
- from("${buildDir}/package/linux/bin/${pkgName}") {
- fileMode 0500
- into "bin"
- }
-
// Copy the system unit files
from("${buildDir}/control/template.service") {
addParentDirs = false
@@ -113,17 +111,9 @@ buildDeb {
preUninstall file("${buildDir}/control/deb/prerm")
postUninstall file("${buildDir}/control/deb/postrm")
- into pkgInstallFolder
-
user pkgUser
permissionGroup pkgUser
- // Copy the executable file
- from("${buildDir}/package/linux/bin/${pkgName}") {
- fileMode 0500
- into "bin"
- }
-
// Copy the system unit files
from("${buildDir}/control/template.service") {
addParentDirs = false
@@ -136,46 +126,3 @@ buildDeb {
link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
}
-
-// Same as the buildRpm task
-task buildDebArm64(type: Deb) {
-
- arch = "arm64"
-
- archiveFileName = "${pkgName}-arm64.deb"
-
- configurationFile("${pkgInstallFolder}/conf/${pkgName}.conf")
- configurationFile("${pkgInstallFolder}/conf/custom-environment-variables.yml")
- configurationFile("${pkgInstallFolder}/conf/default.yml")
- configurationFile("${pkgInstallFolder}/conf/logger.js")
-
- preInstall file("${buildDir}/control/deb/preinst")
- postInstall file("${buildDir}/control/deb/postinst")
- preUninstall file("${buildDir}/control/deb/prerm")
- postUninstall file("${buildDir}/control/deb/postrm")
-
- into pkgInstallFolder
-
- user pkgUser
- permissionGroup pkgUser
-
- // Copy the executable file
- from("${buildDir}/package/linux/bin-arm64/${pkgName}") {
- fileMode 0500
- into "bin"
- }
-
- // Copy the system unit files
- from("${buildDir}/control/template.service") {
- addParentDirs = false
- fileMode 0644
- into "/lib/systemd/system"
- rename { String filename ->
- "${pkgName}.service"
- }
- }
-
- link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
-}
-
-buildDeb.finalizedBy buildDebArm64