Skip to content

Commit

Permalink
Move from Jupyter notebook to Jupyter Lab and introduce a notebook fo…
Browse files Browse the repository at this point in the history
…lder structure (#14419)
  • Loading branch information
sergioferragut committed Jun 21, 2023
1 parent 92a7feb commit 1a9aefb
Show file tree
Hide file tree
Showing 11 changed files with 1,713 additions and 842 deletions.
35 changes: 18 additions & 17 deletions examples/quickstart/jupyter-notebooks/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,36 @@ FROM jupyter/base-notebook
WORKDIR /home/jovyan

# Install required Python packages
RUN pip install requests
RUN pip install pandas
RUN pip install numpy
RUN pip install seaborn
RUN pip install bokeh
RUN pip install kafka-python
RUN pip install sortedcontainers
RUN pip install requests \
pip install pandas \
pip install numpy \
pip install seaborn \
pip install bokeh \
pip install kafka-python \
pip install sortedcontainers

# Install druidapi client from apache/druid
# Local install requires sudo privileges
USER root
ADD druidapi /home/jovyan/druidapi
WORKDIR /home/jovyan/druidapi
RUN pip install .
WORKDIR /home/jovyan



# WIP -- install DruidDataDriver as a package
# Import data generator and configuration file
# Change permissions to allow import (requires sudo privileges)
# WIP -- change to apache repo
ADD https://raw.githubusercontent.com/shallada/druid/data-generator/examples/quickstart/jupyter-notebooks/data-generator/DruidDataDriver.py .
ADD docker-jupyter/kafka_docker_config.json .
RUN chmod 664 DruidDataDriver.py
RUN chmod 664 kafka_docker_config.json

# The Jupyter notebooks themselves are mounted into the image's /home/jovyan/notebooks
# path when running this image.
RUN mkdir -p /home/jovyan/notebooks

WORKDIR /home/jovyan/notebooks
USER jovyan

# Copy the Jupyter notebook tutorials from the
# build directory to the image working directory
COPY ./*ipynb .


# Add location of the data generator to PYTHONPATH
ENV PYTHONPATH "${PYTHONPATH}:/home/jovyan"
ENV PYTHONPATH "${PYTHONPATH}:/home/jovyan/notebooks/02-ingestion"

Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,15 @@ services:
zookeeper:
image: zookeeper:latest
container_name: zookeeper
profiles: ["druid-jupyter", "all-services"]
ports:
- "2181:2181"
profiles: ["druid-jupyter", "kafka-jupyter", "all-services"]
environment:
- ZOO_MY_ID=1
- ALLOW_ANONYMOUS_LOGIN=yes

kafka:
image: bitnami/kafka:latest
container_name: kafka-broker
profiles: ["all-services"]
profiles: ["kafka-jupyter", "all-services"]
ports:
# To learn about configuring Kafka for access across networks see
# https://www.confluent.io/blog/kafka-client-cannot-connect-to-broker-on-aws-on-docker-etc/
Expand Down Expand Up @@ -163,11 +161,13 @@ services:
context: ..
dockerfile: Dockerfile
container_name: jupyter
profiles: ["jupyter", "druid-jupyter", "all-services"]
profiles: ["jupyter", "kafka-jupyter", "druid-jupyter", "all-services"]
environment:
DOCKER_STACKS_JUPYTER_CMD: "notebook"
JUPYTER_ENABLE_LAB: "yes"
JUPYTER_TOKEN: "docker"
DOCKER_STACKS_JUPYTER_CMD: "lab"
NOTEBOOK_ARGS: "--NotebookApp.token=''"
ports:
- "${JUPYTER_PORT:-8889}:8888"
volumes:
- ./notebooks:/home/jovyan/work
- ../notebooks:/home/jovyan/notebooks
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,15 @@ services:
zookeeper:
image: zookeeper:latest
container_name: zookeeper
profiles: ["druid-jupyter", "all-services"]
ports:
- "2181:2181"
profiles: ["druid-jupyter", "kafka-jupyter", "all-services"]
environment:
- ZOO_MY_ID=1
- ALLOW_ANONYMOUS_LOGIN=yes

kafka:
image: bitnami/kafka:latest
container_name: kafka-broker
profiles: ["all-services"]
profiles: ["kafka-jupyter", "all-services"]
ports:
# To learn about configuring Kafka for access across networks see
# https://www.confluent.io/blog/kafka-client-cannot-connect-to-broker-on-aws-on-docker-etc/
Expand Down Expand Up @@ -161,11 +159,13 @@ services:
jupyter:
image: imply/druid-notebook:latest
container_name: jupyter
profiles: ["jupyter", "druid-jupyter", "all-services"]
profiles: ["jupyter", "kafka-jupyter", "druid-jupyter", "all-services"]
environment:
DOCKER_STACKS_JUPYTER_CMD: "notebook"
JUPYTER_ENABLE_LAB: "yes"
JUPYTER_TOKEN: "docker"
DOCKER_STACKS_JUPYTER_CMD: "lab"
NOTEBOOK_ARGS: "--NotebookApp.token=''"
ports:
- "${JUPYTER_PORT:-8889}:8888"
volumes:
- ./notebooks:/home/jovyan/work
- ../notebooks:/home/jovyan/notebooks
Loading

0 comments on commit 1a9aefb

Please sign in to comment.