You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2017/03/17 15:57:58 UTC

zeppelin git commit: [ZEPPELIN-2277] Env variable to configure maven central repo

Repository: zeppelin
Updated Branches:
  refs/heads/master e669895d9 -> cceeaef2a


[ZEPPELIN-2277] Env variable to configure maven central repo

### What is this PR for?
When deploying Zeppelin in private Cloud or within closed networks, it happens that Maven Central isn't directly reachable, so we want to configure our own proxy and do not have to wait for minutes long timeouts when importing external libraries. It is anyhow worth to let user configure maven central repo instead of hardcoding the URL.

### What type of PR is it?
Improvement

### How should this be tested?
Outline the steps to test the PR here.

### Questions:
* Does the licenses files need update?
* Is there breaking changes for older versions?
* Does this needs documentation?

Author: Andrea Peruffo <an...@gmail.com>

Closes #2093 from andreaTP/mavenRepo and squashes the following commits:

af9accc [Andrea Peruffo] [ZEPPELIN-2277] Env variable to configure maven central repo


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/cceeaef2
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/cceeaef2
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/cceeaef2

Branch: refs/heads/master
Commit: cceeaef2a4994ee5b40e8c2606ec7c81e7553d37
Parents: e669895
Author: Andrea Peruffo <an...@gmail.com>
Authored: Fri Mar 3 11:44:15 2017 +0100
Committer: Lee moon soo <mo...@apache.org>
Committed: Fri Mar 17 08:57:53 2017 -0700

----------------------------------------------------------------------
 conf/zeppelin-env.cmd.template                    |  1 +
 conf/zeppelin-env.sh.template                     |  1 +
 conf/zeppelin-site.xml.template                   |  6 ++++++
 docs/install/configuration.md                     | 10 ++++++++--
 .../main/java/org/apache/zeppelin/dep/Booter.java | 10 +++++++++-
 .../zeppelin/conf/ZeppelinConfiguration.java      | 18 ++++++++++++------
 6 files changed, 37 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/cceeaef2/conf/zeppelin-env.cmd.template
----------------------------------------------------------------------
diff --git a/conf/zeppelin-env.cmd.template b/conf/zeppelin-env.cmd.template
index 1bbde86..548a798 100644
--- a/conf/zeppelin-env.cmd.template
+++ b/conf/zeppelin-env.cmd.template
@@ -38,6 +38,7 @@ REM set ZEPPELIN_NOTEBOOK_S3_SSE               REM Server-side encryption enable
 REM set ZEPPELIN_IDENT_STRING   		REM A string representing this instance of zeppelin. $USER by default.
 REM set ZEPPELIN_NICENESS       		REM The scheduling priority for daemons. Defaults to 0.
 REM set ZEPPELIN_INTERPRETER_LOCALREPO         REM Local repository for interpreter's additional dependency loading
+REM set ZEPPELIN_INTERPRETER_DEP_MVNREPO       REM Maven principal repository for interpreter's additional dependency loading
 REM set ZEPPELIN_NOTEBOOK_STORAGE		REM Refers to pluggable notebook storage class, can have two classes simultaneously with a sync between them (e.g. local and remote).
 REM set ZEPPELIN_NOTEBOOK_ONE_WAY_SYNC		REM If there are multiple notebook storages, should we treat the first one as the only source of truth?
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/cceeaef2/conf/zeppelin-env.sh.template
----------------------------------------------------------------------
diff --git a/conf/zeppelin-env.sh.template b/conf/zeppelin-env.sh.template
index 3dccca6..5e32b15 100644
--- a/conf/zeppelin-env.sh.template
+++ b/conf/zeppelin-env.sh.template
@@ -43,6 +43,7 @@
 # export ZEPPELIN_IDENT_STRING   		# A string representing this instance of zeppelin. $USER by default.
 # export ZEPPELIN_NICENESS       		# The scheduling priority for daemons. Defaults to 0.
 # export ZEPPELIN_INTERPRETER_LOCALREPO         # Local repository for interpreter's additional dependency loading
+# export ZEPPELIN_INTERPRETER_DEP_MVNREPO       # Remote principal repository for interpreter's additional dependency loading
 # export ZEPPELIN_NOTEBOOK_STORAGE 		# Refers to pluggable notebook storage class, can have two classes simultaneously with a sync between them (e.g. local and remote).
 # export ZEPPELIN_NOTEBOOK_ONE_WAY_SYNC	# If there are multiple notebook storages, should we treat the first one as the only source of truth?
 # export ZEPPELIN_NOTEBOOK_PUBLIC   # Make notebook public by default when created, private otherwise

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/cceeaef2/conf/zeppelin-site.xml.template
----------------------------------------------------------------------
diff --git a/conf/zeppelin-site.xml.template b/conf/zeppelin-site.xml.template
index f4625c4..d172942 100755
--- a/conf/zeppelin-site.xml.template
+++ b/conf/zeppelin-site.xml.template
@@ -240,6 +240,12 @@
 </property>
 
 <property>
+  <name>zeppelin.interpreter.dep.mvnRepo</name>
+  <value>http://repo1.maven.org/maven2/</value>
+  <description>Remote principal repository for interpreter's additional dependency loading</description>
+</property>
+
+<property>
   <name>zeppelin.dep.localrepo</name>
   <value>local-repo</value>
   <description>Local repository for dependency loader</description>

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/cceeaef2/docs/install/configuration.md
----------------------------------------------------------------------
diff --git a/docs/install/configuration.md b/docs/install/configuration.md
index 52018d1..ac41e6f 100644
--- a/docs/install/configuration.md
+++ b/docs/install/configuration.md
@@ -26,7 +26,7 @@ limitations under the License.
 ## Zeppelin Properties
 There are two locations you can configure Apache Zeppelin.
 
-* **Environment variables** can be defined `conf/zeppelin-env.sh`(`conf\zeppelin-env.cmd` for Windows). 
+* **Environment variables** can be defined `conf/zeppelin-env.sh`(`conf\zeppelin-env.cmd` for Windows).
 * **Java properties** can ba defined in `conf/zeppelin-site.xml`.
 
 If both are defined, then the **environment variables** will take priority.
@@ -258,6 +258,12 @@ If both are defined, then the **environment variables** will take priority.
     <td>Interpreter directory</td>
   </tr>
   <tr>
+    <td><h6 class="properties">ZEPPELIN_INTERPRETER_DEP_MVNREPO</h6></td>
+    <td><h6 class="properties">zeppelin.interpreter.dep.mvnRepo</h6></td>
+    <td>http://repo1.maven.org/maven2/</td>
+    <td>Remote principal repository for interpreter's additional dependency loading</td>
+  </tr>
+  <tr>
     <td><h6 class="properties">ZEPPELIN_INTERPRETER_OUTPUT_LIMIT</h6></td>
     <td><h6 class="properties">zeppelin.interpreter.output.limit</h6></td>
     <td>102400</td>
@@ -391,7 +397,7 @@ The following properties needs to be updated in the `zeppelin-site.xml` in order
 ### Obfuscating Passwords using the Jetty Password Tool
 
 Security best practices advise to not use plain text passwords and Jetty provides a password tool to help obfuscating the passwords used to access the KeyStore and TrustStore.
- 
+
 The Password tool documentation can be found [here](http://www.eclipse.org/jetty/documentation/current/configuring-security-secure-passwords.html).
 
 After using the tool:

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/cceeaef2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/dep/Booter.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/dep/Booter.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/dep/Booter.java
index 0fd0ea2..5bc58ed 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/dep/Booter.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/dep/Booter.java
@@ -67,7 +67,15 @@ public class Booter {
   }
 
   public static RemoteRepository newCentralRepository() {
-    return new RemoteRepository("central", "default", "http://repo1.maven.org/maven2/");
+    String mvnRepo = System.getenv("ZEPPELIN_INTERPRETER_DEP_MVNREPO");
+    if (mvnRepo == null) {
+      mvnRepo = System.getProperty("zeppelin.interpreter.dep.mvnRepo");
+    }
+    if (mvnRepo == null) {
+      mvnRepo = "http://repo1.maven.org/maven2/";
+    }
+
+    return new RemoteRepository("central", "default", mvnRepo);
   }
 
   public static RemoteRepository newLocalRepository() {

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/cceeaef2/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
index 81507ba..facf89a 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
@@ -108,7 +108,7 @@ public class ZeppelinConfiguration extends XMLConfiguration {
         conf = new ZeppelinConfiguration();
       }
     }
-    
+
     LOG.info("Server Host: " + conf.getServerAddress());
     if (conf.useSsl() == false) {
       LOG.info("Server Port: " + conf.getServerPort());
@@ -355,7 +355,7 @@ public class ZeppelinConfiguration extends XMLConfiguration {
   public String getNotebookDir() {
     return getString(ConfVars.ZEPPELIN_NOTEBOOK_DIR);
   }
-  
+
   public String getUser() {
     return getString(ConfVars.ZEPPELIN_NOTEBOOK_S3_USER);
   }
@@ -363,7 +363,7 @@ public class ZeppelinConfiguration extends XMLConfiguration {
   public String getBucketName() {
     return getString(ConfVars.ZEPPELIN_NOTEBOOK_S3_BUCKET);
   }
-  
+
   public String getEndpoint() {
     return getString(ConfVars.ZEPPELIN_NOTEBOOK_S3_ENDPOINT);
   }
@@ -375,7 +375,7 @@ public class ZeppelinConfiguration extends XMLConfiguration {
   public String getS3KMSKeyRegion() {
     return getString(ConfVars.ZEPPELIN_NOTEBOOK_S3_KMS_KEY_REGION);
   }
-  
+
   public String getS3EncryptionMaterialsProviderClass() {
     return getString(ConfVars.ZEPPELIN_NOTEBOOK_S3_EMP);
   }
@@ -449,6 +449,10 @@ public class ZeppelinConfiguration extends XMLConfiguration {
     return getRelativeDir(ConfVars.ZEPPELIN_INTERPRETER_LOCALREPO);
   }
 
+  public String getInterpreterMvnRepoPath() {
+    return getString(ConfVars.ZEPPELIN_INTERPRETER_DEP_MVNREPO);
+  }
+
   public String getRelativeDir(ConfVars c) {
     return getRelativeDir(getString(c));
   }
@@ -464,7 +468,7 @@ public class ZeppelinConfiguration extends XMLConfiguration {
   public boolean isWindowsPath(String path){
     return path.matches("^[A-Za-z]:\\\\.*");
   }
-  
+
   public boolean isAnonymousAllowed() {
     return getBoolean(ConfVars.ZEPPELIN_ANONYMOUS_ALLOWED);
   }
@@ -472,7 +476,7 @@ public class ZeppelinConfiguration extends XMLConfiguration {
   public boolean isNotebokPublic() {
     return getBoolean(ConfVars.ZEPPELIN_NOTEBOOK_PUBLIC);
   }
-  
+
   public String getConfDir() {
     return getString(ConfVars.ZEPPELIN_CONF_DIR);
   }
@@ -589,6 +593,8 @@ public class ZeppelinConfiguration extends XMLConfiguration {
     ZEPPELIN_INTERPRETER_JSON("zeppelin.interpreter.setting", "interpreter-setting.json"),
     ZEPPELIN_INTERPRETER_DIR("zeppelin.interpreter.dir", "interpreter"),
     ZEPPELIN_INTERPRETER_LOCALREPO("zeppelin.interpreter.localRepo", "local-repo"),
+    ZEPPELIN_INTERPRETER_DEP_MVNREPO("zeppelin.interpreter.dep.mvnRepo",
+        "http://repo1.maven.org/maven2/"),
     ZEPPELIN_INTERPRETER_CONNECT_TIMEOUT("zeppelin.interpreter.connect.timeout", 30000),
     ZEPPELIN_INTERPRETER_MAX_POOL_SIZE("zeppelin.interpreter.max.poolsize", 10),
     ZEPPELIN_INTERPRETER_GROUP_ORDER("zeppelin.interpreter.group.order", "spark,md,angular,sh,"