aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-10-31 01:32:13 +0300
committerGravatar Vitaly Takmazov2017-10-31 01:32:46 +0300
commit20e19b4242f888aafe3c55f9dabe3af46728cbab (patch)
treef6733154952d2ddca5435cfc900369df26114a0f
parent240a375ecdeb7592d8765f0edb7d2fd67c50ac10 (diff)
gradle: farm configuration
-rw-r--r--build.gradle12
-rw-r--r--juick-api/build.gradle2
-rw-r--r--juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java4
-rw-r--r--juick-ws/build.gradle2
-rw-r--r--juick-www/build.gradle2
-rw-r--r--juick-xmpp-wip/build.gradle2
-rw-r--r--juick-xmpp-wip/src/main/java/com/juick/components/XMPPRouter.java2
-rw-r--r--juick-xmpp-wip/src/main/java/com/juick/components/controllers/StatusController.java12
-rw-r--r--juick-xmpp-wip/src/main/java/com/juick/components/controllers/helpers/RouterStatus.java17
-rw-r--r--juick-xmpp/build.gradle2
10 files changed, 45 insertions, 12 deletions
diff --git a/build.gradle b/build.gradle
index 4aba164f..37ab8e8f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -42,6 +42,18 @@ buildscript {
}
}
apply plugin: 'java'
+apply plugin: 'org.akhikhl.gretty'
+
+farm {
+ webapp ':juick-xmpp-wip'
+ webapp ':juick-ws'
+ webapp ':juick-www'
+ webapp ':juick-xmpp'
+ webapp ':juick-api'
+
+
+ servletContainer = 'tomcat8'
+}
repositories {
jcenter()
diff --git a/juick-api/build.gradle b/juick-api/build.gradle
index 2d80576f..608d4afb 100644
--- a/juick-api/build.gradle
+++ b/juick-api/build.gradle
@@ -32,7 +32,7 @@ compileJava.options.encoding = 'UTF-8'
gretty {
httpPort = 8080
- contextPath = '/'
+ contextPath = '/api'
servletContainer = 'tomcat8'
}
diff --git a/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java b/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java
index c78ea51a..f51528bf 100644
--- a/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java
+++ b/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java
@@ -22,6 +22,7 @@ import com.juick.api.TelegramBotManager;
import com.juick.server.configuration.BaseWebConfiguration;
import com.juick.service.ImagesService;
import com.juick.service.ImagesServiceImpl;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.*;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
@@ -53,7 +54,8 @@ public class ApiAppConfiguration extends BaseWebConfiguration {
@Inject
TelegramBotManager telegramBotManager;
- private static final String WS_URI = "wss://ws.juick.com/";
+ @Value("${websocket_url:ws://localhost:8080/ws/}")
+ private String WS_URI;
@Bean
public WebSocketConnectionManager connectionManager() {
diff --git a/juick-ws/build.gradle b/juick-ws/build.gradle
index 253c2dcc..4683f3f9 100644
--- a/juick-ws/build.gradle
+++ b/juick-ws/build.gradle
@@ -12,7 +12,7 @@ compileJava.options.encoding = 'UTF-8'
gretty {
httpPort = 8080
- contextPath = ''
+ contextPath = '/ws'
servletContainer = 'tomcat8'
}
diff --git a/juick-www/build.gradle b/juick-www/build.gradle
index 91d48c80..43ce83b6 100644
--- a/juick-www/build.gradle
+++ b/juick-www/build.gradle
@@ -44,7 +44,7 @@ compileJava.options.encoding = 'UTF-8'
gretty {
httpPort = 8080
- contextPath = ''
+ contextPath = '/'
servletContainer = 'tomcat8'
}
diff --git a/juick-xmpp-wip/build.gradle b/juick-xmpp-wip/build.gradle
index 13c564b3..cf8b8a29 100644
--- a/juick-xmpp-wip/build.gradle
+++ b/juick-xmpp-wip/build.gradle
@@ -17,7 +17,7 @@ compileJava.options.encoding = 'UTF-8'
gretty {
httpPort = 8080
- contextPath = ''
+ contextPath = '/router'
servletContainer = 'tomcat8'
}
diff --git a/juick-xmpp-wip/src/main/java/com/juick/components/XMPPRouter.java b/juick-xmpp-wip/src/main/java/com/juick/components/XMPPRouter.java
index a39358c5..47e76cd8 100644
--- a/juick-xmpp-wip/src/main/java/com/juick/components/XMPPRouter.java
+++ b/juick-xmpp-wip/src/main/java/com/juick/components/XMPPRouter.java
@@ -163,7 +163,7 @@ public class XMPPRouter implements Message.MessageListener, AutoCloseable, Strea
}
- private List<StreamComponentServer> getConnections() {
+ public List<StreamComponentServer> getConnections() {
return connections;
}
diff --git a/juick-xmpp-wip/src/main/java/com/juick/components/controllers/StatusController.java b/juick-xmpp-wip/src/main/java/com/juick/components/controllers/StatusController.java
index 350669b8..e57d0a82 100644
--- a/juick-xmpp-wip/src/main/java/com/juick/components/controllers/StatusController.java
+++ b/juick-xmpp-wip/src/main/java/com/juick/components/controllers/StatusController.java
@@ -17,8 +17,8 @@
package com.juick.components.controllers;
-import com.juick.components.XMPPBot;
-import com.juick.Status;
+import com.juick.components.XMPPRouter;
+import com.juick.components.controllers.helpers.RouterStatus;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -34,10 +34,12 @@ import javax.inject.Inject;
@ResponseBody
public class StatusController {
@Inject
- private XMPPBot xmpp;
+ private XMPPRouter router;
@RequestMapping(method = RequestMethod.GET, value = "/", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
- public Status status() {
- return xmpp != null ? Status.OK : Status.ERROR;
+ public RouterStatus status() {
+ RouterStatus status = new RouterStatus();
+ status.setConnections(router.getConnections());
+ return status;
}
}
diff --git a/juick-xmpp-wip/src/main/java/com/juick/components/controllers/helpers/RouterStatus.java b/juick-xmpp-wip/src/main/java/com/juick/components/controllers/helpers/RouterStatus.java
new file mode 100644
index 00000000..11148dd7
--- /dev/null
+++ b/juick-xmpp-wip/src/main/java/com/juick/components/controllers/helpers/RouterStatus.java
@@ -0,0 +1,17 @@
+package com.juick.components.controllers.helpers;
+
+import com.juick.xmpp.StreamComponentServer;
+
+import java.util.List;
+
+public class RouterStatus {
+ private List<StreamComponentServer> connections;
+
+ public List<StreamComponentServer> getConnections() {
+ return connections;
+ }
+
+ public void setConnections(List<StreamComponentServer> connections) {
+ this.connections = connections;
+ }
+}
diff --git a/juick-xmpp/build.gradle b/juick-xmpp/build.gradle
index e132d16f..791db3f5 100644
--- a/juick-xmpp/build.gradle
+++ b/juick-xmpp/build.gradle
@@ -18,7 +18,7 @@ compileJava.options.encoding = 'UTF-8'
gretty {
httpPort = 8080
- contextPath = ''
+ contextPath = '/s2s'
servletContainer = 'tomcat8'
}