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

This commit is contained in:
Andrii Shvaika 2020-11-25 18:12:54 +02:00
parent c32a2ac064
commit c4b36b0c6f
3 changed files with 13 additions and 4 deletions

View File

@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j;
import org.eclipse.californium.core.CoapResource;
import org.eclipse.californium.core.CoapServer;
import org.eclipse.californium.core.network.CoapEndpoint;
import org.eclipse.californium.core.network.config.NetworkConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.stereotype.Service;
@ -46,7 +47,7 @@ public class CoapTransportService {
public void init() throws UnknownHostException {
log.info("Starting CoAP transport...");
log.info("Starting CoAP transport server");
this.server = new CoapServer();
this.server = new CoapServer(NetworkConfig.createStandardWithoutFile());
createResources();
InetAddress addr = InetAddress.getByName(coapTransportContext.getHost());
InetSocketAddress sockAddr = new InetSocketAddress(addr, coapTransportContext.getPort());

View File

@ -27,7 +27,11 @@ fi
exec setsid nohup postgres >> ${PGLOG}/postgres.log 2>&1 &
if [ ! -f ${firstlaunch} ]; then
psql -U ${pkg.user} -d postgres -c "CREATE DATABASE thingsboard"
sleep 2
while ! psql -U ${pkg.user} -d postgres -c "CREATE DATABASE thingsboard"
do
sleep 1
done
fi
cassandra_data_dir=${CASSANDRA_DATA}

View File

@ -27,5 +27,9 @@ fi
exec setsid nohup postgres >> ${PGLOG}/postgres.log 2>&1 &
if [ ! -f ${firstlaunch} ]; then
psql -U ${pkg.user} -d postgres -c "CREATE DATABASE thingsboard"
fi
sleep 2
while ! psql -U ${pkg.user} -d postgres -c "CREATE DATABASE thingsboard"
do
sleep 1
done
fi