|
| 1 | +--- |
| 2 | +sidebar_position: 5 |
| 3 | +--- |
| 4 | + |
| 5 | +# Configuration |
| 6 | + |
| 7 | +This guide covers environment variables and configuration options for AppKit applications. |
| 8 | + |
| 9 | +## App deployment configuration |
| 10 | + |
| 11 | +### `app.yaml` file |
| 12 | + |
| 13 | +The `app.yaml` file configures your app's runtime environment in Databricks Apps. |
| 14 | + |
| 15 | +**Basic example:** |
| 16 | + |
| 17 | +```yaml |
| 18 | +command: |
| 19 | + - node |
| 20 | + - build/index.mjs |
| 21 | +env: |
| 22 | + - name: DATABRICKS_WAREHOUSE_ID |
| 23 | + valueFrom: sql-warehouse |
| 24 | +``` |
| 25 | +
|
| 26 | +### Command specification |
| 27 | +
|
| 28 | +Specify how to start your app in the `command` field: |
| 29 | + |
| 30 | +```yaml |
| 31 | +command: |
| 32 | + - node |
| 33 | + - build/index.mjs |
| 34 | +``` |
| 35 | + |
| 36 | +This runs the production build of your AppKit server (created by `npm run build`). |
| 37 | + |
| 38 | +### Binding a SQL warehouse |
| 39 | + |
| 40 | +To use the analytics plugin, bind a SQL warehouse in your `app.yaml`: |
| 41 | + |
| 42 | +```yaml |
| 43 | +env: |
| 44 | + - name: DATABRICKS_WAREHOUSE_ID |
| 45 | + valueFrom: sql-warehouse |
| 46 | +``` |
| 47 | + |
| 48 | +This makes the warehouse ID available to your app at runtime. The `valueFrom: sql-warehouse` directive tells Databricks Apps to inject the configured warehouse ID. |
| 49 | + |
| 50 | +For advanced configuration options (authorization, networking, resource limits), see the [Databricks Apps Configuration](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/configuration) documentation. |
| 51 | + |
| 52 | +## Environment variables |
| 53 | + |
| 54 | +### Required for Databricks Apps deployment |
| 55 | + |
| 56 | +These are typically **provided by Databricks Apps runtime** (exact set can vary by platform/version): |
| 57 | + |
| 58 | +| Variable | Description | |
| 59 | +|----------|-------------| |
| 60 | +| `DATABRICKS_HOST` | Workspace URL (e.g. `https://xxx.cloud.databricks.com`) | |
| 61 | +| `DATABRICKS_APP_PORT` | Port to bind (default: `8000`) | |
| 62 | +| `DATABRICKS_APP_NAME` | App name in Databricks | |
| 63 | + |
| 64 | +### Required for SQL queries (analytics plugin) |
| 65 | + |
| 66 | +| Variable | Description | How to Set | |
| 67 | +|----------|-------------|------------| |
| 68 | +| `DATABRICKS_WAREHOUSE_ID` | SQL warehouse ID | In `app.yaml`: `valueFrom: sql-warehouse` | |
| 69 | + |
| 70 | +See the [App deployment configuration](#app-deployment-configuration) section above for details on how to bind this variable. |
| 71 | + |
| 72 | +### Optional variables |
| 73 | + |
| 74 | +| Variable | Description | Default | |
| 75 | +|----------|-------------|---------| |
| 76 | +| `DATABRICKS_WORKSPACE_ID` | Workspace ID | Auto-fetched from API | |
| 77 | +| `NODE_ENV` | `"development"` or `"production"` | — | |
| 78 | +| `FLASK_RUN_HOST` | Host to bind | `0.0.0.0` | |
| 79 | + |
| 80 | +### Telemetry (optional) |
| 81 | + |
| 82 | +| Variable | Description | |
| 83 | +|----------|-------------| |
| 84 | +| `OTEL_EXPORTER_OTLP_ENDPOINT` | OpenTelemetry collector endpoint | |
| 85 | +| `OTEL_SERVICE_NAME` | Service name for traces | |
| 86 | + |
| 87 | +## Local development authentication |
| 88 | + |
| 89 | +For local development, you need to authenticate with Databricks. Choose one of the following options: |
| 90 | + |
| 91 | +### Option 1: Databricks CLI authentication (recommended) |
| 92 | + |
| 93 | +Configure authentication once using the Databricks CLI: |
| 94 | + |
| 95 | +```bash |
| 96 | +databricks auth login --host [host] --profile [profile-name] |
| 97 | +``` |
| 98 | + |
| 99 | +If you use `DEFAULT` as the profile name, you can run your dev server directly: |
| 100 | + |
| 101 | +```bash |
| 102 | +npm run dev |
| 103 | +``` |
| 104 | + |
| 105 | +To run with a specific profile, set the `DATABRICKS_CONFIG_PROFILE` environment variable: |
| 106 | + |
| 107 | +```bash |
| 108 | +DATABRICKS_CONFIG_PROFILE=my-profile npm run dev |
| 109 | +``` |
| 110 | + |
| 111 | +Note: Some Databricks SDK versions use `DATABRICKS_PROFILE` instead of `DATABRICKS_CONFIG_PROFILE`. |
| 112 | + |
| 113 | +### Option 2: Environment variables |
| 114 | + |
| 115 | +```bash |
| 116 | +export DATABRICKS_HOST="https://xxx.cloud.databricks.com" |
| 117 | +export DATABRICKS_TOKEN="dapi..." |
| 118 | +export DATABRICKS_WAREHOUSE_ID="abc123..." |
| 119 | +npm run dev |
| 120 | +``` |
| 121 | + |
| 122 | +### Option 3: `.env` file (auto-loaded by AppKit) |
| 123 | + |
| 124 | +Create a `.env` file in your project root (add to `.gitignore`!): |
| 125 | + |
| 126 | +```bash |
| 127 | +DATABRICKS_HOST=https://xxx.cloud.databricks.com |
| 128 | +DATABRICKS_TOKEN=dapi... |
| 129 | +DATABRICKS_WAREHOUSE_ID=abc123... |
| 130 | +``` |
| 131 | + |
| 132 | +Then run: |
| 133 | + |
| 134 | +```bash |
| 135 | +npm run dev |
| 136 | +``` |
| 137 | + |
| 138 | +## Advanced configuration |
| 139 | + |
| 140 | +For advanced Databricks Apps configuration (authorization, networking, resource limits), refer to the [Databricks Apps Configuration](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/configuration) documentation. |
| 141 | + |
| 142 | +## See also |
| 143 | + |
| 144 | +- [App management](./app-management.mdx) - Deploying and managing apps |
| 145 | +- [Plugins](./plugins.md) - Plugin configuration options |
0 commit comments