mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-10-29 09:42:19 +00:00
TW-120 Added a docker image that has mqtt broker and opensync gateway. Corrected warnings generated by the pom.xml during maven build.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -21,5 +21,6 @@ build.log
|
||||
|
||||
## Binaries
|
||||
*.tar.gz
|
||||
*.jar
|
||||
|
||||
*.pydevproject
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<relativePath>../../tip-wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>opensync-gateway-static-docker</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>opensync-gateway-static-docker</name>
|
||||
<description>Docker definition for opensync gateway that uses static configuration</description>
|
||||
|
||||
@@ -35,8 +36,7 @@
|
||||
<apiVersion>1.23</apiVersion>
|
||||
<images>
|
||||
<image>
|
||||
<name>opensync_gateway:${project.version}
|
||||
</name>
|
||||
<name>opensync-gateway:${project.version}</name>
|
||||
<build>
|
||||
<filter>@</filter>
|
||||
<cleanup>try</cleanup>
|
||||
@@ -47,8 +47,9 @@
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<includes>
|
||||
<include>com.telecominfraproject.wlan:opensync-gateway-static-process</include>
|
||||
<include>com.telecominfraproject.wlan:opensync-gateway-static-process:jar</include>
|
||||
</includes>
|
||||
<useProjectArtifact>false</useProjectArtifact>
|
||||
<outputFileNameMapping>app.jar</outputFileNameMapping>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
@@ -56,6 +57,28 @@
|
||||
</assembly>
|
||||
</build>
|
||||
</image>
|
||||
<image>
|
||||
<name>opensync-gateway-and-mqtt:${project.version}</name>
|
||||
<build>
|
||||
<filter>@</filter>
|
||||
<cleanup>try</cleanup>
|
||||
<dockerFileDir>${project.basedir}/src/main/docker-opensync-gateway-and-mqtt</dockerFileDir>
|
||||
<dockerFile>Dockerfile</dockerFile>
|
||||
<assembly>
|
||||
<inline>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<includes>
|
||||
<include>com.telecominfraproject.wlan:opensync-gateway-static-process:jar</include>
|
||||
</includes>
|
||||
<useProjectArtifact>false</useProjectArtifact>
|
||||
<outputFileNameMapping>app.jar</outputFileNameMapping>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</inline>
|
||||
</assembly>
|
||||
</build>
|
||||
</image>
|
||||
</images>
|
||||
</configuration>
|
||||
<executions>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
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 \
|
||||
a statically configured 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
|
||||
COPY maven/app.jar /app
|
||||
COPY app/opensync/logback.xml /app/opensync/logback.xml
|
||||
COPY app/run.sh /app
|
||||
COPY app/opensync/config_2_ssids.json /app/opensync/config_2_ssids.json
|
||||
VOLUME ["/app/logs"]
|
||||
|
||||
RUN chmod +x /app/run.sh
|
||||
|
||||
EXPOSE 1883 6640 6643 4043
|
||||
|
||||
WORKDIR /app
|
||||
ENTRYPOINT ["/app/run.sh"]
|
||||
CMD [""]
|
||||
@@ -0,0 +1,18 @@
|
||||
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
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"_type" : "OpensyncAPConfig",
|
||||
"radioConfig" : {
|
||||
"_type" : "OpensyncAPRadioConfig",
|
||||
"country" : "CA",
|
||||
"radioChannel24G" : 1,
|
||||
"radioChannel5LG" : 44,
|
||||
"radioChannel5HG" : 108
|
||||
},
|
||||
"ssidConfigs" : [ {
|
||||
"_type" : "OpensyncAPSsidConfig",
|
||||
"radioType" : "is2dot4GHz",
|
||||
"ssid" : "Connectus-local",
|
||||
"encryption" : "WPA-PSK",
|
||||
"key" : "12345678",
|
||||
"mode" : "2",
|
||||
"broadcast" : true
|
||||
}, {
|
||||
"_type" : "OpensyncAPSsidConfig",
|
||||
"radioType" : "is5GHz",
|
||||
"ssid" : "Connectus-local-5",
|
||||
"encryption" : "WPA-PSK",
|
||||
"key" : "12345678",
|
||||
"mode" : "2",
|
||||
"broadcast" : true
|
||||
} ]
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,122 @@
|
||||
#!/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}"
|
||||
|
||||
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 -Dwhizcontrol.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"
|
||||
|
||||
export ALL_PROPS="$PROFILES $SSL_PROPS $CLIENT_MQTT_SSL_PROPS $OVSDB_PROPS $MQTT_PROPS $LOGGING_PROPS $RESTAPI_PROPS "
|
||||
|
||||
echo Starting opensync wifi controller
|
||||
|
||||
#echo Result: $ALL_PROPS
|
||||
java $ALL_PROPS -jar app.jar > /app/opensync-wifi-controller-stdout.out 2>&1
|
||||
|
||||
Reference in New Issue
Block a user