Deployment instructions
Follow these instructions to deploy the interactive examples to your Databricks workspace or to run them locally.
These samples are experimental and meant for demonstration purposes only. They are provided as-is and without formal support by Databricks. Ensure your organization's security, compliance, and operational best practices are applied before deploying them to production.
Deploy to Databricks
- Navigate to the databricks-apps-cookbook GitHub repository and load it a Databricks Git folder in your Databricks workspace.
- In your Databricks workspace, switch to Compute -> Apps.
- Choose Create app.
- Under Choose how to start, select Custom and choose Next.
- Provide a name for your app and choose Create app.
- Once your app compute has started, choose Deploy.
- Navigate to your new Git folder and select either the
dash
orstreamlit
folder. - Choose Deploy.
Check the Requirements tab of each recipe to understand what service principal permissions, Databricks resources, and Python packages are required to use it.
Run locally
-
Clone the databricks-apps-cookbook GitHub repository or your fork to your local machine and switch into the
databricks-apps-cookbook
folder:git clone https://github.com/pbv0/databricks-apps-cookbook.git
cd databricks-apps-cookbook -
Navigate to the sub-folder for the cookbook framework you want to run (either
dash
orstreamlit
). Create and activate a Python virtual environment in this foldervenv
. We recommend using separate environments for each framework:cd streamlit
python3 -m venv .venv
source .venv/bin/activate -
Install required packages:
pip install -r requirements.txt
-
Install the Databricks CLI and authenticate with your Databricks workspace using OAuth U2M, for example:
databricks auth login --host https://my-workspace.cloud.databricks.com/
-
Set required environment variables:
export DATABRICKS_HOST=https://my-workspace.cloud.databricks.com/
-
Run the cookbook app locally (make sure your virtual environment is activated).
Streamlit:
streamlit run app.py
Dash:
python app.py
Make sure you have a working network connection to your Databricks workspace. Some samples may only work when running on Databricks Apps and not locally, e.g., retrieving information from HTTP headers to identify users.