Fix create database in docker images. No more Californium.properties
This commit is contained in:
		
							parent
							
								
									c32a2ac064
								
							
						
					
					
						commit
						c4b36b0c6f
					
				@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j;
 | 
				
			|||||||
import org.eclipse.californium.core.CoapResource;
 | 
					import org.eclipse.californium.core.CoapResource;
 | 
				
			||||||
import org.eclipse.californium.core.CoapServer;
 | 
					import org.eclipse.californium.core.CoapServer;
 | 
				
			||||||
import org.eclipse.californium.core.network.CoapEndpoint;
 | 
					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.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
 | 
					import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
@ -46,7 +47,7 @@ public class CoapTransportService {
 | 
				
			|||||||
    public void init() throws UnknownHostException {
 | 
					    public void init() throws UnknownHostException {
 | 
				
			||||||
        log.info("Starting CoAP transport...");
 | 
					        log.info("Starting CoAP transport...");
 | 
				
			||||||
        log.info("Starting CoAP transport server");
 | 
					        log.info("Starting CoAP transport server");
 | 
				
			||||||
        this.server = new CoapServer();
 | 
					        this.server = new CoapServer(NetworkConfig.createStandardWithoutFile());
 | 
				
			||||||
        createResources();
 | 
					        createResources();
 | 
				
			||||||
        InetAddress addr = InetAddress.getByName(coapTransportContext.getHost());
 | 
					        InetAddress addr = InetAddress.getByName(coapTransportContext.getHost());
 | 
				
			||||||
        InetSocketAddress sockAddr = new InetSocketAddress(addr, coapTransportContext.getPort());
 | 
					        InetSocketAddress sockAddr = new InetSocketAddress(addr, coapTransportContext.getPort());
 | 
				
			||||||
 | 
				
			|||||||
@ -27,7 +27,11 @@ fi
 | 
				
			|||||||
exec setsid nohup postgres >> ${PGLOG}/postgres.log 2>&1 &
 | 
					exec setsid nohup postgres >> ${PGLOG}/postgres.log 2>&1 &
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ ! -f ${firstlaunch} ]; then
 | 
					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
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cassandra_data_dir=${CASSANDRA_DATA}
 | 
					cassandra_data_dir=${CASSANDRA_DATA}
 | 
				
			||||||
 | 
				
			|||||||
@ -27,5 +27,9 @@ fi
 | 
				
			|||||||
exec setsid nohup postgres >> ${PGLOG}/postgres.log 2>&1 &
 | 
					exec setsid nohup postgres >> ${PGLOG}/postgres.log 2>&1 &
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ ! -f ${firstlaunch} ]; then
 | 
					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
 | 
					fi
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user