From fd03d333bd2af8f9a01b3107fbdb8e885c4f46d6 Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Wed, 4 Jan 2023 10:53:42 +0200 Subject: [PATCH] Added CLOUD_RPC_PORT and CLOUD_RPC_SSL_ENABLED to the instructions docker-compose file --- .../edge/install_instructions/docker/instructions.md | 2 ++ .../edge/instructions/DefaultEdgeInstallService.java | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/application/src/main/data/json/edge/install_instructions/docker/instructions.md b/application/src/main/data/json/edge/install_instructions/docker/instructions.md index 8a49b79c41..37bf52c8cc 100644 --- a/application/src/main/data/json/edge/install_instructions/docker/instructions.md +++ b/application/src/main/data/json/edge/install_instructions/docker/instructions.md @@ -46,6 +46,8 @@ services: CLOUD_ROUTING_KEY: ${CLOUD_ROUTING_KEY} CLOUD_ROUTING_SECRET: ${CLOUD_ROUTING_SECRET} CLOUD_RPC_HOST: ${BASE_URL} + CLOUD_RPC_PORT: ${CLOUD_RPC_PORT} + CLOUD_RPC_SSL_ENABLED: ${CLOUD_RPC_SSL_ENABLED} volumes: - ~/.mytb-edge-data:/data - ~/.mytb-edge-logs:/var/log/tb-edge diff --git a/application/src/main/java/org/thingsboard/server/service/edge/instructions/DefaultEdgeInstallService.java b/application/src/main/java/org/thingsboard/server/service/edge/instructions/DefaultEdgeInstallService.java index c5efa4f265..dca5a768a4 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/instructions/DefaultEdgeInstallService.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/instructions/DefaultEdgeInstallService.java @@ -17,6 +17,7 @@ package org.thingsboard.server.service.edge.instructions; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Service; import org.thingsboard.server.common.data.edge.Edge; @@ -45,6 +46,12 @@ public class DefaultEdgeInstallService implements EdgeInstallService { private final InstallScripts installScripts; + @Value("${edges.rpc.port}") + private int rpcPort; + + @Value("${edges.rpc.ssl.enabled}") + private boolean sslEnabled; + @Override public EdgeInstallInstructions getDockerInstallInstructions(TenantId tenantId, Edge edge, HttpServletRequest request) { String dockerInstallInstructions = readFile(resolveFile("docker", "instructions.md")); @@ -59,6 +66,8 @@ public class DefaultEdgeInstallService implements EdgeInstallService { } dockerInstallInstructions = dockerInstallInstructions.replace("${CLOUD_ROUTING_KEY}", edge.getRoutingKey()); dockerInstallInstructions = dockerInstallInstructions.replace("${CLOUD_ROUTING_SECRET}", edge.getSecret()); + dockerInstallInstructions = dockerInstallInstructions.replace("${CLOUD_RPC_PORT}", Integer.toString(rpcPort)); + dockerInstallInstructions = dockerInstallInstructions.replace("${CLOUD_RPC_SSL_ENABLED}", Boolean.toString(sslEnabled)); return new EdgeInstallInstructions(dockerInstallInstructions); }