From db827e7d43924e035f51add4a489bf490ca46a95 Mon Sep 17 00:00:00 2001 From: Rahul Sharma Date: Tue, 10 Mar 2020 15:24:18 -0400 Subject: [PATCH] TW-144: Create Docker container for Opensync-gateway process This task deals with creating the docker container for Opensync-gateway process --- opensync-gateway-static-process/pom.xml | 97 +++++++++++++++---- .../src/main/docker/Dockerfile | 17 ++++ .../docker/app/opensync/config_2_ssids.json | 27 ++++++ .../src/main/docker/app/opensync/logback.xml | 76 +++++++++++++++ .../src/main/{resources => docker/app}/run.sh | 20 ++-- .../src/main/docker/app/stdout.out | 1 + 6 files changed, 211 insertions(+), 27 deletions(-) create mode 100644 opensync-gateway-static-process/src/main/docker/Dockerfile create mode 100644 opensync-gateway-static-process/src/main/docker/app/opensync/config_2_ssids.json create mode 100644 opensync-gateway-static-process/src/main/docker/app/opensync/logback.xml rename opensync-gateway-static-process/src/main/{resources => docker/app}/run.sh (56%) mode change 100644 => 100755 create mode 100644 opensync-gateway-static-process/src/main/docker/app/stdout.out diff --git a/opensync-gateway-static-process/pom.xml b/opensync-gateway-static-process/pom.xml index 5a8e68f..91a0dd8 100644 --- a/opensync-gateway-static-process/pom.xml +++ b/opensync-gateway-static-process/pom.xml @@ -1,19 +1,21 @@ - 4.0.0 - - com.telecominfraproject.wlan - tip-wlan-cloud-root-pom - 0.0.1-SNAPSHOT - ../../tip-wlan-cloud-root - - opensync-gateway-static-process - opensync-gateway-static-process - Process definition for opensync gateway that uses static configuration - - - com.telecominfraproject.wlan.opensync.experiment.OpenSyncProcess + 4.0.0 + + com.telecominfraproject.wlan + tip-wlan-cloud-root-pom + 0.0.1-SNAPSHOT + ../../tip-wlan-cloud-root + + opensync-gateway-static-process + opensync-gateway-static-process + Process definition for opensync gateway that uses static configuration + + + com.telecominfraproject.wlan.opensync.experiment.OpenSyncProcess + 0.28.0 + ec2-54-80-163-0.compute-1.amazonaws.com:5000 - + com.telecominfraproject.wlan @@ -25,16 +27,77 @@ opensync-ext-static ${tip-wlan-cloud.release.version} - + - - + + org.springframework.boot spring-boot-maven-plugin + + io.fabric8 + docker-maven-plugin + ${docker.fabric.version} + + true + 1.23 + + + opensync_gateway:${project.version} + + + @ + try + ${project.basedir}/src/main/docker + Dockerfile + + + + + + com.telecominfraproject.wlan:opensync-gateway-static-process + + app.jar + + + + + + + + + + + clean-images + pre-clean + + remove + + + true + + + + generate-images + package + + build + + + + push-images + deploy + + push + + + + + + diff --git a/opensync-gateway-static-process/src/main/docker/Dockerfile b/opensync-gateway-static-process/src/main/docker/Dockerfile new file mode 100644 index 0000000..356e942 --- /dev/null +++ b/opensync-gateway-static-process/src/main/docker/Dockerfile @@ -0,0 +1,17 @@ +FROM openjdk:13-alpine +MAINTAINER ConnectUs + +# Update the package list and upgrade installed packages +RUN apk update && apk upgrade && apk add bash +RUN mkdir /app && mkdir /app/logs && mkdir /app/opensync +RUN mkdir -p /opt/tip-wlan/certs + +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 + +RUN chmod +x /app/run.sh + +WORKDIR /app +CMD ["/app/run.sh"] \ No newline at end of file diff --git a/opensync-gateway-static-process/src/main/docker/app/opensync/config_2_ssids.json b/opensync-gateway-static-process/src/main/docker/app/opensync/config_2_ssids.json new file mode 100644 index 0000000..6486caf --- /dev/null +++ b/opensync-gateway-static-process/src/main/docker/app/opensync/config_2_ssids.json @@ -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 + } ] +} diff --git a/opensync-gateway-static-process/src/main/docker/app/opensync/logback.xml b/opensync-gateway-static-process/src/main/docker/app/opensync/logback.xml new file mode 100644 index 0000000..a7ac837 --- /dev/null +++ b/opensync-gateway-static-process/src/main/docker/app/opensync/logback.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + %d{yyyy-MM-DD HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + /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-static-process/src/main/resources/run.sh b/opensync-gateway-static-process/src/main/docker/app/run.sh old mode 100644 new mode 100755 similarity index 56% rename from opensync-gateway-static-process/src/main/resources/run.sh rename to opensync-gateway-static-process/src/main/docker/app/run.sh index eedbcb2..a7e4bc9 --- a/opensync-gateway-static-process/src/main/resources/run.sh +++ b/opensync-gateway-static-process/src/main/docker/app/run.sh @@ -1,27 +1,28 @@ +#!/bin/bash PROFILES=" -Dspring.profiles.include=mqtt_receiver,ovsdb_redirector,ovsdb_manager" SSL_PROPS=" " -SSL_PROPS+=" -Dssl.props=file:/app/certs/ssl.properties" -SSL_PROPS+=" -Dwhizcontrol.httpClientConfig=file:/app/certs/httpClientConfig.json" +SSL_PROPS+=" -Dssl.props=file:/opt/tip-wlan/certs/ssl.properties" +SSL_PROPS+=" -Dwhizcontrol.httpClientConfig=file:/opt/tip-wlan/certs/httpClientConfig.json" CLIENT_MQTT_SSL_PROPS=" " -CLIENT_MQTT_SSL_PROPS+=" -Djavax.net.ssl.keyStore=/app/certs/client_keystore.jks" +CLIENT_MQTT_SSL_PROPS+=" -Djavax.net.ssl.keyStore=/opt/tip-wlan/certs/client_keystore.jks" CLIENT_MQTT_SSL_PROPS+=" -Djavax.net.ssl.keyStorePassword=mypassword" -CLIENT_MQTT_SSL_PROPS+=" -Djavax.net.ssl.trustStore=/app/certs/truststore.jks" +CLIENT_MQTT_SSL_PROPS+=" -Djavax.net.ssl.trustStore=/opt/tip-wlan/certs/truststore.jks" CLIENT_MQTT_SSL_PROPS+=" -Djavax.net.ssl.trustStorePassword=mypassword" CLIENT_MQTT_SSL_PROPS+=" -Dconnectus.mqttBroker.password=admin" OVSDB_PROPS=" " -OVSDB_PROPS+=" -Dconnectus.ovsdb.managerAddr=________" +OVSDB_PROPS+=" -Dconnectus.ovsdb.managerAddr=opensync-controller" OVSDB_PROPS+=" -Dconnectus.ovsdb.listenPort=6640 " OVSDB_PROPS+=" -Dconnectus.ovsdb.redirector.listenPort=6643" OVSDB_PROPS+=" -Dconnectus.ovsdb.timeoutSec=30" -OVSDB_PROPS+=" -Dconnectus.ovsdb.trustStore=/app/certs/truststore.jks" -OVSDB_PROPS+=" -Dconnectus.ovsdb.keyStore=/app/certs/server.pkcs12" +OVSDB_PROPS+=" -Dconnectus.ovsdb.trustStore=/opt/tip-wlan/certs/truststore.jks" +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=_________" +MQTT_PROPS+=" -Dconnectus.mqttBroker.address=opensync-wifi-controller-opensync-mqtt-broker" MQTT_PROPS+=" -Dconnectus.mqttBroker.listenPort=1883" LOGGING_PROPS=" -Dlogging.config=file:/app/opensync/logback.xml" @@ -31,5 +32,4 @@ RESTAPI_PROPS+=" -Dserver.port=443" export ALL_PROPS="$PROFILES $SSL_PROPS $CLIENT_MQTT_SSL_PROPS $OVSDB_PROPS $MQTT_PROPS $LOGGING_PROPS $RESTAPI_PROPS " -sudo java $ALL_PROPS -jar opensync-gateway-static-process-0.0.1-SNAPSHOT.jar > stdout.out 2>&1 & - +java $ALL_PROPS -jar app.jar \ No newline at end of file diff --git a/opensync-gateway-static-process/src/main/docker/app/stdout.out b/opensync-gateway-static-process/src/main/docker/app/stdout.out new file mode 100644 index 0000000..ef3e48a --- /dev/null +++ b/opensync-gateway-static-process/src/main/docker/app/stdout.out @@ -0,0 +1 @@ +sudo: unable to read password: Input/output error