From c78d63bca4cc43f78485e3ba0c4e29256d560fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=80=E1=85=A7=E1=86=BC?= =?UTF-8?q?=E1=84=90=E1=85=A2?= Date: Fri, 18 Oct 2024 00:49:30 +0900 Subject: [PATCH 1/3] [ZEPPELIN-6130] Add Dockerfile --- elasticsearch/Dockerfile | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 elasticsearch/Dockerfile diff --git a/elasticsearch/Dockerfile b/elasticsearch/Dockerfile new file mode 100644 index 00000000000..5bab930e052 --- /dev/null +++ b/elasticsearch/Dockerfile @@ -0,0 +1,48 @@ +## +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## + +FROM openjdk:11 AS builder + +COPY . /zeppelin/ + +WORKDIR /zeppelin + +RUN chmod +x ./mvnw +RUN ./mvnw clean package -am -pl zeppelin-interpreter-shaded,zeppelin-interpreter,elasticsearch -DskipTests + +FROM openjdk:11 + +COPY --from=builder /zeppelin/bin /zeppelin/bin/ +COPY --from=builder /zeppelin/conf /zeppelin/conf + +COPY --from=builder /zeppelin/interpreter/elasticsearch /zeppelin/interpreter/elasticsearch +COPY --from=builder /zeppelin/zeppelin-interpreter-shaded/target /zeppelin/zeppelin-interpreter-shaded/target + +WORKDIR /zeppelin + +ENV ELASTICSEARCH_INTERPRETER_PORT=8087 + +RUN chmod +x ./bin/interpreter.sh + +CMD ./bin/interpreter.sh \ + -d ./interpreter/elasticsearch \ + -c host.docker.internal \ + -p ${INTERPRETER_EVENT_SERVER_PORT} \ + -r ${ELASTICSEARCH_INTERPRETER_PORT}:${ELASTICSEARCH_INTERPRETER_PORT} \ + -i elasticsearch-shared_process \ + -l ./local-repo \ + -g elasticsearch From db38ce01a9d247a441f787d15282064708f2e13c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=80=E1=85=A7=E1=86=BC?= =?UTF-8?q?=E1=84=90=E1=85=A2?= Date: Fri, 18 Oct 2024 00:49:40 +0900 Subject: [PATCH 2/3] [ZEPPELIN-6130] Add Dockerfile_elasticsearch --- elasticsearch/Dockerfile_elasticsearch | 50 ++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 elasticsearch/Dockerfile_elasticsearch diff --git a/elasticsearch/Dockerfile_elasticsearch b/elasticsearch/Dockerfile_elasticsearch new file mode 100644 index 00000000000..fa2ad5fb4d0 --- /dev/null +++ b/elasticsearch/Dockerfile_elasticsearch @@ -0,0 +1,50 @@ +## +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## + +FROM openjdk:11 + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install -y wget apt-transport-https curl gnupg +# rm -rf /var/lib/apt/lists/* + +RUN wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add - && \ + echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-7.x.list + +RUN apt-get update && \ + apt-get install -y elasticsearch=7.10.1 +# rm -rf /var/lib/apt/lists/* + +EXPOSE 9200 9300 + +ENV ES_JAVA_OPTS="-Xms512m -Xmx512m" + +RUN chown -R elasticsearch:elasticsearch /var/lib/elasticsearch && \ + chown -R elasticsearch:elasticsearch /etc/elasticsearch + +USER elasticsearch + +CMD /usr/share/elasticsearch/bin/elasticsearch \ + -Enetwork.host=0.0.0.0 \ + -Ediscovery.type=single-node \ + -Ecluster.name=elasticsearch \ + -Ehttp.port=9200 \ + -Etransport.port=9300 \ + -Expack.security.enabled=false \ + -Expack.security.transport.ssl.enabled=false \ + -Expack.security.http.ssl.enabled=false From 25485e8d91db62b7460bfdae5b905dd21e7d2b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=80=E1=85=A7=E1=86=BC?= =?UTF-8?q?=E1=84=90=E1=85=A2?= Date: Fri, 18 Oct 2024 00:49:54 +0900 Subject: [PATCH 3/3] [ZEPPELIN-6130] Add README.md --- elasticsearch/README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 elasticsearch/README.md diff --git a/elasticsearch/README.md b/elasticsearch/README.md new file mode 100644 index 00000000000..809f879a743 --- /dev/null +++ b/elasticsearch/README.md @@ -0,0 +1,36 @@ +# Overview +Elasticsearch interpreter for Apache Zeppelin + +## Run the interpreter with docker +You can run the Elasticsearch interpreter as a standalone docker container. + +### Step 1. Specify the configuration for the elasticsearch interpreter +```bash + # conf/interpreter.json + + "elasticsearch": { + ... + "option": + } { + "remote": true, + "port": ${INTERPRETER_PROCESS_PORT_IN_HOST}, + "isExistingProcess": true, + "host": "localhost", + ... + } +```` + +### Step 2. Build and run the elasticsearch interpreter +```bash +./mvnw clean install -DskipTests + +./bin/zeppelin-daemon.sh start +# check the port of the interpreter event server. you can find it by looking for the log that starts with "InterpreterEventServer is starting at" + +docker build -f ./elasticsearch/Dockerfile -t elasticsearch-interpreter . +docker run \ +--name elasticsearch-interpreter \ +-p 8087:8087 \ +-e INTERPRETER_EVENT_SERVER_PORT=${INTERPRETER_EVENT_SERVER_PORT} \ +elasticsearch-interpreter +```