Skip to content
Closed
28 changes: 24 additions & 4 deletions dev/create_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,28 @@ if [[ $# -ne 2 ]]; then
usage
fi

if [[ -z "${GPG_PASSPHRASE}" ]]; then
echo "You need GPG_PASSPHRASE variable set"
exit 1
fi
for var in GPG_PASSPHRASE DOCKER_USERNAME; do
if [[ -z "${!var}" ]]; then
echo "You need ${var} variable set"
exit 1
fi
done

RELEASE_VERSION="$1"
GIT_TAG="$2"

function build_docker_base() {
# build base image
docker build -t ${DOCKER_USERNAME}/zeppelin-base:latest "${BASEDIR}/../scripts/docker/zeppelin-base"
}
function build_docker_image() {
# build release image
echo "FROM ${DOCKER_USERNAME}/zeppelin-base:latest
RUN mkdir /usr/local/zeppelin/
ADD zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME} /usr/local/zeppelin/" > "Dockerfile"
docker build -t ${DOCKER_USERNAME}/zeppelin-release:"${RELEASE_VERSION}" .
}

function make_source_package() {
# create source package
cd ${WORKING_DIR}
Expand Down Expand Up @@ -97,10 +111,16 @@ function make_binary_release() {
mv "zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}.tgz.md5" "${WORKING_DIR}/"
mv "zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}.tgz.sha512" "${WORKING_DIR}/"

# build docker image if binary_release_name 'all'
if [[ $1 = "all" ]]; then
build_docker_image
fi

# clean up build dir
rm -rf "${WORKING_DIR}/zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}"
}

build_docker_base
git_clone
make_source_package
make_binary_release all "-Pspark-2.0 -Phadoop-2.4 -Pyarn -Ppyspark -Psparkr -Pr -Pscala-2.11"
Expand Down
11 changes: 10 additions & 1 deletion dev/publish_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if [[ $# -ne 2 ]]; then
usage
fi

for var in GPG_PASSPHRASE ASF_USERID ASF_PASSWORD; do
for var in GPG_PASSPHRASE ASF_USERID ASF_PASSWORD DOCKER_USERNAME DOCKER_PASSWORD DOCKER_EMAIL; do
if [[ -z "${!var}" ]]; then
echo "You need ${var} variable set"
exit 1
Expand Down Expand Up @@ -67,6 +67,14 @@ function curl_error() {
fi
}

function publish_to_dockerhub() {
# publish images
docker login --username="${DOCKER_USERNAME}" --password="${DOCKER_PASSWORD}" --email="${DOCKER_EMAIL}"
docker push ${DOCKER_USERNAME}/zeppelin-base:latest
docker push ${DOCKER_USERNAME}/zeppelin-release:"${RELEASE_VERSION}"

}

function publish_to_maven() {
cd "${WORKING_DIR}/zeppelin"

Expand Down Expand Up @@ -153,5 +161,6 @@ function publish_to_maven() {
}

git_clone
publish_to_dockerhub
publish_to_maven
cleanup
70 changes: 70 additions & 0 deletions docs/install/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
layout: page
title: "Apache Zeppelin Releases Docker Images"
description: "This document contains instructions about making docker containers for Zeppelin. It mainly provides guidance into how to create, publish and run docker images for zeppelin releases."
group: install
---
<!--
Licensed 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.
-->
{% include JB/setup %}

# Apache Zeppelin Releases Docker Images

<div id="toc"></div>

## Overview
This document contains instructions about making docker containers for Zeppelin. It mainly provides guidance into how to create, publish and run docker images for zeppelin releases.

## Quick Start
### Installing Docker
You need to [install docker](https://docs.docker.com/engine/installation/) on your machine.

### Creating and Publishing Zeppelin docker image
* In order to be able to create and/or publish an image, you need to set the **DockerHub** credentials `DOCKER_USERNAME, DOCKER_PASSWORD, DOCKER_EMAIL` variables as environment variables.

* To create an image for some release use :
`create_release.sh <release-version> <git-tag>`.
* To publish the created image use :
`publish_release.sh <release-version> <git-tag>`

### Running a Zeppelin docker image

* To start Zeppelin, you need to pull the zeppelin release image:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a newline below this line? Or it'll rendered like this
screen shot 2016-10-25 at 4 52 14 pm

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AhyoungRyu Thank you for your reviews, I changed it, you can check now. ;)

```
docker pull ${DOCKER_USERNAME}/zeppelin-release:<release-version>

docker run --rm -it -p 7077:7077 -p 8080:8080 ${DOCKER_USERNAME}/zeppelin-release:<release-version> -c bash
```
* Then a docker container will start with a Zeppelin release on path :
`/usr/local/zeppelin/`

* Run zeppelin inside docker:
```
/usr/local/zeppelin/bin/zeppelin.sh
```

* To Run Zeppelin in daemon mode
Mounting logs and notebooks zeppelin to folders on your host machine

```
docker run -p 7077:7077 -p 8080:8080 --privileged=true -v $PWD/logs:/logs -v $PWD/notebook:/notebook \
-e ZEPPELIN_NOTEBOOK_DIR='/notebook' \
-e ZEPPELIN_LOG_DIR='/logs' \
-d ${DOCKER_USERNAME}/zeppelin-release:<release-version> \
/usr/local/zeppelin/bin/zeppelin.sh
```


* Zeppelin will run at `http://localhost:8080`.

42 changes: 42 additions & 0 deletions scripts/docker/zeppelin-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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 alpine:3.4
MAINTAINER Apache Software Foundation <dev@zeppelin.apache.org>

ENV JAVA_HOME /usr/lib/jvm/java-1.7-openjdk
ENV PATH $PATH:$JAVA_HOME/bin

RUN apk add --update bash curl openjdk7-jre wget ca-certificates python build-base make gcc g++ java-cacerts openssl && \
rm /usr/lib/jvm/java-1.7-openjdk/jre/lib/security/cacerts && \
ln -s /etc/ssl/certs/java/cacerts /usr/lib/jvm/java-1.7-openjdk/jre/lib/security/cacerts && \
curl --silent \
--location https://github.com/sgerrand/alpine-pkg-R/releases/download/3.3.1-r0/R-3.3.1-r0.apk --output /var/cache/apk/R-3.3.1-r0.apk && \
apk add --update --allow-untrusted /var/cache/apk/R-3.3.1-r0.apk && \
curl --silent \
--location https://github.com/sgerrand/alpine-pkg-R/releases/download/3.3.1-r0/R-dev-3.3.1-r0.apk --output /var/cache/apk/R-dev-3.3.1-r0.apk && \
apk add --update --allow-untrusted /var/cache/apk/R-dev-3.3.1-r0.apk && \
R -e "install.packages('knitr', repos = 'http://cran.us.r-project.org')" && \
apk del curl build-base make gcc g++ && \
rm -rf /var/cache/apk/*

RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.1.3/dumb-init_1.1.3_amd64
RUN chmod +x /usr/local/bin/dumb-init

# ports for zeppelin
EXPOSE 8080 7077

ENTRYPOINT ["/usr/local/bin/dumb-init", "--"]