added gateway image version configuration
This commit is contained in:
parent
68282001ac
commit
759a814763
@ -1421,6 +1421,8 @@ device:
|
||||
port: "${DEVICE_CONNECTIVITY_COAPS_PORT:5684}"
|
||||
# Path to the COAP CA root certificate file
|
||||
pem_cert_file: "${DEVICE_CONNECTIVITY_COAPS_CA_ROOT_CERT:cafile.pem}"
|
||||
gateway:
|
||||
image_version: "${DEVICE_CONNECTIVITY_GATEWAY_IMAGE_VERSION:latest}"
|
||||
|
||||
# Edges parameters
|
||||
edges:
|
||||
|
||||
@ -298,7 +298,7 @@ public class DeviceConnectivityControllerTest extends AbstractControllerTest {
|
||||
"services:\n" +
|
||||
" # ThingsBoard IoT Gateway Service Configuration\n" +
|
||||
" tb-gateway:\n" +
|
||||
" image: thingsboard/tb-gateway\n" +
|
||||
" image: thingsboard/tb-gateway:latest\n" +
|
||||
" container_name: tb-gateway\n" +
|
||||
" restart: always\n" +
|
||||
"\n" +
|
||||
|
||||
@ -41,7 +41,6 @@ import org.thingsboard.server.common.data.security.DeviceCredentialsType;
|
||||
import org.thingsboard.server.dao.settings.AdminSettingsService;
|
||||
import org.thingsboard.server.dao.util.DeviceConnectivityUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URISyntaxException;
|
||||
@ -86,6 +85,8 @@ public class DeviceConnectivityServiceImpl implements DeviceConnectivityService
|
||||
private String mqttsPemCertFile;
|
||||
@Value("${device.connectivity.coaps.pem_cert_file:}")
|
||||
private String coapsPemCertFile;
|
||||
@Value("${device.connectivity.gateway.image_version:latest}")
|
||||
private String gatewayImageVersion;
|
||||
|
||||
@Override
|
||||
public JsonNode findDevicePublishTelemetryCommands(String baseUrl, Device device) throws URISyntaxException {
|
||||
@ -157,7 +158,8 @@ public class DeviceConnectivityServiceImpl implements DeviceConnectivityService
|
||||
String mqttType = isEnabled(MQTTS) ? MQTTS : MQTT;
|
||||
DeviceConnectivityInfo properties = getConnectivity(mqttType);
|
||||
DeviceCredentials creds = deviceCredentialsService.findDeviceCredentialsByDeviceId(device.getTenantId(), device.getId());
|
||||
return DeviceConnectivityUtil.getGatewayDockerComposeFile(baseUrl, properties, creds, mqttType);
|
||||
String host = getHost(baseUrl, properties, mqttType);
|
||||
return DeviceConnectivityUtil.getGatewayDockerComposeFile(host, gatewayImageVersion, creds);
|
||||
}
|
||||
|
||||
private DeviceConnectivityInfo getConnectivity(String protocol) {
|
||||
|
||||
@ -92,15 +92,13 @@ public class DeviceConnectivityUtil {
|
||||
return command.toString();
|
||||
}
|
||||
|
||||
public static Resource getGatewayDockerComposeFile(String baseUrl, DeviceConnectivityInfo properties, DeviceCredentials deviceCredentials, String mqttType) throws URISyntaxException {
|
||||
String host = getHost(baseUrl, properties, mqttType);
|
||||
|
||||
public static Resource getGatewayDockerComposeFile(String host, String gatewayImageVersion, DeviceCredentials deviceCredentials) {
|
||||
StringBuilder dockerComposeBuilder = new StringBuilder();
|
||||
dockerComposeBuilder.append("version: '3.4'\n");
|
||||
dockerComposeBuilder.append("services:\n");
|
||||
dockerComposeBuilder.append(" # ThingsBoard IoT Gateway Service Configuration\n");
|
||||
dockerComposeBuilder.append(" tb-gateway:\n");
|
||||
dockerComposeBuilder.append(" image: thingsboard/tb-gateway\n");
|
||||
dockerComposeBuilder.append(" image: thingsboard/tb-gateway:").append(gatewayImageVersion).append("\n");
|
||||
dockerComposeBuilder.append(" container_name: tb-gateway\n");
|
||||
dockerComposeBuilder.append(" restart: always\n");
|
||||
dockerComposeBuilder.append("\n");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user