Skip to content

Commit

Permalink
[ZEPPELIN-6048] Write a Dockerfile for jdbc interpreter image build (a…
Browse files Browse the repository at this point in the history
…pache#4794)

* refactor: Reformat shell interpreter command in Dockerfile

* docs: Fix capitalization in shell interpreter README

* feat: Write a Dockerfile for jdbc interpreter image build
  • Loading branch information
seung-00 authored Sep 8, 2024
1 parent baf62b2 commit 6ad5baa
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 3 deletions.
50 changes: 50 additions & 0 deletions jdbc/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 as builder

COPY . /zeppelin/

WORKDIR /zeppelin

RUN chmod +x ./mvnw

RUN ./mvnw clean package -am -pl zeppelin-interpreter-shaded,zeppelin-interpreter,jdbc -DskipTests


FROM openjdk:11

COPY --from=builder /zeppelin/bin /zeppelin/bin/
COPY --from=builder /zeppelin/conf /zeppelin/conf

COPY --from=builder /zeppelin/interpreter/jdbc /zeppelin/interpreter/jdbc
COPY --from=builder /zeppelin/zeppelin-interpreter-shaded/target /zeppelin/zeppelin-interpreter-shaded/target

WORKDIR /zeppelin

ENV JDBC_INTERPRETER_PORT=8082

RUN chmod +x ./bin/interpreter.sh

CMD ["./bin/interpreter.sh", \
"-d", "./interpreter/jdbc", \
"-c", "host.docker.internal", \
"-p", "${INTERPRETER_EVENT_SERVER_PORT}", \
"-r", "${JDBC_INTERPRETER_PORT}:${JDBC_INTERPRETER_PORT}", \
"-i", "jdbc-shared_process", \
"-l", "./local-repo", \
"-g", "jdbc"]
36 changes: 36 additions & 0 deletions jdbc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## Overview
Jdbc interpreter for Apache Zeppelin

## Run the interpreter with docker
You can run the jdbc interpreter as a standalone docker container.

### Step 1. Specify the configuration for the jdbc interpreter
* NOTE: Your jdbc properties should be configured using the host environment settings, such as the URL, username, and password.
```bash
# conf/interpreter.json

"jdbc": {
...
"option":
} {
"remote": true,
"port": {INTERPRETER_PROCESS_PORT_IN_HOST},
"isExistingProcess": true,
"host": "localhost",
...
}
````

### Step 2. Build and run the jdbc interpreter
```bash
zeppelin $ ./mvnw clean install -DskipTests
zeppelin $ ./bin/zeppelin-daemon.sh start # start zeppelin server.
# check the port of the interpreter event server. you can find it by looking for the log that starts with "InterpreterEventServer is starting at"
zeppelin $ docker build -f ./jdbc/Dockerfile -t jdbc-interpreter .
zeppelin $ docker run -p {INTERPRETER_PROCESS_PORT_IN_HOST}:8082 \
-e INTERPRETER_EVENT_SERVER_PORT={INTERPRETER_EVENT_SERVER_PORT} \
jdbc-interpreter
```
9 changes: 8 additions & 1 deletion shell/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,11 @@ ENV SHELL_INTERPRETER_PORT=8081

RUN chmod +x ./bin/interpreter.sh

CMD ./bin/interpreter.sh -d interpreter/sh -c host.docker.internal -p ${INTERPRETER_EVENT_SERVER_PORT} -r ${SHELL_INTERPRETER_PORT}:${SHELL_INTERPRETER_PORT} -i sh-shared_process -l ./local-repo -g sh
CMD ["./bin/interpreter.sh", \
"-d", "interpreter/sh", \
"-c", "host.docker.internal", \
"-p", "${INTERPRETER_EVENT_SERVER_PORT}", \
"-r", "${SHELL_INTERPRETER_PORT}:${SHELL_INTERPRETER_PORT}", \
"-i", "sh-shared_process", \
"-l", "./local-repo", \
"-g", "sh"]
4 changes: 2 additions & 2 deletions shell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Shell interpreter for Apache Zeppelin
## Run the interpreter with docker
You can run the shell interpreter as a standalone docker container.

### step 1. Specify the configuration for the shell interpreter
### Step 1. Specify the configuration for the shell interpreter
```bash
# conf/interpreter.json

Expand All @@ -20,7 +20,7 @@ You can run the shell interpreter as a standalone docker container.
}
````

### step 2. Build and run the shell interpreter
### Step 2. Build and run the shell interpreter
```bash
zeppelin $ ./mvnw clean install -DskipTests
Expand Down

0 comments on commit 6ad5baa

Please sign in to comment.