Extend cloud components configuration - reverify 31/25531/3
authorOndrej Tomcik <ondrej.tomcik@kistler.com>
Wed, 30 May 2018 05:55:04 +0000 (07:55 +0200)
committerOndrej Tomcik <ondrej.tomcik@kistler.com>
Tue, 26 Jun 2018 09:26:44 +0000 (09:26 +0000)
Change-Id: Icc70ed42fb622e5f133aa0874427489ddcf05c2b
Signed-off-by: Ondrej Tomcik <ondrej.tomcik@kistler.com>
cloud/account/Dockerfile
cloud/account/src/main/java/org/iotivity/cloud/accountserver/AccountServer.java
cloud/interface/Dockerfile
cloud/interface/src/main/java/org/iotivity/cloud/ciserver/CloudInterfaceServer.java
cloud/messagequeue/Dockerfile
cloud/messagequeue/src/main/java/org/iotivity/cloud/mqserver/MessageQueueServer.java
cloud/resourcedirectory/Dockerfile
cloud/resourcedirectory/src/main/java/org/iotivity/cloud/rdserver/ResourceDirectoryServer.java

index 270160e..a4d5177 100644 (file)
@@ -1,4 +1,4 @@
-FROM openjdk:8-jre
+FROM openjdk:8-jre-alpine
 
 ADD ./target/CloudAccount-0.0.1-SNAPSHOT.jar iotivity/AccountServer.jar
 ADD ./target/lib/* iotivity/lib/
@@ -6,9 +6,9 @@ ADD ./properties/* iotivity/properties/
 
 WORKDIR iotivity/
 
-ENV TLS_MODE=0
-ENV MONGODB_ADDRESS=mongodb
-ENV MONGODB_PORT=27017
+ENV COAP_PORT 5685
+ENV TLS_MODE 0
+ENV MONGODB_ADDRESS mongodb
+ENV MONGODB_PORT 27017
 
-EXPOSE 5685
-ENTRYPOINT ["java", "-jar", "AccountServer.jar"]
+ENTRYPOINT ["java", "-jar", "AccountServer.jar"]
\ No newline at end of file
index 220e058..8e14660 100644 (file)
@@ -115,7 +115,7 @@ public class AccountServer {
         String tlsModeEnv = System.getenv("TLS_MODE");
         if (tlsModeEnv != null) {
 
-            coapServerPort = Constants.DEFAULT_COAP_PORT;
+            coapServerPort = Integer.parseInt(System.getenv("COAP_PORT"));
             databaseHost = System.getenv("MONGODB_ADDRESS") + ":"
                     + System.getenv("MONGODB_PORT");
             tlsMode = Integer.parseInt(tlsModeEnv) == 1;
index 9926069..5f06b91 100644 (file)
@@ -1,18 +1,20 @@
-FROM openjdk:8-jre
+FROM openjdk:8-jre-alpine
 
 ADD ./target/CloudInterface-0.0.1-SNAPSHOT.jar iotivity/CloudInterface.jar
 ADD ./target/lib/* iotivity/lib/
 
 WORKDIR iotivity/
 
-ENV TLS_MODE=0
-ENV KEEPALIVE_CLOUD=1
-ENV HC_PROXY_MODE=0
-ENV WEBSOCKET_MODE=0
+ENV COAP_PORT 5683
+ENV TLS_MODE 0
+ENV KEEPALIVE_CLOUD 1
+ENV HC_PROXY_MODE 0
+ENV WEBSOCKET_MODE 0
 ENV RESOURCE_DIRECTORY_ADDRESS iotivity-resourcedirectory
+ENV RESOURCE_DIRECTORY_PORT 5684
 ENV ACCOUNT_SERVER_ADDRESS iotivity-accountserver
+ENV ACCOUNT_SERVER_PORT 5685
 ENV MESSAGE_QUEUE_ADDRESS iotivity-messagequeue
+ENV MESSAGE_QUEUE_PORT 5686
 
-EXPOSE 5683
-EXPOSE 80
-ENTRYPOINT ["java", "-jar", "CloudInterface.jar"]
+ENTRYPOINT ["java", "-jar", "CloudInterface.jar"]
\ No newline at end of file
index 5699b31..158b637 100644 (file)
@@ -47,6 +47,7 @@ import org.iotivity.cloud.util.Log;
 
 public class CloudInterfaceServer {
 
+    private static int[]   deviceKeepAliveMinutes = new int[] { 1, 2, 4, 8 };
     private static int     coapServerPort;
     private static boolean tlsMode;
     private static boolean keepAlive = false;
@@ -132,8 +133,7 @@ public class CloudInterfaceServer {
 
         deviceServer.addResource(crlHandler);
 
-        KeepAliveResource resKeepAlive = new KeepAliveResource(
-                new int[] { 1, 2, 4, 8 });
+        KeepAliveResource resKeepAlive = new KeepAliveResource(deviceKeepAliveMinutes);
 
         deviceServer.addResource(resKeepAlive);
 
@@ -197,22 +197,24 @@ public class CloudInterfaceServer {
         // configuration provided by docker env
         String tlsModeEnv = System.getenv("TLS_MODE");
         if (tlsModeEnv != null) {
-            coapServerPort = Constants.DEFAULT_COAP_PORT;
+            coapServerPort = Integer.parseInt(System.getenv("COAP_PORT"));
             resourceDirectoryAddress = System.getenv("RESOURCE_DIRECTORY_ADDRESS");
-            resourceDirectoryPort = Constants.DEFAULT_RESOURCE_DIRECTORY_PORT;
+            resourceDirectoryPort = Integer.parseInt(System.getenv("RESOURCE_DIRECTORY_PORT"));
             accountServerAddress = System.getenv("ACCOUNT_SERVER_ADDRESS");
-            accountServerPort = Constants.DEFAULT_ACCOUNT_SERVER_PORT;
+            accountServerPort = Integer.parseInt(System.getenv("ACCOUNT_SERVER_PORT"));
             messageQueueAddress = System.getenv("MESSAGE_QUEUE_ADDRESS");
-            messageQueuePort = Constants.DEFAULT_MESSAGE_QUEUE_PORT;
+            messageQueuePort = Integer.parseInt(System.getenv("MESSAGE_QUEUE_PORT"));
             hcProxyMode = Integer.parseInt(System.getenv("HC_PROXY_MODE")) == 1;
             hcProxyPort = Constants.DEFAULT_HC_PROXY_PORT;
             websocketMode = Integer.parseInt(System.getenv("WEBSOCKET_MODE")) == 1;
             websocketPort = Constants.DEFAULT_WEBSOCKET_PORT;
             keepAlive = Integer.parseInt(System.getenv("KEEPALIVE_CLOUD")) == 1;
             tlsMode = Integer.parseInt(tlsModeEnv) == 1;
-
+            String keepAliveEnv = System.getenv("DEVICE_KEEPALIVE_MINUTES");
+            if (keepAliveEnv != null && !keepAliveEnv.isEmpty())
+                deviceKeepAliveMinutes = new int[] { Integer.parseInt(keepAliveEnv) };
             return true;
         }
         return false;
     }
-}
+}
\ No newline at end of file
index c8943df..61e4818 100644 (file)
@@ -1,15 +1,15 @@
-FROM openjdk:8-jre
+FROM openjdk:8-jre-alpine
 
 ADD ./target/CloudMessageQueue-0.0.1-SNAPSHOT.jar iotivity/MessageQueue.jar
 ADD ./target/lib/* iotivity/lib/
 
 WORKDIR iotivity/
 
-ENV TLS_MODE=0
+ENV COAP_PORT 5686
+ENV TLS_MODE 0
 ENV ZOOKEEPER_ADDRESS kafka-zookeeper
 ENV ZOOKEEPER_PORT 2181
 ENV KAFKA_ADDRESS kafka-zookeeper
 ENV KAFKA_PORT 9092
 
-EXPOSE 5686
 ENTRYPOINT ["java", "-jar", "MessageQueue.jar"]
\ No newline at end of file
index b3ce4a9..3b1fac1 100644 (file)
@@ -95,7 +95,7 @@ public class MessageQueueServer {
         // configuration provided by docker env
         String tlsModeEnv = System.getenv("TLS_MODE");
         if (tlsModeEnv != null) {
-            coapServerPort = Constants.DEFAULT_COAP_PORT;
+            coapServerPort = Integer.parseInt(System.getenv("COAP_PORT"));
             tlsMode = Integer.parseInt(tlsModeEnv) == 1;
             zookeeperHost = System.getenv("ZOOKEEPER_ADDRESS") + ":"
                     + System.getenv("ZOOKEEPER_PORT");
index 04d7005..d778ea4 100644 (file)
@@ -1,13 +1,13 @@
-FROM openjdk:8-jre
+FROM openjdk:8-jre-alpine
 
 ADD ./target/CloudResourceDirectory-0.0.1-SNAPSHOT.jar iotivity/ResourceDirectory.jar
 ADD ./target/lib/* iotivity/lib/
 
 WORKDIR iotivity/
 
-ENV TLS_MODE=0
+ENV COAP_PORT 5684
+ENV TLS_MODE 0
 ENV MONGODB_ADDRESS mongodb
 ENV MONGODB_PORT 27017
 
-EXPOSE 5684
 ENTRYPOINT ["java", "-jar", "ResourceDirectory.jar"]
\ No newline at end of file
index 0d0bcef..5667694 100644 (file)
@@ -103,7 +103,7 @@ public class ResourceDirectoryServer {
         // configuration provided by docker env
         String tlsModeEnv = System.getenv("TLS_MODE");
         if (tlsModeEnv != null) {
-            coapServerPort = Constants.DEFAULT_COAP_PORT;
+            coapServerPort = Integer.parseInt(System.getenv("COAP_PORT"));
             databaseHost = System.getenv("MONGODB_ADDRESS") + ":"
                     + System.getenv("MONGODB_PORT");
             tlsMode = Integer.parseInt(tlsModeEnv) == 1;