mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-24 22:05:11 +00:00
openSyncGW cloud docker NBI and SBI support
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
FROM adoptopenjdk/openjdk13:alpine-jre
|
||||
|
||||
LABEL maintainer="ConnectUs.ai as part of the Telecom Infrastructure Project"
|
||||
LABEL version="1.0"
|
||||
LABEL description="This image runs the mqtt broker (mosquitto) and \
|
||||
an OpenSync gateway."
|
||||
|
||||
# Update the package list and upgrade installed packages
|
||||
RUN apk update && apk upgrade
|
||||
RUN mkdir -p /opt/tip-wlan/certs
|
||||
VOLUME ["/opt/tip-wlan/certs"]
|
||||
|
||||
# Configure mqtt broker
|
||||
RUN apk add mosquitto
|
||||
RUN mkdir -p /mosquitto/data /mosquitto/log
|
||||
COPY app/mqtt/mosquitto.conf /etc/mosquitto/mosquitto.conf
|
||||
VOLUME ["/mosquitto/data", "/mosquitto/log"]
|
||||
|
||||
|
||||
# Configure OpenSync Gateway
|
||||
RUN mkdir -p /app/logs /app/opensync /app/config
|
||||
COPY maven/app.jar /app
|
||||
COPY app/opensync/logback.xml /app/opensync/logback.xml
|
||||
COPY app/run.sh /app
|
||||
VOLUME ["/app/logs", "/app/config"]
|
||||
|
||||
RUN chmod +x /app/run.sh
|
||||
|
||||
EXPOSE 1883 6640 6643 4043
|
||||
|
||||
WORKDIR /app
|
||||
ENTRYPOINT ["/app/run.sh"]
|
||||
CMD [""]
|
||||
@@ -1,18 +0,0 @@
|
||||
cafile /opt/tip-wlan/certs/cacert.pem
|
||||
certfile /opt/tip-wlan/certs/mqttservercert.pem
|
||||
keyfile /opt/tip-wlan/certs/mqttserverkey_dec.pem
|
||||
require_certificate true
|
||||
use_identity_as_username true
|
||||
allow_anonymous false
|
||||
allow_duplicate_messages true
|
||||
autosave_interval 900
|
||||
log_dest file /mosquitto/log/mosquitto.log
|
||||
max_queued_bytes 0
|
||||
max_queued_messages 0
|
||||
message_size_limit 0
|
||||
persistence true
|
||||
persistence_file mosquitto.db
|
||||
persistence_location /mosquitto/data/
|
||||
pid_file /mosquitto/mosquitto.pid
|
||||
port 1883
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!-- For assistance related to logback-translator or configuration -->
|
||||
<!-- files in general, please contact the logback user mailing list -->
|
||||
<!-- at http://www.qos.ch/mailman/listinfo/logback-user -->
|
||||
<!-- -->
|
||||
<!-- For professional support please see -->
|
||||
<!-- http://www.qos.ch/shop/products/professionalSupport -->
|
||||
<!-- -->
|
||||
<configuration>
|
||||
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="mqttDataFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>/app/logs/mqttData.log</file>
|
||||
<append>true</append>
|
||||
<encoder>
|
||||
<pattern>%date %msg%n</pattern>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
|
||||
<fileNamePattern>/app/logs/mqttData.%i.log.gz</fileNamePattern>
|
||||
<minIndex>1</minIndex>
|
||||
<maxIndex>3</maxIndex>
|
||||
</rollingPolicy>
|
||||
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||
<maxFileSize>20MB</maxFileSize>
|
||||
</triggeringPolicy>
|
||||
</appender>
|
||||
|
||||
|
||||
<appender name="logfile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>/app/logs/opensyncgw.log</file>
|
||||
<append>true</append>
|
||||
<encoder>
|
||||
<pattern>%date %level [%thread] %logger{36} [%file:%line] %msg%n</pattern>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
|
||||
<fileNamePattern>/app/logs/opensyncgw.%i.log.gz</fileNamePattern>
|
||||
<minIndex>1</minIndex>
|
||||
<maxIndex>3</maxIndex>
|
||||
</rollingPolicy>
|
||||
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||
<maxFileSize>20MB</maxFileSize>
|
||||
</triggeringPolicy>
|
||||
</appender>
|
||||
|
||||
<!--
|
||||
details: http://logback.qos.ch/manual/configuration.html#auto_configuration
|
||||
|
||||
runtime configuration, if need to override the defaults:
|
||||
-Dlogback.configurationFile=/path/to/logback.xml
|
||||
|
||||
for log configuration debugging - use
|
||||
-Dlogback.statusListenerClass=ch.qos.logback.core.status.OnConsoleStatusListener
|
||||
|
||||
log levels:
|
||||
OFF ERROR WARN INFO DEBUG TRACE
|
||||
-->
|
||||
<logger name="org.apache.catalina.startup.DigesterFactory" level="ERROR"/>
|
||||
<logger name="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" level="INFO"/>
|
||||
<logger name="org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer" level="INFO"/>
|
||||
|
||||
<logger name="com.telecominfraproject.wlan" level="INFO"/>
|
||||
<logger name="ai.connectus" level="INFO"/>
|
||||
<logger name="com.netflix.servo.tag.aws.AwsInjectableTag" level="OFF"/>
|
||||
<logger name="com.vmware.ovsdb.service.OvsdbConnectionInfo" level="OFF"/>
|
||||
<logger name="com.vmware.ovsdb.netty.OvsdbConnectionHandler" level="ERROR"/>
|
||||
|
||||
<logger name="MQTT_DATA" level="DEBUG" additivity="false">
|
||||
<appender-ref ref="mqttDataFile"/>
|
||||
</logger>
|
||||
|
||||
<root level="WARN">
|
||||
<appender-ref ref="logfile"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
@@ -1,126 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Prepare the hosts file - do it only if does not have required entries
|
||||
n1=`grep opensync-mqtt-broker /etc/hosts | wc -l`
|
||||
|
||||
if [[ $n1 -eq 0 ]]
|
||||
then
|
||||
echo Adding opensync-mqtt-broker to /etc/hosts
|
||||
echo "127.0.0.1 opensync-mqtt-broker" >> /etc/hosts
|
||||
fi
|
||||
|
||||
n2=`grep opensync-wifi-controller /etc/hosts | wc -l`
|
||||
|
||||
if [[ $n2 -eq 0 ]]
|
||||
then
|
||||
echo Adding opensync-wifi-controller to /etc/hosts
|
||||
echo "127.0.0.1 opensync-wifi-controller" >> /etc/hosts
|
||||
fi
|
||||
|
||||
|
||||
echo Starting mosquitto MQTT broker
|
||||
/usr/sbin/mosquitto -d -c /etc/mosquitto/mosquitto.conf
|
||||
|
||||
# Provide default values for the environment variables
|
||||
MQTT_CLIENT_KEYSTORE_PASSWORD="${MQTT_CLIENT_KEYSTORE_PASSWORD:=mypassword}"
|
||||
MQTT_CLIENT_KEYSTORE_FILE="${MQTT_CLIENT_KEYSTORE_FILE:=/opt/tip-wlan/certs/client_keystore.jks}"
|
||||
MQTT_TRUSTSTORE_FILE="${MQTT_TRUSTSTORE_FILE:=/opt/tip-wlan/certs/truststore.jks}"
|
||||
MQTT_TRUSTSTORE_PASSWORD="${MQTT_TRUSTSTORE_PASSWORD:=mypassword}"
|
||||
|
||||
OVSDB_SERVER_KEYSTORE_FILE="${OVSDB_SERVER_KEYSTORE_FILE:=/opt/tip-wlan/certs/server.pkcs12}"
|
||||
OVSDB_SERVER_KEYSTORE_PASSWORD="${OVSDB_SERVER_KEYSTORE_PASSWORD:=mypassword}"
|
||||
OVSDB_SERVER_TRUSTSTORE_FILE="${OVSDB_SERVER_TRUSTSTORE_FILE:=/opt/tip-wlan/certs/truststore.jks}"
|
||||
OVSDB_SERVER_TRUSTSTORE_PASSWORD="${OVSDB_SERVER_TRUSTSTORE_PASSWORD:=mypassword}"
|
||||
OVSDB_CONFIG_FILE="${OVSDB_CONFIG_FILE:=/app/opensync/config_2_ssids.json}"
|
||||
|
||||
echo Reading AP configuration from $OVSDB_CONFIG_FILE
|
||||
|
||||
EXT_CLIENT_KEYSTORE_PASSWORD="${EXT_CLIENT_KEYSTORE_PASSWORD:=mypassword}"
|
||||
EXT_CLIENT_KEYSTORE_FILE="${EXT_CLIENT_KEYSTORE_FILE:=/opt/tip-wlan/certs/client_keystore.jks}"
|
||||
EXT_TRUSTSTORE_FILE="${EXT_TRUSTSTORE_FILE:=/opt/tip-wlan/certs/truststore.jks}"
|
||||
EXT_TRUSTSTORE_PASSWORD="${EXT_TRUSTSTORE_PASSWORD:=mypassword}"
|
||||
|
||||
MQTT_BROKER_HOST="${MQTT_BROKER_HOST:=opensync-mqtt-broker}"
|
||||
OVSDB_MANAGER_HOST="${OVSDB_MANAGER_HOST:=opensync-wifi-controller}"
|
||||
|
||||
LOGBACK_CONFIG_FILE="${LOGBACK_CONFIG_FILE:=/app/opensync/logback.xml}"
|
||||
|
||||
# Create ssl.properties file
|
||||
cat > /app/ssl.properties <<END_OF_FILE
|
||||
truststorePass=$OVSDB_SERVER_TRUSTSTORE_PASSWORD
|
||||
truststoreFile=file:$OVSDB_SERVER_TRUSTSTORE_FILE
|
||||
truststoreType=JKS
|
||||
truststoreProvider=SUN
|
||||
|
||||
keyAlias=1
|
||||
keystorePass=$OVSDB_SERVER_KEYSTORE_PASSWORD
|
||||
keystoreFile=file:$OVSDB_SERVER_KEYSTORE_FILE
|
||||
keystoreType=pkcs12
|
||||
keystoreProvider=SunJSSE
|
||||
|
||||
sslProtocol=TLS
|
||||
END_OF_FILE
|
||||
|
||||
# Create httpClientConfig.json file
|
||||
cat > /app/httpClientConfig.json <<END_OF_FILE
|
||||
{
|
||||
"maxConnectionsTotal":100,
|
||||
"maxConnectionsPerRoute":10,
|
||||
"truststoreType":"JKS",
|
||||
"truststoreProvider":"SUN",
|
||||
"truststoreFile":"file:$EXT_TRUSTSTORE_FILE",
|
||||
"truststorePass":"$EXT_TRUSTSTORE_PASSWORD",
|
||||
"keystoreType":"JKS",
|
||||
"keystoreProvider":"SUN",
|
||||
"keystoreFile":"file:$EXT_CLIENT_KEYSTORE_FILE",
|
||||
"keystorePass":"$EXT_CLIENT_KEYSTORE_PASSWORD",
|
||||
"keyAlias":"clientkeyalias",
|
||||
"credentialsList":[
|
||||
{"host":"localhost","port":-1,"user":"user","password":"password"}
|
||||
]
|
||||
|
||||
}
|
||||
END_OF_FILE
|
||||
|
||||
# Set environment for the opensync gateway process
|
||||
PROFILES=" -Dspring.profiles.include=mqtt_receiver,ovsdb_redirector,ovsdb_manager"
|
||||
|
||||
SSL_PROPS=" "
|
||||
SSL_PROPS="$SSL_PROPS -Dssl.props=file:/app/ssl.properties"
|
||||
SSL_PROPS="$SSL_PROPS -Dtip.wlan.httpClientConfig=file:/app/httpClientConfig.json"
|
||||
|
||||
CLIENT_MQTT_SSL_PROPS=" "
|
||||
CLIENT_MQTT_SSL_PROPS="$CLIENT_MQTT_SSL_PROPS -Djavax.net.ssl.keyStore=$MQTT_CLIENT_KEYSTORE_FILE"
|
||||
CLIENT_MQTT_SSL_PROPS="$CLIENT_MQTT_SSL_PROPS -Djavax.net.ssl.keyStorePassword=$MQTT_CLIENT_KEYSTORE_PASSWORD"
|
||||
CLIENT_MQTT_SSL_PROPS="$CLIENT_MQTT_SSL_PROPS -Djavax.net.ssl.trustStore=$MQTT_TRUSTSTORE_FILE"
|
||||
CLIENT_MQTT_SSL_PROPS="$CLIENT_MQTT_SSL_PROPS -Djavax.net.ssl.trustStorePassword=$MQTT_TRUSTSTORE_PASSWORD"
|
||||
|
||||
OVSDB_PROPS=" "
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dconnectus.ovsdb.managerAddr=$OVSDB_MANAGER_HOST"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dconnectus.ovsdb.listenPort=6640 "
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dconnectus.ovsdb.redirector.listenPort=6643"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dconnectus.ovsdb.timeoutSec=30"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dconnectus.ovsdb.trustStore=$OVSDB_SERVER_TRUSTSTORE_FILE"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dconnectus.ovsdb.trustStorePassword=$OVSDB_SERVER_TRUSTSTORE_PASSWORD"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dconnectus.ovsdb.keyStore=$OVSDB_SERVER_KEYSTORE_FILE"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dconnectus.ovsdb.keyStorePassword=$OVSDB_SERVER_KEYSTORE_PASSWORD"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dconnectus.ovsdb.configFileName=$OVSDB_CONFIG_FILE"
|
||||
|
||||
MQTT_PROPS=" "
|
||||
MQTT_PROPS="$MQTT_PROPS -Dconnectus.mqttBroker.address=$MQTT_BROKER_HOST"
|
||||
MQTT_PROPS="$MQTT_PROPS -Dconnectus.mqttBroker.listenPort=1883"
|
||||
|
||||
LOGGING_PROPS=" -Dlogging.config=file:$LOGBACK_CONFIG_FILE"
|
||||
|
||||
RESTAPI_PROPS=" "
|
||||
RESTAPI_PROPS="$RESTAPI_PROPS -Dserver.port=4043"
|
||||
|
||||
SPRING_EXTRA_PROPS=" --add-opens java.base/java.lang=ALL-UNNAMED"
|
||||
|
||||
export ALL_PROPS="$PROFILES $SSL_PROPS $CLIENT_MQTT_SSL_PROPS $OVSDB_PROPS $MQTT_PROPS $LOGGING_PROPS $RESTAPI_PROPS $SPRING_EXTRA_PROPS "
|
||||
|
||||
echo Starting opensync wifi controller
|
||||
|
||||
#echo Result: $ALL_PROPS
|
||||
java $ALL_PROPS -jar app.jar > /app/opensync-wifi-controller-stdout.out 2>&1
|
||||
|
||||
@@ -12,8 +12,19 @@ CLIENT_MQTT_SSL_PROPS+=" -Djavax.net.ssl.trustStore=/opt/tip-wlan/certs/truststo
|
||||
CLIENT_MQTT_SSL_PROPS+=" -Djavax.net.ssl.trustStorePassword=mypassword"
|
||||
CLIENT_MQTT_SSL_PROPS+=" -Dconnectus.mqttBroker.password=admin"
|
||||
|
||||
OVSDB_MANAGER_HOST=opensync-controller
|
||||
MQTT_BROKER_HOST=tip-wlan-opensync-mqtt-broke
|
||||
|
||||
BACKEND_SERVER="${BACKEND_SERVER}"
|
||||
|
||||
if [[ -n $BACKEND_SERVER ]]
|
||||
then
|
||||
OVSDB_MANAGER_HOST=$BACKEND_SERVER
|
||||
MQTT_BROKER_HOST=$BACKEND_SERVER
|
||||
fi
|
||||
|
||||
OVSDB_PROPS=" "
|
||||
OVSDB_PROPS+=" -Dconnectus.ovsdb.managerAddr=opensync-controller"
|
||||
OVSDB_PROPS+=" -Dconnectus.ovsdb.managerAddr=$OVSDB_MANAGER_HOST"
|
||||
OVSDB_PROPS+=" -Dconnectus.ovsdb.listenPort=6640 "
|
||||
OVSDB_PROPS+=" -Dconnectus.ovsdb.redirector.listenPort=6643"
|
||||
OVSDB_PROPS+=" -Dconnectus.ovsdb.timeoutSec=30"
|
||||
@@ -22,7 +33,7 @@ OVSDB_PROPS+=" -Dconnectus.ovsdb.keyStore=/opt/tip-wlan/certs/server.pkcs12"
|
||||
OVSDB_PROPS+=" -Dconnectus.ovsdb.configFileName=/app/opensync/config_2_ssids.json"
|
||||
|
||||
MQTT_PROPS=" "
|
||||
MQTT_PROPS+=" -Dconnectus.mqttBroker.address=tip-wlan-opensync-mqtt-broker"
|
||||
MQTT_PROPS+=" -Dconnectus.mqttBroker.address=$MQTT_BROKER_HOST"
|
||||
MQTT_PROPS+=" -Dconnectus.mqttBroker.listenPort=1883"
|
||||
|
||||
LOGGING_PROPS=" -Dlogging.config=file:/app/opensync/logback.xml"
|
||||
@@ -32,6 +43,28 @@ RESTAPI_PROPS+=" -Dserver.port=443"
|
||||
|
||||
SPRING_EXTRA_PROPS=" --add-opens java.base/java.lang=ALL-UNNAMED"
|
||||
|
||||
export ALL_PROPS="$PROFILES $SSL_PROPS $CLIENT_MQTT_SSL_PROPS $OVSDB_PROPS $MQTT_PROPS $LOGGING_PROPS $RESTAPI_PROPS $SPRING_EXTRA_PROPS"
|
||||
HOST_PROPS=" "
|
||||
if [[ -n $BACKEND_SERVER ]]
|
||||
then
|
||||
echo Use specifed local host
|
||||
HOST_PROPS+=" -Dtip.wlan.externalHostName=$BACKEND_SERVER"
|
||||
HOST_PROPS+=" -Dtip.wlan.internalHostName=$BACKEND_SERVER"
|
||||
HOST_PROPS+=" -Dtip.wlan.introspectTokenApi.host=${BACKEND_SERVER}:9091"
|
||||
|
||||
HOST_URL=https://${BACKEND_SERVER}:9092
|
||||
HOST_PROPS+=" -Dtip.wlan.cloudEventDispatcherBaseUrl=$HOST_URL"
|
||||
HOST_PROPS+=" -Dtip.wlan.statusServiceBaseUrl=$HOST_URL"
|
||||
HOST_PROPS+=" -Dtip.wlan.routingServiceBaseUrl=$HOST_URL"
|
||||
HOST_PROPS+=" -Dtip.wlan.alarmServiceBaseUrl=$HOST_URL"
|
||||
HOST_PROPS+=" -Dtip.wlan.customerServiceBaseUrl=$HOST_URL"
|
||||
HOST_PROPS+=" -Dtip.wlan.locationServiceBaseUrl=$HOST_URL"
|
||||
HOST_PROPS+=" -Dtip.wlan.equipmentServiceBaseUrl=$HOST_URL"
|
||||
HOST_PROPS+=" -Dtip.wlan.profileServiceBaseUrl=$HOST_URL"
|
||||
HOST_PROPS+=" -Dtip.wlan.clientServiceBaseUrl=$HOST_URL"
|
||||
fi
|
||||
#echo HOST_PROPS $HOST_PROPS
|
||||
|
||||
|
||||
export ALL_PROPS="$PROFILES $SSL_PROPS $CLIENT_MQTT_SSL_PROPS $OVSDB_PROPS $MQTT_PROPS $LOGGING_PROPS $RESTAPI_PROPS $SPRING_EXTRA_PROPS $HOST_PROPS"
|
||||
|
||||
java $ALL_PROPS -jar app.jar
|
||||
Reference in New Issue
Block a user