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
4 changes: 2 additions & 2 deletions bin/common.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ if not defined ZEPPELIN_ENCODING (
)

if not defined ZEPPELIN_MEM (
set ZEPPELIN_MEM=-Xms1024m -Xmx1024m -XX:MaxPermSize=512m
set ZEPPELIN_MEM=-Xms1024m -Xmx1024m
)

if not defined ZEPPELIN_INTP_MEM (
set ZEPPELIN_INTP_MEM=-Xms1024m -Xmx1024m -XX:MaxPermSize=512m
set ZEPPELIN_INTP_MEM=-Xms1024m -Xmx1024m
)

if not defined ZEPPELIN_JAVA_OPTS (
Expand Down
4 changes: 2 additions & 2 deletions bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ if [[ -z "${ZEPPELIN_ENCODING}" ]]; then
fi

if [[ -z "${ZEPPELIN_MEM}" ]]; then
export ZEPPELIN_MEM="-Xms1024m -Xmx1024m -XX:MaxPermSize=512m"
export ZEPPELIN_MEM="-Xms1024m -Xmx1024m"
fi

if [[ -z "${ZEPPELIN_INTP_MEM}" ]]; then
export ZEPPELIN_INTP_MEM="-Xms1024m -Xmx2048m -XX:MaxPermSize=512m"
export ZEPPELIN_INTP_MEM="-Xms1024m -Xmx2048m"
fi

JAVA_OPTS+=" ${ZEPPELIN_JAVA_OPTS} -Dfile.encoding=${ZEPPELIN_ENCODING} ${ZEPPELIN_MEM}"
Expand Down
23 changes: 23 additions & 0 deletions bin/interpreter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,29 @@ function usage() {
echo "usage) $0 -p <port> -r <intp_port> -d <interpreter dir to load> -l <local interpreter repo dir to load> -g <interpreter group name>"
}

# pre-requisites for checking that we're running in container
if [ -f /proc/self/cgroup ] && [ -n "$(command -v getent)" ]; then
# checks if we're running in container...
if awk -F: '/cpu/ && $3 ~ /^\/$/{ c=1 } END { exit c }' /proc/self/cgroup; then
# Check whether there is a passwd entry for the container UID
myuid="$(id -u)"
mygid="$(id -g)"
# turn off -e for getent because it will return error code in anonymous uid case
set +e
uidentry="$(getent passwd "$myuid")"
set -e

# If there is no passwd entry for the container UID, attempt to create one
if [ -z "$uidentry" ] ; then
if [ -w /etc/passwd ] ; then
echo "zeppelin:x:$myuid:$mygid:anonymous uid:$Z_HOME:/bin/false" >> /etc/passwd
else
echo "Container ENTRYPOINT failed to add passwd entry for anonymous UID"
fi
fi
fi
fi

while getopts "hc:p:r:i:d:l:v:u:g:" o; do
case ${o} in
h)
Expand Down
50 changes: 32 additions & 18 deletions bin/zeppelin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,33 @@
# Run Zeppelin
#

# Check whether there is a passwd entry for the container UID
myuid=$(id -u)
mygid=$(id -g)
# turn off -e for getent because it will return error code in anonymous uid case
set +e
uidentry=$(getent passwd $myuid)
set -e

# If there is no passwd entry for the container UID, attempt to create one
if [ -z "$uidentry" ] ; then
if [ -w /etc/passwd ] ; then
echo "zeppelin:x:$myuid:$mygid:anonymous uid:$Z_HOME:/bin/false" >> /etc/passwd
else
echo "Container ENTRYPOINT failed to add passwd entry for anonymous UID"
# pre-requisites for checking that we're running in container
if [ -f /proc/self/cgroup ] && [ -n "$(command -v getent)" ]; then
# checks if we're running in container...
if awk -F: '/cpu/ && $3 ~ /^\/$/{ c=1 } END { exit c }' /proc/self/cgroup; then
# Check whether there is a passwd entry for the container UID
myuid="$(id -u)"
mygid="$(id -g)"
# turn off -e for getent because it will return error code in anonymous uid case
set +e
uidentry="$(getent passwd "$myuid")"
set -e

# If there is no passwd entry for the container UID, attempt to create one
if [ -z "$uidentry" ] ; then
if [ -w /etc/passwd ] ; then
echo "zeppelin:x:$myuid:$mygid:anonymous uid:$Z_HOME:/bin/false" >> /etc/passwd
else
echo "Container ENTRYPOINT failed to add passwd entry for anonymous UID"
fi
fi
fi
fi

USAGE="Usage: bin/zeppelin.sh [--config <conf-dir>] [--run <noteId>]"
function usage() {
echo "Usage: bin/zeppelin.sh [--config <conf-dir>] [--run <noteId>]"
exit 0
}

POSITIONAL=()
while [[ $# -gt 0 ]]
Expand All @@ -53,6 +62,12 @@ do
shift # past argument
shift # past value
;;
--help)
usage
;;
-h)
usage
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
Expand All @@ -68,7 +83,6 @@ fi

HOSTNAME=$(hostname)
ZEPPELIN_LOGFILE="${ZEPPELIN_LOG_DIR}/zeppelin-${ZEPPELIN_IDENT_STRING}-${HOSTNAME}.log"
LOG="${ZEPPELIN_LOG_DIR}/zeppelin-cli-${ZEPPELIN_IDENT_STRING}-${HOSTNAME}.out"

ZEPPELIN_SERVER=org.apache.zeppelin.server.ZeppelinServer
JAVA_OPTS+=" -Dzeppelin.log.file=${ZEPPELIN_LOGFILE}"
Expand Down Expand Up @@ -103,12 +117,12 @@ fi

if [[ ! -d "${ZEPPELIN_LOG_DIR}" ]]; then
echo "Log dir doesn't exist, create ${ZEPPELIN_LOG_DIR}"
$(mkdir -p "${ZEPPELIN_LOG_DIR}")
mkdir -p "${ZEPPELIN_LOG_DIR}"
fi

if [[ ! -d "${ZEPPELIN_PID_DIR}" ]]; then
echo "Pid dir doesn't exist, create ${ZEPPELIN_PID_DIR}"
$(mkdir -p "${ZEPPELIN_PID_DIR}")
mkdir -p "${ZEPPELIN_PID_DIR}"
fi

exec $ZEPPELIN_RUNNER $JAVA_OPTS -cp $ZEPPELIN_CLASSPATH_OVERRIDES:${ZEPPELIN_CLASSPATH} $ZEPPELIN_SERVER "$@"