Commit 282f0ad
Hotfix/sqlite rescue (#48)
* Add SQLite rescue for Databricks Apps persistence
Databricks Apps containers are ephemeral - SQLite databases are lost on
container restarts during platform updates. This adds a rescue module that:
- Restores DB from Unity Catalog Volume on startup (before migrations)
- Backs up DB to Volume on shutdown (SIGTERM/SIGINT handlers)
- Periodic backup after N write operations (configurable, default 50)
- Exposes rescue status in /health/detailed endpoint
Configuration via environment variables:
- SQLITE_VOLUME_BACKUP_PATH: Volume path for backup
- SQLITE_BACKUP_AFTER_OPS: Write ops before auto-backup
Also documents Databricks Apps authentication (service principals,
automatic credential injection, resource permissions) in the spec.
Co-Authored-By: Claude <noreply@anthropic.com>
* Update deploy recipe to use Databricks CLI directly
The old deploy.sh script was removed. Updated the `just deploy` recipe
to use the Databricks CLI directly for syncing and deploying:
- Syncs files to workspace (excluding .git, node_modules, etc.)
- Deploys app using `databricks apps deploy`
- Uses DATABRICKS_CONFIG_PROFILE and DATABRICKS_APP_NAME from .env.local
- Updated setup message to reference `just deploy`
Co-Authored-By: Claude <noreply@anthropic.com>
* Run npm install in ui-build if dependencies are stale
The ui-build recipe now checks if npm install needs to run by comparing
package.json modification time against node_modules. This ensures builds
don't fail due to missing dependencies while avoiding unnecessary installs.
Co-Authored-By: Claude <noreply@anthropic.com>
* Auto-create Databricks app if it doesn't exist
The deploy recipe now checks if the app exists before deploying.
If not, it creates the app first using `databricks apps create`.
Co-Authored-By: Claude <noreply@anthropic.com>
* Add root package.json for Databricks Apps Node.js build
Databricks Apps looks for package.json at the root to detect Node.js
projects. Added a root package.json that delegates to client/:
- Root package.json with build script that runs client build
- Removed npx from client scripts (not available in Databricks env)
- Simplified deploy recipe to let Databricks handle the build
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix SQLite rescue for Unity Catalog volume paths
The previous implementation failed because:
1. It tried to create parent directories under /Volumes which is not allowed
2. It didn't validate the UC volume path format
3. The volume must already exist - we can't create it
Fixed by:
- Added _validate_volume_path() to check path format early
- Added _get_volume_root() to extract and verify volume accessibility
- Don't call mkdir() for UC volume destinations
- Validate configuration at startup and fail fast with clear error
- Added path_valid, path_error, volume_accessible to status endpoint
Expected path format: /Volumes/<catalog>/<schema>/<volume>/workshop.db
Co-Authored-By: Claude <noreply@anthropic.com>
* Refactor SQLite rescue to use Databricks SDK Files API
Databricks Apps do NOT support FUSE mounts for UC volumes. This refactors
the sqlite_rescue module to use the Databricks SDK Files API instead of
direct filesystem operations.
Changes:
- Use WorkspaceClient.files.download/upload instead of shutil.copy
- Add _get_workspace_client() for cached SDK client
- Add _file_exists_on_volume() using files.get_status()
- Support SQLITE_VOLUME_PATH env var (base path, appends /workshop.db)
- Improve restore logic: try download directly, handle NotFound gracefully
- Add detailed logging to debug file operations
- Update app.yaml with valueFrom configuration example
- Update BUILD_AND_DEPLOY_SPEC.md documentation
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 05fb6fd commit 282f0ad
8 files changed
Lines changed: 789 additions & 13 deletions
File tree
- client
- server
- specs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
248 | 257 | | |
249 | 258 | | |
250 | 259 | | |
| |||
342 | 351 | | |
343 | 352 | | |
344 | 353 | | |
345 | | - | |
346 | | - | |
347 | | - | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
348 | 385 | | |
349 | 386 | | |
350 | 387 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
20 | 26 | | |
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
24 | 45 | | |
25 | 46 | | |
26 | 47 | | |
27 | 48 | | |
28 | 49 | | |
29 | 50 | | |
30 | 51 | | |
| 52 | + | |
| 53 | + | |
31 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
32 | 61 | | |
33 | 62 | | |
34 | 63 | | |
| |||
113 | 142 | | |
114 | 143 | | |
115 | 144 | | |
116 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
117 | 155 | | |
118 | 156 | | |
119 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
73 | 85 | | |
74 | 86 | | |
75 | 87 | | |
| |||
0 commit comments