diff --git a/examples/quickstart/jupyter-notebooks/docker-jupyter/docker-compose-local.yaml b/examples/quickstart/jupyter-notebooks/docker-jupyter/docker-compose-local.yaml index 197b8b3722e..2525fc485cd 100644 --- a/examples/quickstart/jupyter-notebooks/docker-jupyter/docker-compose-local.yaml +++ b/examples/quickstart/jupyter-notebooks/docker-jupyter/docker-compose-local.yaml @@ -71,7 +71,7 @@ services: - KAFKA_ENABLE_KRAFT=false coordinator: - image: apache/druid:${DRUID_VERSION} + image: apache/druid:${DRUID_VERSION:-26.0.0} container_name: coordinator profiles: ["druid-jupyter", "all-services"] volumes: @@ -88,7 +88,7 @@ services: - environment broker: - image: apache/druid:${DRUID_VERSION} + image: apache/druid:${DRUID_VERSION:-26.0.0} container_name: broker profiles: ["druid-jupyter", "all-services"] volumes: @@ -105,7 +105,7 @@ services: - environment historical: - image: apache/druid:${DRUID_VERSION} + image: apache/druid:${DRUID_VERSION:-26.0.0} container_name: historical profiles: ["druid-jupyter", "all-services"] volumes: @@ -123,7 +123,7 @@ services: - environment middlemanager: - image: apache/druid:${DRUID_VERSION} + image: apache/druid:${DRUID_VERSION:-26.0.0} container_name: middlemanager profiles: ["druid-jupyter", "all-services"] volumes: @@ -142,7 +142,7 @@ services: - environment router: - image: apache/druid:${DRUID_VERSION} + image: apache/druid:${DRUID_VERSION:-26.0.0} container_name: router profiles: ["druid-jupyter", "all-services"] volumes: @@ -169,6 +169,8 @@ services: JUPYTER_TOKEN: "docker" DOCKER_STACKS_JUPYTER_CMD: "lab" NOTEBOOK_ARGS: "--NotebookApp.token=''" + DRUID_HOST: "${DRUID_HOST:-router}" + KAFKA_HOST: "${KAFKA_HOST:-kafka}" ports: - "${JUPYTER_PORT:-8889}:8888" volumes: diff --git a/examples/quickstart/jupyter-notebooks/docker-jupyter/docker-compose.yaml b/examples/quickstart/jupyter-notebooks/docker-jupyter/docker-compose.yaml index 932df6a22b4..b0b2d206e5d 100644 --- a/examples/quickstart/jupyter-notebooks/docker-jupyter/docker-compose.yaml +++ b/examples/quickstart/jupyter-notebooks/docker-jupyter/docker-compose.yaml @@ -71,7 +71,7 @@ services: - KAFKA_ENABLE_KRAFT=false coordinator: - image: apache/druid:${DRUID_VERSION} + image: apache/druid:${DRUID_VERSION:-26.0.0} container_name: coordinator profiles: ["druid-jupyter", "all-services"] volumes: @@ -88,7 +88,7 @@ services: - environment broker: - image: apache/druid:${DRUID_VERSION} + image: apache/druid:${DRUID_VERSION:-26.0.0} container_name: broker profiles: ["druid-jupyter", "all-services"] volumes: @@ -105,7 +105,7 @@ services: - environment historical: - image: apache/druid:${DRUID_VERSION} + image: apache/druid:${DRUID_VERSION:-26.0.0} container_name: historical profiles: ["druid-jupyter", "all-services"] volumes: @@ -123,7 +123,7 @@ services: - environment middlemanager: - image: apache/druid:${DRUID_VERSION} + image: apache/druid:${DRUID_VERSION:-26.0.0} container_name: middlemanager profiles: ["druid-jupyter", "all-services"] volumes: @@ -142,7 +142,7 @@ services: - environment router: - image: apache/druid:${DRUID_VERSION} + image: apache/druid:${DRUID_VERSION:-26.0.0} container_name: router profiles: ["druid-jupyter", "all-services"] volumes: @@ -167,6 +167,8 @@ services: JUPYTER_TOKEN: "docker" DOCKER_STACKS_JUPYTER_CMD: "lab" NOTEBOOK_ARGS: "--NotebookApp.token=''" + DRUID_HOST: "${DRUID_HOST:-router}" + KAFKA_HOST: "${KAFKA_HOST:-kafka}" ports: - "${JUPYTER_PORT:-8889}:8888" volumes: diff --git a/examples/quickstart/jupyter-notebooks/notebooks/99-contributing/notebook-template.ipynb b/examples/quickstart/jupyter-notebooks/notebooks/99-contributing/notebook-template.ipynb new file mode 100644 index 00000000000..8f815693b3d --- /dev/null +++ b/examples/quickstart/jupyter-notebooks/notebooks/99-contributing/notebook-template.ipynb @@ -0,0 +1,129 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "0cb3b009-ebde-4d56-9d59-a028d66d8309", + "metadata": {}, + "source": [ + "# Title\n", + "\n", + "Introduction to Notebook\n", + "Lorem Ipsum" + ] + }, + { + "cell_type": "markdown", + "id": "bbdbf6ad-ca7b-40f5-8ca3-1070f4a3ee42", + "metadata": {}, + "source": [ + "## Prerequisites\n", + "\n", + "This tutorial works with Druid XX.0.0 or later.\n", + "\n", + "Launch this tutorial and all prerequisites using the `all-services` profile of the Docker Compose file for Jupyter-based Druid tutorials. For more information, see [Docker for Jupyter Notebook tutorials](https://druid.apache.org/docs/latest/tutorials/tutorial-jupyter-docker.html).\n" + ] + }, + { + "cell_type": "markdown", + "id": "7ee6aef8-a11d-48d5-bcdc-e6231ba594b7", + "metadata": {}, + "source": [ + "
\n", + "Run without Docker Compose \n", + "\n", + "\n", + "In order to run this notebook you will need:\n", + "\n", + "Required Services\n", + "* \n", + "\n", + "Python packages\n", + "* druidapi, a [Python client for Apache Druid](https://github.com/apache/druid/blob/master/examples/quickstart/jupyter-notebooks/druidapi/README.md)\n", + "* \n", + "
" + ] + }, + { + "cell_type": "markdown", + "id": "5007a243-b81a-4601-8f57-5b14940abbff", + "metadata": {}, + "source": [ + "### Initialization" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c1ec783b-df3f-4168-9be2-cdc6ad3e33c2", + "metadata": {}, + "outputs": [], + "source": [ + "import druidapi\n", + "import os\n", + "\n", + "if 'DRUID_HOST' not in os.environ.keys():\n", + " druid_host=f\"http://localhost:8888\"\n", + "else:\n", + " druid_host=f\"http://{os.environ['DRUID_HOST']}:8888\"\n", + " \n", + "print(f\"Opening a connection to {druid_host}.\")\n", + "druid = druidapi.jupyter_client(druid_host)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c075de81-04c9-4b23-8253-20a15d46252e", + "metadata": {}, + "outputs": [], + "source": [ + "# INCLUDE THIS CELL IF YOUR NOTEBOOK USES KAFKA \n", + "# Use kafka_host variable when connecting to kafka \n", + "import os\n", + "\n", + "if 'KAFKA_HOST' not in os.environ.keys():\n", + " kafka_host=f\"http://localhost:9092\"\n", + "else:\n", + " kafka_host=f\"{os.environ['KAFKA_HOST']}:9092\"" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}