diff --git a/opensync-gateway-cloud-docker/src/main/docker-opensync-gateway-and-mqtt/Dockerfile b/opensync-gateway-cloud-docker/src/main/docker-opensync-gateway-and-mqtt/Dockerfile deleted file mode 100644 index 258678d..0000000 --- a/opensync-gateway-cloud-docker/src/main/docker-opensync-gateway-and-mqtt/Dockerfile +++ /dev/null @@ -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 [""] diff --git a/opensync-gateway-cloud-docker/src/main/docker-opensync-gateway-and-mqtt/app/mqtt/mosquitto.conf b/opensync-gateway-cloud-docker/src/main/docker-opensync-gateway-and-mqtt/app/mqtt/mosquitto.conf deleted file mode 100644 index 8682fc8..0000000 --- a/opensync-gateway-cloud-docker/src/main/docker-opensync-gateway-and-mqtt/app/mqtt/mosquitto.conf +++ /dev/null @@ -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 - diff --git a/opensync-gateway-cloud-docker/src/main/docker-opensync-gateway-and-mqtt/app/opensync/logback.xml b/opensync-gateway-cloud-docker/src/main/docker-opensync-gateway-and-mqtt/app/opensync/logback.xml deleted file mode 100644 index e5fde1f..0000000 --- a/opensync-gateway-cloud-docker/src/main/docker-opensync-gateway-and-mqtt/app/opensync/logback.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - /app/logs/mqttData.log - true - - %date %msg%n - - - /app/logs/mqttData.%i.log.gz - 1 - 3 - - - 20MB - - - - - - /app/logs/opensyncgw.log - true - - %date %level [%thread] %logger{36} [%file:%line] %msg%n - - - /app/logs/opensyncgw.%i.log.gz - 1 - 3 - - - 20MB - - - - - - - - - - - - - - - - - - - - - - - diff --git a/opensync-gateway-cloud-docker/src/main/docker-opensync-gateway-and-mqtt/app/run.sh b/opensync-gateway-cloud-docker/src/main/docker-opensync-gateway-and-mqtt/app/run.sh deleted file mode 100755 index bed8f1a..0000000 --- a/opensync-gateway-cloud-docker/src/main/docker-opensync-gateway-and-mqtt/app/run.sh +++ /dev/null @@ -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 < /app/httpClientConfig.json < /app/opensync-wifi-controller-stdout.out 2>&1 - diff --git a/opensync-gateway-cloud-docker/src/main/docker/app/run.sh b/opensync-gateway-cloud-docker/src/main/docker/app/run.sh index 67acbde..098e716 100755 --- a/opensync-gateway-cloud-docker/src/main/docker/app/run.sh +++ b/opensync-gateway-cloud-docker/src/main/docker/app/run.sh @@ -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 \ No newline at end of file