Commit c4b36b0c6f81913b2bb7fc4bfe789295813a2ed5

Authored by Andrii Shvaika
1 parent c32a2ac0

Fix create database in docker images. No more Californium.properties

@@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j; @@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j;
19 import org.eclipse.californium.core.CoapResource; 19 import org.eclipse.californium.core.CoapResource;
20 import org.eclipse.californium.core.CoapServer; 20 import org.eclipse.californium.core.CoapServer;
21 import org.eclipse.californium.core.network.CoapEndpoint; 21 import org.eclipse.californium.core.network.CoapEndpoint;
  22 +import org.eclipse.californium.core.network.config.NetworkConfig;
22 import org.springframework.beans.factory.annotation.Autowired; 23 import org.springframework.beans.factory.annotation.Autowired;
23 import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; 24 import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
24 import org.springframework.stereotype.Service; 25 import org.springframework.stereotype.Service;
@@ -46,7 +47,7 @@ public class CoapTransportService { @@ -46,7 +47,7 @@ public class CoapTransportService {
46 public void init() throws UnknownHostException { 47 public void init() throws UnknownHostException {
47 log.info("Starting CoAP transport..."); 48 log.info("Starting CoAP transport...");
48 log.info("Starting CoAP transport server"); 49 log.info("Starting CoAP transport server");
49 - this.server = new CoapServer(); 50 + this.server = new CoapServer(NetworkConfig.createStandardWithoutFile());
50 createResources(); 51 createResources();
51 InetAddress addr = InetAddress.getByName(coapTransportContext.getHost()); 52 InetAddress addr = InetAddress.getByName(coapTransportContext.getHost());
52 InetSocketAddress sockAddr = new InetSocketAddress(addr, coapTransportContext.getPort()); 53 InetSocketAddress sockAddr = new InetSocketAddress(addr, coapTransportContext.getPort());
@@ -27,7 +27,11 @@ fi @@ -27,7 +27,11 @@ fi
27 exec setsid nohup postgres >> ${PGLOG}/postgres.log 2>&1 & 27 exec setsid nohup postgres >> ${PGLOG}/postgres.log 2>&1 &
28 28
29 if [ ! -f ${firstlaunch} ]; then 29 if [ ! -f ${firstlaunch} ]; then
30 - psql -U ${pkg.user} -d postgres -c "CREATE DATABASE thingsboard" 30 + sleep 2
  31 + while ! psql -U ${pkg.user} -d postgres -c "CREATE DATABASE thingsboard"
  32 + do
  33 + sleep 1
  34 + done
31 fi 35 fi
32 36
33 cassandra_data_dir=${CASSANDRA_DATA} 37 cassandra_data_dir=${CASSANDRA_DATA}
@@ -27,5 +27,9 @@ fi @@ -27,5 +27,9 @@ fi
27 exec setsid nohup postgres >> ${PGLOG}/postgres.log 2>&1 & 27 exec setsid nohup postgres >> ${PGLOG}/postgres.log 2>&1 &
28 28
29 if [ ! -f ${firstlaunch} ]; then 29 if [ ! -f ${firstlaunch} ]; then
30 - psql -U ${pkg.user} -d postgres -c "CREATE DATABASE thingsboard"  
31 -fi 30 + sleep 2
  31 + while ! psql -U ${pkg.user} -d postgres -c "CREATE DATABASE thingsboard"
  32 + do
  33 + sleep 1
  34 + done
  35 +fi