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
12 changes: 10 additions & 2 deletions bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ if [[ -z "${ZEPPELIN_WAR}" ]]; then
if [[ -d "${ZEPPELIN_HOME}/zeppelin-web/dist" ]]; then
export ZEPPELIN_WAR="${ZEPPELIN_HOME}/zeppelin-web/dist"
else
export ZEPPELIN_WAR=$(find -L "${ZEPPELIN_HOME}" -name "zeppelin-web*.war")
export ZEPPELIN_WAR=$(find -L "${ZEPPELIN_HOME}" -name "zeppelin-web-[0-9]*.war")
fi
fi

if [[ -z "${ZEPPELIN_ANGULAR_WAR}" ]]; then
if [[ -d "${ZEPPELIN_HOME}/zeppelin-web/dist" ]]; then
export ZEPPELIN_ANGULAR_WAR="${ZEPPELIN_HOME}/zeppelin-web-angular/dist/zeppelin"
else
export ZEPPELIN_ANGULAR_WAR=$(find -L "${ZEPPELIN_HOME}" -name "zeppelin-web-angular*.war")
fi
fi

Expand Down Expand Up @@ -102,7 +110,7 @@ function getZeppelinVersion(){
exit 0
}

# Text encoding for
# Text encoding for
# read/write job into files,
# receiving/displaying query/result.
if [[ -z "${ZEPPELIN_ENCODING}" ]]; then
Expand Down
1 change: 1 addition & 0 deletions bin/zeppelin-daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ addJarInDir "${ZEPPELIN_HOME}/zeppelin-interpreter/target/lib"
addJarInDir "${ZEPPELIN_HOME}/zeppelin-zengine/target/lib"
addJarInDir "${ZEPPELIN_HOME}/zeppelin-server/target/lib"
addJarInDir "${ZEPPELIN_HOME}/zeppelin-web/target/lib"
addJarInDir "${ZEPPELIN_HOME}/zeppelin-web-angular/target/lib"

CLASSPATH+=":${ZEPPELIN_CLASSPATH}"

Expand Down
1 change: 1 addition & 0 deletions bin/zeppelin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ addJarInDir "${ZEPPELIN_HOME}/zeppelin-interpreter/target/lib"
addJarInDir "${ZEPPELIN_HOME}/zeppelin-zengine/target/lib"
addJarInDir "${ZEPPELIN_HOME}/zeppelin-server/target/lib"
addJarInDir "${ZEPPELIN_HOME}/zeppelin-web/target/lib"
addJarInDir "${ZEPPELIN_HOME}/zeppelin-web-angular/target/lib"

ZEPPELIN_CLASSPATH="$CLASSPATH:$ZEPPELIN_CLASSPATH"

Expand Down
6 changes: 6 additions & 0 deletions zeppelin-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>zeppelin-web-angular</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>

<build>
Expand Down
4 changes: 3 additions & 1 deletion zeppelin-distribution/src/assemble/distribution.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<baseDirectory>zeppelin-${project.version}</baseDirectory>

<dependencySets>
<dependencySet>
<!-- Enable access to all projects in the current multimodule build!
<useAllReactorProjects>true</useAllReactorProjects> -->
<!-- Now, select which projects to include in this module-set. -->
<includes>
<include>${project.groupId}:zeppelin-web</include>
<include>${project.groupId}:zeppelin-web-angular</include>
</includes>
<useProjectArtifact>false</useProjectArtifact>
<useTransitiveDependencies>false</useTransitiveDependencies>
Expand All @@ -42,6 +43,7 @@
<outputDirectory>/lib</outputDirectory>
<excludes>
<exclude>${project.groupId}:zeppelin-web</exclude>
<exclude>${project.groupId}:zeppelin-web-angular</exclude>
</excludes>
<useProjectArtifact>false</useProjectArtifact>
<useTransitiveFiltering>true</useTransitiveFiltering>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@ public enum ConfVars {
ZEPPELIN_SSL_TRUSTSTORE_TYPE("zeppelin.ssl.truststore.type", null),
ZEPPELIN_SSL_TRUSTSTORE_PASSWORD("zeppelin.ssl.truststore.password", null),
ZEPPELIN_WAR("zeppelin.war", "zeppelin-web/dist"),
ZEPPELIN_ANGULAR_WAR("zeppelin.angular.war", "zeppelin-web-angular/dist"),
ZEPPELIN_WAR_TEMPDIR("zeppelin.war.tempdir", "webapps"),

ZEPPELIN_INTERPRETER_JSON("zeppelin.interpreter.setting", "interpreter-setting.json"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
/** Main class of Zeppelin. */
public class ZeppelinServer extends ResourceConfig {
private static final Logger LOG = LoggerFactory.getLogger(ZeppelinServer.class);
private static final String WEB_APP_CONTEXT_NEXT = "/next";

public static Server jettyWebServer;
public static ServiceLocator sharedServiceLocator;
Expand All @@ -119,9 +120,6 @@ public static void main(String[] args) throws InterruptedException {
ContextHandlerCollection contexts = new ContextHandlerCollection();
jettyWebServer.setHandler(contexts);

// Web UI
final WebAppContext webApp = setupWebAppContext(contexts, conf);

sharedServiceLocator = ServiceLocatorFactory.getInstance().create("shared-locator");
ServiceLocatorUtilities.enableImmediateScope(sharedServiceLocator);
ServiceLocatorUtilities.addClasses(sharedServiceLocator,
Expand Down Expand Up @@ -180,25 +178,12 @@ protected void configure() {
}
});

webApp.addEventListener(
new ServletContextListener() {
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
servletContextEvent
.getServletContext()
.setAttribute(ServletProperties.SERVICE_LOCATOR, sharedServiceLocator);
}

@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {}
});

// Create `ZeppelinServer` using reflection and setup REST Api
setupRestApiContextHandler(webApp, conf);

// Notebook server
setupNotebookServer(webApp, conf, sharedServiceLocator);
// Multiple Web UI
final WebAppContext defaultWebApp = setupWebAppContext(contexts, conf, conf.getString(ConfVars.ZEPPELIN_WAR), conf.getServerContextPath());
final WebAppContext nextWebApp = setupWebAppContext(contexts, conf, conf.getString(ConfVars.ZEPPELIN_ANGULAR_WAR), WEB_APP_CONTEXT_NEXT);

initWebApp(defaultWebApp);
initWebApp(nextWebApp);
// Cluster Manager Server
setupClusterManagerServer(sharedServiceLocator);

Expand Down Expand Up @@ -304,14 +289,18 @@ private static Server setupJettyServer(ZeppelinConfiguration conf) {
conf.getInt(ConfVars.ZEPPELIN_SERVER_JETTY_THREAD_POOL_MIN),
conf.getInt(ConfVars.ZEPPELIN_SERVER_JETTY_THREAD_POOL_TIMEOUT));
final Server server = new Server(threadPool);
ServerConnector connector;
initServerConnector(server, conf.getServerPort(), conf.getServerSslPort());
return server;
}
private static void initServerConnector(Server server, int port, int sslPort) {

ServerConnector connector;
HttpConfiguration httpConfig = new HttpConfiguration();
httpConfig.addCustomizer(new ForwardedRequestCustomizer());
if (conf.useSsl()) {
LOG.debug("Enabling SSL for Zeppelin Server on port " + conf.getServerSslPort());
LOG.debug("Enabling SSL for Zeppelin Server on port " + sslPort);
httpConfig.setSecureScheme("https");
httpConfig.setSecurePort(conf.getServerSslPort());
httpConfig.setSecurePort(sslPort);
httpConfig.setOutputBufferSize(32768);
httpConfig.setResponseHeaderSize(8192);
httpConfig.setSendServerVersion(true);
Expand All @@ -321,28 +310,20 @@ private static Server setupJettyServer(ZeppelinConfiguration conf) {
httpsConfig.addCustomizer(src);

connector =
new ServerConnector(
server,
new SslConnectionFactory(getSslContextFactory(conf), HttpVersion.HTTP_1_1.asString()),
new HttpConnectionFactory(httpsConfig));
new ServerConnector(
server,
new SslConnectionFactory(getSslContextFactory(conf), HttpVersion.HTTP_1_1.asString()),
new HttpConnectionFactory(httpsConfig));
} else {
connector = new ServerConnector(server, new HttpConnectionFactory(httpConfig));
connector.setPort(port);
}

configureRequestHeaderSize(conf, connector);
// Set some timeout options to make debugging easier.
int timeout = 1000 * 30;
connector.setIdleTimeout(timeout);
connector.setHost(conf.getServerAddress());
if (conf.useSsl()) {
connector.setPort(conf.getServerSslPort());
} else {
connector.setPort(conf.getServerPort());
}

server.addConnector(connector);

return server;
}

private static void configureRequestHeaderSize(
Expand Down Expand Up @@ -437,19 +418,20 @@ private static void setupRestApiContextHandler(WebAppContext webapp, ZeppelinCon
}

private static WebAppContext setupWebAppContext(
ContextHandlerCollection contexts, ZeppelinConfiguration conf) {
ContextHandlerCollection contexts, ZeppelinConfiguration conf, String warPath, String contextPath) {
WebAppContext webApp = new WebAppContext();
webApp.setContextPath(conf.getServerContextPath());
File warPath = new File(conf.getString(ConfVars.ZEPPELIN_WAR));
if (warPath.isDirectory()) {
webApp.setContextPath(contextPath);
LOG.info("warPath is: {}", warPath);
File warFile = new File(warPath);
if (warFile.isDirectory()) {
// Development mode, read from FS
// webApp.setDescriptor(warPath+"/WEB-INF/web.xml");
webApp.setResourceBase(warPath.getPath());
webApp.setResourceBase(warFile.getPath());
webApp.setParentLoaderPriority(true);
} else {
// use packaged WAR
webApp.setWar(warPath.getAbsolutePath());
File warTempDirectory = new File(conf.getRelativeDir(ConfVars.ZEPPELIN_WAR_TEMPDIR));
webApp.setWar(warFile.getAbsolutePath());
File warTempDirectory = new File(conf.getRelativeDir(ConfVars.ZEPPELIN_WAR_TEMPDIR) + contextPath);
warTempDirectory.mkdir();
LOG.info("ZeppelinServer Webapp path: {}", warTempDirectory.getPath());
webApp.setTempDirectory(warTempDirectory);
Expand All @@ -463,7 +445,27 @@ private static WebAppContext setupWebAppContext(
webApp.setInitParameter(
"org.eclipse.jetty.servlet.Default.dirAllowed",
Boolean.toString(conf.getBoolean(ConfVars.ZEPPELIN_SERVER_DEFAULT_DIR_ALLOWED)));

return webApp;
}

private static void initWebApp(WebAppContext webApp) {
webApp.addEventListener(
new ServletContextListener() {
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
servletContextEvent
.getServletContext()
.setAttribute(ServletProperties.SERVICE_LOCATOR, sharedServiceLocator);
}

@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {}
});

// Create `ZeppelinServer` using reflection and setup REST Api
setupRestApiContextHandler(webApp, conf);

// Notebook server
setupNotebookServer(webApp, conf, sharedServiceLocator);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ private static void start(boolean withAuth,
zeppelinHome.getAbsolutePath());
System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_WAR.getVarName(),
new File("../zeppelin-web/dist").getAbsolutePath());
System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_ANGULAR_WAR.getVarName(),
new File("../zeppelin-web-angular/dist").getAbsolutePath());
System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_CONF_DIR.getVarName(),
confDir.getAbsolutePath());
System.setProperty(
Expand All @@ -208,6 +210,7 @@ private static void start(boolean withAuth,
// some test profile does not build zeppelin-web.
// to prevent zeppelin starting up fail, create zeppelin-web/dist directory
new File("../zeppelin-web/dist").mkdirs();
new File("../zeppelin-web-angular/dist").mkdirs();

LOG.info("Staring test Zeppelin up...");
ZeppelinConfiguration conf = ZeppelinConfiguration.create();
Expand Down
2 changes: 1 addition & 1 deletion zeppelin-web-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"postinstall": "npm run build:projects",
"ng": "./node_modules/.bin/ng",
"start": "ng serve --proxy-config proxy.conf.js --extra-webpack-config webpack.partial.js",
"build": "ng build --prod --extra-webpack-config webpack.partial.js",
"build": "ng build --prod --extra-webpack-config webpack.partial.js --base-href /next/",
"build:projects": "npm run build-project:sdk && npm run build-project:vis && npm run build-project:helium",
"build-helium-vis-example": " ng build --project helium-vis-example",
"build-project:sdk": " ng build --project zeppelin-sdk",
Expand Down
2 changes: 1 addition & 1 deletion zeppelin-web-angular/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<artifactId>zeppelin-web-angular</artifactId>
<packaging>war</packaging>
<version>0.9.0-SNAPSHOT</version>
<name>Zeppelin: web Application</name>
<name>Zeppelin: web angular Application</name>

<!-- See https://github.com/eirslett/frontend-maven-plugin/issues/229 -->
<prerequisites>
Expand Down