Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Yarn
### Run
./bin/zeppelin-daemon.sh start

browse localhost:8080 in your browser. 8081 port should be accessible for websocket connection.
browse localhost:8080 in your browser.


For configuration details check __./conf__ subdirectory.
Expand Down
17 changes: 1 addition & 16 deletions conf/zeppelin-site.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,7 @@
<property>
<name>zeppelin.server.port</name>
<value>8080</value>
<description>Server port. port+1 is used for web socket.</description>
</property>

<property>
<name>zeppelin.websocket.addr</name>
<value>0.0.0.0</value>
<description>Testing websocket address</description>
</property>

<!-- If the port value is negative, then it'll default to the server
port + 1.
-->
<property>
<name>zeppelin.websocket.port</name>
<value>-1</value>
<description>Testing websocket port</description>
<description>Server port.</description>
</property>

<property>
Expand Down
22 changes: 3 additions & 19 deletions zeppelin-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@
<version>${cxf.version}</version>
</dependency>

<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>1.3.0</version>
</dependency>

<!-- Swagger -->
<dependency>
<groupId>com.wordnik</groupId>
Expand Down Expand Up @@ -297,19 +291,9 @@
</dependency>

<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-jersey</artifactId>
<version>2.2.0</version>
<exclusions>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
</exclusion>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</exclusion>
</exclusions>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>1.13</version>
</dependency>

<dependency>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import javax.net.ssl.SSLContext;
import javax.servlet.DispatcherType;
import javax.servlet.Servlet;
import javax.ws.rs.core.Application;

import org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet;
Expand All @@ -40,13 +41,14 @@
import org.apache.zeppelin.rest.ZeppelinRestApi;
import org.apache.zeppelin.scheduler.SchedulerFactory;
import org.apache.zeppelin.socket.NotebookServer;
import org.apache.zeppelin.socket.SslWebSocketServerFactory;
import org.eclipse.jetty.server.AbstractConnector;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.bio.SocketConnector;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.server.session.SessionHandler;
import org.eclipse.jetty.server.ssl.SslSocketConnector;
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.FilterHolder;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
Expand Down Expand Up @@ -83,8 +85,6 @@ public static void main(String[] args) throws Exception {
conf.setProperty("args", args);

jettyServer = setupJettyServer(conf);
notebookServer = setupNotebookServer(conf);
notebookServer.start();

// REST api
final ServletContextHandler restApi = setupRestApiContextHandler();
Expand All @@ -93,17 +93,18 @@ public static void main(String[] args) throws Exception {
*/
final ServletContextHandler swagger = setupSwaggerContextHandler(conf);

// Notebook server
final ServletContextHandler notebook = setupNotebookServer(conf);

// Web UI
LOG.info("Create zeppelin websocket on {}:{}", notebookServer.getAddress()
.getAddress(), notebookServer.getPort());
final WebAppContext webApp = setupWebAppContext(conf, notebookServer.getPort());
final WebAppContext webApp = setupWebAppContext(conf);
//Below is commented since zeppelin-docs module is removed.
//final WebAppContext webAppSwagg = setupWebAppSwagger(conf);

// add all handlers
ContextHandlerCollection contexts = new ContextHandlerCollection();
//contexts.setHandlers(new Handler[]{swagger, restApi, webApp, webAppSwagg});
contexts.setHandlers(new Handler[]{swagger, restApi, webApp});
contexts.setHandlers(new Handler[]{swagger, restApi, notebook, webApp});
jettyServer.setHandler(contexts);

LOG.info("Start zeppelin server");
Expand All @@ -114,10 +115,7 @@ public static void main(String[] args) throws Exception {
@Override public void run() {
LOG.info("Shutting down Zeppelin Server ... ");
try {
notebook.getInterpreterFactory().close();

jettyServer.stop();
notebookServer.stop();
} catch (Exception e) {
LOG.error("Error while stopping servlet container", e);
}
Expand All @@ -142,12 +140,12 @@ public static void main(String[] args) throws Exception {
private static Server setupJettyServer(ZeppelinConfiguration conf)
throws Exception {

SocketConnector connector;
AbstractConnector connector;
if (conf.useSsl()) {
connector = new SslSocketConnector(getSslContextFactory(conf));
connector = new SslSelectChannelConnector(getSslContextFactory(conf));
}
else {
connector = new SocketConnector();
connector = new SelectChannelConnector();
}

// Set some timeout options to make debugging easier.
Expand All @@ -163,20 +161,22 @@ private static Server setupJettyServer(ZeppelinConfiguration conf)
return server;
}

private static NotebookServer setupNotebookServer(ZeppelinConfiguration conf)
private static ServletContextHandler setupNotebookServer(ZeppelinConfiguration conf)
throws Exception {

NotebookServer server = new NotebookServer(conf.getWebSocketAddress(), conf.getWebSocketPort());
notebookServer = new NotebookServer();
final ServletHolder servletHolder = new ServletHolder(notebookServer);
servletHolder.setInitParameter("maxTextMessageSize", "1024000");

// Default WebSocketServer uses unencrypted connector, so only need to
// change the connector if SSL should be used.
if (conf.useSsl()) {
SslWebSocketServerFactory wsf = new SslWebSocketServerFactory(getSslContext(conf));
wsf.setNeedClientAuth(conf.useClientAuth());
server.setWebSocketFactory(wsf);
}
final ServletContextHandler cxfContext = new ServletContextHandler(
ServletContextHandler.SESSIONS);

return server;
cxfContext.setSessionHandler(new SessionHandler());
cxfContext.setContextPath("/");
cxfContext.addServlet(servletHolder, "/ws/*");
cxfContext.addFilter(new FilterHolder(CorsFilter.class), "/*",
EnumSet.allOf(DispatcherType.class));
return cxfContext;
}

private static SslContextFactory getSslContextFactory(ZeppelinConfiguration conf)
Expand Down Expand Up @@ -257,7 +257,7 @@ private static ServletContextHandler setupSwaggerContextHandler(
}

private static WebAppContext setupWebAppContext(
ZeppelinConfiguration conf, int websocketPort) {
ZeppelinConfiguration conf) {

WebAppContext webApp = new WebAppContext();
File warPath = new File(conf.getString(ConfVars.ZEPPELIN_WAR));
Expand All @@ -273,7 +273,7 @@ private static WebAppContext setupWebAppContext(
}
// Explicit bind to root
webApp.addServlet(
new ServletHolder(new AppScriptServlet(websocketPort)),
new ServletHolder(new DefaultServlet()),
"/*"
);
return webApp;
Expand Down
Loading