added redis configs to the transports yml
This commit is contained in:
parent
9b01f67d81
commit
609024a603
@ -22,7 +22,7 @@ import org.springframework.stereotype.Service;
|
||||
import static org.thingsboard.server.common.data.CacheConstants.FIRMWARE_CACHE;
|
||||
|
||||
@Service
|
||||
@ConditionalOnExpression("(('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true') || '${service.type:null}'=='tb-transport') && ('${cache.type:null}'=='caffeine' || '${cache.type:null}'=='caffeine')")
|
||||
@ConditionalOnExpression("(('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true') || '${service.type:null}'=='tb-transport') && ('${cache.type:null}'=='caffeine' || '${cache.type:null}'=='null')")
|
||||
public class CaffeineFirmwareCacheReader implements FirmwareCacheReader {
|
||||
|
||||
private final CacheManager cacheManager;
|
||||
|
||||
@ -22,7 +22,7 @@ import org.springframework.stereotype.Service;
|
||||
import static org.thingsboard.server.common.data.CacheConstants.FIRMWARE_CACHE;
|
||||
|
||||
@Service
|
||||
@ConditionalOnExpression("(('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true') || '${service.type:null}'=='core') && ('${cache.type:null}'=='caffeine' || '${cache.type:null}'=='caffeine')")
|
||||
@ConditionalOnExpression("('${service.type:null}'=='monolith' || '${service.type:null}'=='tb-core') && ('${cache.type:null}'=='caffeine' || '${cache.type:null}'=='null')")
|
||||
public class CaffeineFirmwareCacheWriter implements FirmwareCacheWriter {
|
||||
|
||||
private final CacheManager cacheManager;
|
||||
|
||||
@ -21,7 +21,7 @@ import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@ConditionalOnExpression("(('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true') || '${service.type:null}'=='core') && '${cache.type:null}'=='redis'")
|
||||
@ConditionalOnExpression("('${service.type:null}'=='monolith' || '${service.type:null}'=='tb-core') && '${cache.type:null}'=='redis'")
|
||||
public class RedisFirmwareCacheWriter extends AbstractRedisFirmwareCache implements FirmwareCacheWriter {
|
||||
|
||||
public RedisFirmwareCacheWriter(RedisConnectionFactory redisConnectionFactory) {
|
||||
|
||||
@ -26,7 +26,7 @@ import java.util.Arrays;
|
||||
@SpringBootConfiguration
|
||||
@EnableAsync
|
||||
@EnableScheduling
|
||||
@ComponentScan({"org.thingsboard.server.coap", "org.thingsboard.server.common", "org.thingsboard.server.coapserver", "org.thingsboard.server.transport.coap", "org.thingsboard.server.queue"})
|
||||
@ComponentScan({"org.thingsboard.server.coap", "org.thingsboard.server.common", "org.thingsboard.server.coapserver", "org.thingsboard.server.transport.coap", "org.thingsboard.server.queue", "org.thingsboard.server.cache"})
|
||||
public class ThingsboardCoapTransportApplication {
|
||||
|
||||
private static final String SPRING_CONFIG_NAME_KEY = "--spring.config.name";
|
||||
|
||||
@ -40,6 +40,50 @@ zk:
|
||||
# Name of the directory in zookeeper 'filesystem'
|
||||
zk_dir: "${ZOOKEEPER_NODES_DIR:/thingsboard}"
|
||||
|
||||
cache:
|
||||
# caffeine or redis
|
||||
type: "${CACHE_TYPE:redis}"
|
||||
|
||||
redis:
|
||||
# standalone or cluster
|
||||
connection:
|
||||
type: "${REDIS_CONNECTION_TYPE:standalone}"
|
||||
standalone:
|
||||
host: "${REDIS_HOST:localhost}"
|
||||
port: "${REDIS_PORT:6379}"
|
||||
useDefaultClientConfig: "${REDIS_USE_DEFAULT_CLIENT_CONFIG:true}"
|
||||
# this value may be used only if you used not default ClientConfig
|
||||
clientName: "${REDIS_CLIENT_NAME:standalone}"
|
||||
# this value may be used only if you used not default ClientConfig
|
||||
connectTimeout: "${REDIS_CLIENT_CONNECT_TIMEOUT:30000}"
|
||||
# this value may be used only if you used not default ClientConfig
|
||||
readTimeout: "${REDIS_CLIENT_READ_TIMEOUT:60000}"
|
||||
# this value may be used only if you used not default ClientConfig
|
||||
usePoolConfig: "${REDIS_CLIENT_USE_POOL_CONFIG:false}"
|
||||
cluster:
|
||||
# Comma-separated list of "host:port" pairs to bootstrap from.
|
||||
nodes: "${REDIS_NODES:}"
|
||||
# Maximum number of redirects to follow when executing commands across the cluster.
|
||||
max-redirects: "${REDIS_MAX_REDIRECTS:12}"
|
||||
useDefaultPoolConfig: "${REDIS_USE_DEFAULT_POOL_CONFIG:true}"
|
||||
# db index
|
||||
db: "${REDIS_DB:0}"
|
||||
# db password
|
||||
password: "${REDIS_PASSWORD:}"
|
||||
# pool config
|
||||
pool_config:
|
||||
maxTotal: "${REDIS_POOL_CONFIG_MAX_TOTAL:128}"
|
||||
maxIdle: "${REDIS_POOL_CONFIG_MAX_IDLE:128}"
|
||||
minIdle: "${REDIS_POOL_CONFIG_MIN_IDLE:16}"
|
||||
testOnBorrow: "${REDIS_POOL_CONFIG_TEST_ON_BORROW:true}"
|
||||
testOnReturn: "${REDIS_POOL_CONFIG_TEST_ON_RETURN:true}"
|
||||
testWhileIdle: "${REDIS_POOL_CONFIG_TEST_WHILE_IDLE:true}"
|
||||
minEvictableMs: "${REDIS_POOL_CONFIG_MIN_EVICTABLE_MS:60000}"
|
||||
evictionRunsMs: "${REDIS_POOL_CONFIG_EVICTION_RUNS_MS:30000}"
|
||||
maxWaitMills: "${REDIS_POOL_CONFIG_MAX_WAIT_MS:60000}"
|
||||
numberTestsPerEvictionRun: "${REDIS_POOL_CONFIG_NUMBER_TESTS_PER_EVICTION_RUN:3}"
|
||||
blockWhenExhausted: "${REDIS_POOL_CONFIG_BLOCK_WHEN_EXHAUSTED:true}"
|
||||
|
||||
# COAP server parameters
|
||||
transport:
|
||||
coap:
|
||||
|
||||
@ -24,7 +24,7 @@ import java.util.Arrays;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableAsync
|
||||
@ComponentScan({"org.thingsboard.server.http", "org.thingsboard.server.common", "org.thingsboard.server.transport.http", "org.thingsboard.server.queue"})
|
||||
@ComponentScan({"org.thingsboard.server.http", "org.thingsboard.server.common", "org.thingsboard.server.transport.http", "org.thingsboard.server.queue", "org.thingsboard.server.cache"})
|
||||
public class ThingsboardHttpTransportApplication {
|
||||
|
||||
private static final String SPRING_CONFIG_NAME_KEY = "--spring.config.name";
|
||||
|
||||
@ -35,6 +35,50 @@ zk:
|
||||
# Name of the directory in zookeeper 'filesystem'
|
||||
zk_dir: "${ZOOKEEPER_NODES_DIR:/thingsboard}"
|
||||
|
||||
cache:
|
||||
# caffeine or redis
|
||||
type: "${CACHE_TYPE:redis}"
|
||||
|
||||
redis:
|
||||
# standalone or cluster
|
||||
connection:
|
||||
type: "${REDIS_CONNECTION_TYPE:standalone}"
|
||||
standalone:
|
||||
host: "${REDIS_HOST:localhost}"
|
||||
port: "${REDIS_PORT:6379}"
|
||||
useDefaultClientConfig: "${REDIS_USE_DEFAULT_CLIENT_CONFIG:true}"
|
||||
# this value may be used only if you used not default ClientConfig
|
||||
clientName: "${REDIS_CLIENT_NAME:standalone}"
|
||||
# this value may be used only if you used not default ClientConfig
|
||||
connectTimeout: "${REDIS_CLIENT_CONNECT_TIMEOUT:30000}"
|
||||
# this value may be used only if you used not default ClientConfig
|
||||
readTimeout: "${REDIS_CLIENT_READ_TIMEOUT:60000}"
|
||||
# this value may be used only if you used not default ClientConfig
|
||||
usePoolConfig: "${REDIS_CLIENT_USE_POOL_CONFIG:false}"
|
||||
cluster:
|
||||
# Comma-separated list of "host:port" pairs to bootstrap from.
|
||||
nodes: "${REDIS_NODES:}"
|
||||
# Maximum number of redirects to follow when executing commands across the cluster.
|
||||
max-redirects: "${REDIS_MAX_REDIRECTS:12}"
|
||||
useDefaultPoolConfig: "${REDIS_USE_DEFAULT_POOL_CONFIG:true}"
|
||||
# db index
|
||||
db: "${REDIS_DB:0}"
|
||||
# db password
|
||||
password: "${REDIS_PASSWORD:}"
|
||||
# pool config
|
||||
pool_config:
|
||||
maxTotal: "${REDIS_POOL_CONFIG_MAX_TOTAL:128}"
|
||||
maxIdle: "${REDIS_POOL_CONFIG_MAX_IDLE:128}"
|
||||
minIdle: "${REDIS_POOL_CONFIG_MIN_IDLE:16}"
|
||||
testOnBorrow: "${REDIS_POOL_CONFIG_TEST_ON_BORROW:true}"
|
||||
testOnReturn: "${REDIS_POOL_CONFIG_TEST_ON_RETURN:true}"
|
||||
testWhileIdle: "${REDIS_POOL_CONFIG_TEST_WHILE_IDLE:true}"
|
||||
minEvictableMs: "${REDIS_POOL_CONFIG_MIN_EVICTABLE_MS:60000}"
|
||||
evictionRunsMs: "${REDIS_POOL_CONFIG_EVICTION_RUNS_MS:30000}"
|
||||
maxWaitMills: "${REDIS_POOL_CONFIG_MAX_WAIT_MS:60000}"
|
||||
numberTestsPerEvictionRun: "${REDIS_POOL_CONFIG_NUMBER_TESTS_PER_EVICTION_RUN:3}"
|
||||
blockWhenExhausted: "${REDIS_POOL_CONFIG_BLOCK_WHEN_EXHAUSTED:true}"
|
||||
|
||||
# HTTP server parameters
|
||||
transport:
|
||||
http:
|
||||
|
||||
@ -42,40 +42,7 @@ zk:
|
||||
|
||||
cache:
|
||||
# caffeine or redis
|
||||
type: "${CACHE_TYPE:caffeine}"
|
||||
|
||||
caffeine:
|
||||
specs:
|
||||
relations:
|
||||
timeToLiveInMinutes: 1440
|
||||
maxSize: 0
|
||||
deviceCredentials:
|
||||
timeToLiveInMinutes: 1440
|
||||
maxSize: 0
|
||||
devices:
|
||||
timeToLiveInMinutes: 1440
|
||||
maxSize: 0
|
||||
sessions:
|
||||
timeToLiveInMinutes: 1440
|
||||
maxSize: 0
|
||||
assets:
|
||||
timeToLiveInMinutes: 1440
|
||||
maxSize: 0
|
||||
entityViews:
|
||||
timeToLiveInMinutes: 1440
|
||||
maxSize: 0
|
||||
claimDevices:
|
||||
timeToLiveInMinutes: 1
|
||||
maxSize: 0
|
||||
securitySettings:
|
||||
timeToLiveInMinutes: 1440
|
||||
maxSize: 0
|
||||
tenantProfiles:
|
||||
timeToLiveInMinutes: 1440
|
||||
maxSize: 0
|
||||
deviceProfiles:
|
||||
timeToLiveInMinutes: 1440
|
||||
maxSize: 0
|
||||
type: "${CACHE_TYPE:redis}"
|
||||
|
||||
redis:
|
||||
# standalone or cluster
|
||||
|
||||
@ -26,7 +26,7 @@ import java.util.Arrays;
|
||||
@SpringBootConfiguration
|
||||
@EnableAsync
|
||||
@EnableScheduling
|
||||
@ComponentScan({"org.thingsboard.server.mqtt", "org.thingsboard.server.common", "org.thingsboard.server.transport.mqtt", "org.thingsboard.server.queue"})
|
||||
@ComponentScan({"org.thingsboard.server.mqtt", "org.thingsboard.server.common", "org.thingsboard.server.transport.mqtt", "org.thingsboard.server.queue", "org.thingsboard.server.cache"})
|
||||
public class ThingsboardMqttTransportApplication {
|
||||
|
||||
private static final String SPRING_CONFIG_NAME_KEY = "--spring.config.name";
|
||||
|
||||
@ -40,6 +40,50 @@ zk:
|
||||
# Name of the directory in zookeeper 'filesystem'
|
||||
zk_dir: "${ZOOKEEPER_NODES_DIR:/thingsboard}"
|
||||
|
||||
cache:
|
||||
# caffeine or redis
|
||||
type: "${CACHE_TYPE:redis}"
|
||||
|
||||
redis:
|
||||
# standalone or cluster
|
||||
connection:
|
||||
type: "${REDIS_CONNECTION_TYPE:standalone}"
|
||||
standalone:
|
||||
host: "${REDIS_HOST:localhost}"
|
||||
port: "${REDIS_PORT:6379}"
|
||||
useDefaultClientConfig: "${REDIS_USE_DEFAULT_CLIENT_CONFIG:true}"
|
||||
# this value may be used only if you used not default ClientConfig
|
||||
clientName: "${REDIS_CLIENT_NAME:standalone}"
|
||||
# this value may be used only if you used not default ClientConfig
|
||||
connectTimeout: "${REDIS_CLIENT_CONNECT_TIMEOUT:30000}"
|
||||
# this value may be used only if you used not default ClientConfig
|
||||
readTimeout: "${REDIS_CLIENT_READ_TIMEOUT:60000}"
|
||||
# this value may be used only if you used not default ClientConfig
|
||||
usePoolConfig: "${REDIS_CLIENT_USE_POOL_CONFIG:false}"
|
||||
cluster:
|
||||
# Comma-separated list of "host:port" pairs to bootstrap from.
|
||||
nodes: "${REDIS_NODES:}"
|
||||
# Maximum number of redirects to follow when executing commands across the cluster.
|
||||
max-redirects: "${REDIS_MAX_REDIRECTS:12}"
|
||||
useDefaultPoolConfig: "${REDIS_USE_DEFAULT_POOL_CONFIG:true}"
|
||||
# db index
|
||||
db: "${REDIS_DB:0}"
|
||||
# db password
|
||||
password: "${REDIS_PASSWORD:}"
|
||||
# pool config
|
||||
pool_config:
|
||||
maxTotal: "${REDIS_POOL_CONFIG_MAX_TOTAL:128}"
|
||||
maxIdle: "${REDIS_POOL_CONFIG_MAX_IDLE:128}"
|
||||
minIdle: "${REDIS_POOL_CONFIG_MIN_IDLE:16}"
|
||||
testOnBorrow: "${REDIS_POOL_CONFIG_TEST_ON_BORROW:true}"
|
||||
testOnReturn: "${REDIS_POOL_CONFIG_TEST_ON_RETURN:true}"
|
||||
testWhileIdle: "${REDIS_POOL_CONFIG_TEST_WHILE_IDLE:true}"
|
||||
minEvictableMs: "${REDIS_POOL_CONFIG_MIN_EVICTABLE_MS:60000}"
|
||||
evictionRunsMs: "${REDIS_POOL_CONFIG_EVICTION_RUNS_MS:30000}"
|
||||
maxWaitMills: "${REDIS_POOL_CONFIG_MAX_WAIT_MS:60000}"
|
||||
numberTestsPerEvictionRun: "${REDIS_POOL_CONFIG_NUMBER_TESTS_PER_EVICTION_RUN:3}"
|
||||
blockWhenExhausted: "${REDIS_POOL_CONFIG_BLOCK_WHEN_EXHAUSTED:true}"
|
||||
|
||||
# MQTT server parameters
|
||||
transport:
|
||||
mqtt:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user