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 2016/03/25 15:50:38 UTC

incubator-zeppelin git commit: ZEPPELIN-692 Add setting to set s3 endpoint

Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master 2dc464cfd -> 6bd53d4dd


ZEPPELIN-692 Add setting to set s3 endpoint

### What is this PR for?
Add setting to set endpoint in S3 storage.
[S3 Endpoint](http://docs.aws.amazon.com/es_es/general/latest/gr/rande.html#s3_region)

### What type of PR is it?
Improvement

### Todos

### What is the Jira issue?
* [ZEPPELIN-692](https://issues.apache.org/jira/browse/ZEPPELIN-692)

### How should this be tested?
set endpoint for your bucket in zeppelin-site.xml

### Screenshots (if appropriate)

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

Author: vgmartinez <vi...@gmail.com>

This patch had conflicts when merged, resolved by
Committer: Lee moon soo <mo...@apache.org>

Closes #793 from vgmartinez/ZEPPELIN-692 and squashes the following commits:

c02c8af [vgmartinez] add new configuration
6015d66 [vgmartinez] Add setting to set s3 endpoint


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

Branch: refs/heads/master
Commit: 6bd53d4dd1165f33a25a4ce0b8de6fa83f9eacf9
Parents: 2dc464c
Author: vgmartinez <vi...@gmail.com>
Authored: Wed Mar 23 15:45:36 2016 +0100
Committer: Lee moon soo <mo...@apache.org>
Committed: Fri Mar 25 07:50:47 2016 -0700

----------------------------------------------------------------------
 conf/zeppelin-env.sh.template                           |  5 +++--
 conf/zeppelin-site.xml.template                         |  6 ++++++
 docs/install/install.md                                 | 12 +++++++++---
 .../org/apache/zeppelin/conf/ZeppelinConfiguration.java |  5 +++++
 .../apache/zeppelin/notebook/repo/S3NotebookRepo.java   |  6 +++++-
 5 files changed, 28 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/6bd53d4d/conf/zeppelin-env.sh.template
----------------------------------------------------------------------
diff --git a/conf/zeppelin-env.sh.template b/conf/zeppelin-env.sh.template
index e2a4600..ef37909 100644
--- a/conf/zeppelin-env.sh.template
+++ b/conf/zeppelin-env.sh.template
@@ -29,8 +29,9 @@
 # export ZEPPELIN_NOTEBOOK_DIR   		# Where notebook saved
 # export ZEPPELIN_NOTEBOOK_HOMESCREEN		# Id of notebook to be displayed in homescreen. ex) 2A94M5J1Z
 # export ZEPPELIN_NOTEBOOK_HOMESCREEN_HIDE	# hide homescreen notebook from list when this value set to "true". default "false"
-# export ZEPPELIN_NOTEBOOK_S3_BUCKET            # Bucket where notebook saved
-# export ZEPPELIN_NOTEBOOK_S3_USER              # User in bucket where notebook saved. For example bucket/user/notebook/2A94M5J1Z/note.json
+# export ZEPPELIN_NOTEBOOK_S3_BUCKET        # Bucket where notebook saved
+# export ZEPPELIN_NOTEBOOK_S3_ENDPOINT      # Endpoint of the bucket
+# export ZEPPELIN_NOTEBOOK_S3_USER          # User in bucket where notebook saved. For example bucket/user/notebook/2A94M5J1Z/note.json
 # 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

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/6bd53d4d/conf/zeppelin-site.xml.template
----------------------------------------------------------------------
diff --git a/conf/zeppelin-site.xml.template b/conf/zeppelin-site.xml.template
index 730de7b..d904494 100755
--- a/conf/zeppelin-site.xml.template
+++ b/conf/zeppelin-site.xml.template
@@ -77,6 +77,12 @@
 </property>
 
 <property>
+  <name>zeppelin.notebook.s3.endpoint</name>
+  <value>s3.amazonaws.com</value>
+  <description>endpoint for s3 bucket</description>
+</property>
+
+<property>
   <name>zeppelin.notebook.storage</name>
   <value>org.apache.zeppelin.notebook.repo.S3NotebookRepo</value>
   <description>notebook persistence layer implementation</description>

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/6bd53d4d/docs/install/install.md
----------------------------------------------------------------------
diff --git a/docs/install/install.md b/docs/install/install.md
index 884b4bf..494ee7f 100644
--- a/docs/install/install.md
+++ b/docs/install/install.md
@@ -187,6 +187,12 @@ You can configure Zeppelin with both **environment variables** in `conf/zeppelin
     <td>A user name of S3 bucket<br />i.e. <code>bucket/user/notebook/2A94M5J1Z/note.json</code></td>
   </tr>
   <tr>
+    <td>ZEPPELIN_NOTEBOOK_S3_ENDPOINT</td>
+    <td>zeppelin.notebook.s3.endpoint</td>
+    <td>s3.amazonaws.com</td>
+    <td>Endpoint for the bucket</td>
+  </tr>
+  <tr>
     <td>ZEPPELIN_NOTEBOOK_AZURE_CONNECTION_STRING</td>
     <td>zeppelin.notebook.azure.connectionString</td>
     <td></td>
@@ -228,7 +234,7 @@ You can configure Zeppelin with both **environment variables** in `conf/zeppelin
 </table>
 
 Maybe you need to configure individual interpreter. If so, please check **Interpreter** section in Zeppelin documentation.
-[Spark Interpreter for Apache Zeppelin](../interpreter/spark.html) will be a good example. 
+[Spark Interpreter for Apache Zeppelin](../interpreter/spark.html) will be a good example.
 
 ## Zeppelin Start / Stop
 #### Start Zeppelin
@@ -248,9 +254,9 @@ bin/zeppelin-daemon.sh stop
 
 Zeppelin can auto start as a service with an init script, such as services managed by upstart.
 
-The following is an example upstart script to be saved as `/etc/init/zeppelin.conf` 
+The following is an example upstart script to be saved as `/etc/init/zeppelin.conf`
 This example has been tested with Ubuntu Linux.
-This also allows the service to be managed with commands such as 
+This also allows the service to be managed with commands such as
 
 `sudo service zeppelin start`  
 `sudo service zeppelin stop`  

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/6bd53d4d/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 3d51dfd..174e6d2 100755
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
@@ -333,6 +333,10 @@ 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);
+  }
 
   public String getInterpreterDir() {
     return getRelativeDir(ConfVars.ZEPPELIN_INTERPRETER_DIR);
@@ -476,6 +480,7 @@ public class ZeppelinConfiguration extends XMLConfiguration {
     // whether homescreen notebook will be hidden from notebook list or not
     ZEPPELIN_NOTEBOOK_HOMESCREEN_HIDE("zeppelin.notebook.homescreen.hide", false),
     ZEPPELIN_NOTEBOOK_S3_BUCKET("zeppelin.notebook.s3.bucket", "zeppelin"),
+    ZEPPELIN_NOTEBOOK_S3_ENDPOINT("zeppelin.notebook.s3.endpoint", "s3.amazonaws.com"),
     ZEPPELIN_NOTEBOOK_S3_USER("zeppelin.notebook.s3.user", "user"),
     ZEPPELIN_NOTEBOOK_AZURE_CONNECTION_STRING("zeppelin.notebook.azure.connectionString", null),
     ZEPPELIN_NOTEBOOK_AZURE_SHARE("zeppelin.notebook.azure.share", "zeppelin"),

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/6bd53d4d/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/S3NotebookRepo.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/S3NotebookRepo.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/S3NotebookRepo.java
index f178179..82d321e 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/S3NotebookRepo.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/S3NotebookRepo.java
@@ -72,14 +72,18 @@ public class S3NotebookRepo implements NotebookRepo {
   //  4. Instance profile credentials delivered through the Amazon EC2 metadata service
   private AmazonS3 s3client = new AmazonS3Client(new DefaultAWSCredentialsProviderChain());
   private static String bucketName = "";
+  private static String endpoint = "";
   private String user = "";
 
   private ZeppelinConfiguration conf;
 
   public S3NotebookRepo(ZeppelinConfiguration conf) throws IOException {
     this.conf = conf;
-    user = conf.getUser();
     bucketName = conf.getBucketName();
+    endpoint = conf.getEndpoint();
+    user = conf.getUser();
+    
+    s3client.setEndpoint(endpoint);
   }
 
   @Override