Upgrade Guide
Lakemeter includes a version-aware upgrade utility at scripts/upgrade.sh. It
discovers the existing installation, validates the checked-out release, applies
the release's Semantic Versioning policy, and verifies the deployed app and its
database connection.
The upgrader applies the release that is present in your local checkout. It does not download a release automatically. Update the repository, check out the desired release tag, or download a fresh release archive before upgrading.
Upgrade policy
Lakemeter uses the following release policy:
- Patch release (
0.1.0to0.1.1): application code only. The upgrader does not stop, back up, or modify Lakebase. - Minor release (
0.1.1to0.2.0): data-only database updates. The upgrader creates a Lakebase backup branch before applying them. - Major release (
0.x.xto1.0.0, or1.x.xto2.0.0): schema migrations, optionally followed by data updates. The upgrader creates a Lakebase backup branch first.
Database release lines cannot be skipped. For example, upgrade through a
required 0.2.x data release before moving to 0.3.0.
Prerequisites
Before starting:
- Install the Databricks CLI and authenticate a workspace profile.
- Use a clean checkout of the release you want to install.
- Confirm the existing Databricks App is running.
- For minor or major releases, ensure the installation uses Lakebase Autoscaling project, branch, and endpoint bindings.
Verify CLI access:
databricks current-user me --profile <profile>
Prepare a release checkout:
git fetch --tags
git checkout <release-tag>
git status --short
git status --short should return no output. Production upgrades reject a
dirty checkout.
Check the installation
Run these read-only commands before applying a release:
./scripts/upgrade.sh status --profile <profile>
./scripts/upgrade.sh plan --profile <profile>
./scripts/upgrade.sh doctor --profile <profile>
Use --app-name <name> when the app is not named lakemeter.
status
Shows the discovered installation version, app source, Lakebase resources, and the latest recorded upgrade run.
plan
Validates the release manifest and runtime checksum, then reports:
- Installed and target versions
- Patch, minor, major, or same-version transition
- Declared migrations and data updates
- Whether a database backup is required
- Discovery warnings that should be reviewed before applying
doctor
Checks workspace access, app discovery, release policy, payload integrity, and the backup prerequisites required by the current release.
Do not apply a release while doctor reports blocked.
Installations created by the current installer already expose the Lakebase
Autoscaling project, production branch, primary endpoint, and their secret
bindings. If a future database-changing release reports missing branch or
endpoint bindings for an older installation, update to the latest patch and
run the current installer once. The installer reuses the existing project and
app and adds the required bindings without deleting estimates.
Apply an upgrade
Run the plan and doctor checks first, then apply:
./scripts/upgrade.sh apply --profile <profile>
The command asks for confirmation. For unattended automation:
./scripts/upgrade.sh apply --profile <profile> --yes
Use --allow-dirty only when developing the upgrade utility. It should not be
used for production upgrades.
What happens during an upgrade
Every release follows these common steps:
-
Discover the deployed app, installed version, active source path, Lakebase resources, and secret bindings.
-
Validate the release manifest, Semantic Versioning transition, action checksums, and complete runtime checksum.
-
Acquire a workspace run lock so two upgrades cannot run concurrently.
-
Stage an immutable runtime at:
<app-source>/releases/v<version> -
Preserve the installation's existing
app.yamland resource bindings. -
Deploy the versioned runtime.
-
Call the authenticated health and version endpoints.
-
Require the expected app version and a successful database connection.
-
Record the completed release and deployment in workspace state.
Patch releases
Patch upgrades stage and deploy application code only. Lakebase remains online and is not modified.
Minor and major releases
Before changing the database, the upgrader:
- Connects with a short-lived Lakebase OAuth credential.
- Acquires a PostgreSQL advisory lock.
- Stops the app to prevent writes during the backup and database update.
- Creates a copy-on-write branch from the production branch.
- Ensures the backup branch has a queryable endpoint.
- Executes each declared database action in manifest order.
- Restarts the app, deploys the new runtime, and verifies it.
Minor releases can execute only declared data updates. Major releases can execute schema migrations and data updates.
Idempotency and interrupted runs
The upgrader is safe to run repeatedly:
- Applying an already-installed version returns
no_change. - A successful versioned runtime cannot be overwritten with different content.
- Completed phases are recorded and reused when a run resumes.
- Completed data updates are not executed again.
- Schema migrations are recorded with their checksums.
- Workspace and PostgreSQL locks prevent concurrent upgrade runs.
The upgrader intentionally does not replay a database action marked started
when its commit result is unknown after an interruption. Replaying it could
duplicate a non-idempotent change. The upgrader fails safely and rolls back to
the recorded recovery point instead.
Release SQL should still be written defensively, using transactions and idempotent statements where practical.
Automatic recovery
If an upgrade fails, the upgrader attempts to:
- Release the database advisory lock.
- Repoint database secrets to the pre-upgrade backup branch, when one exists.
- Redeploy the previous application source.
- Restart the app.
- Restore the previous installation metadata.
- Record any rollback errors for operator review.
Patch failures restore only the previous application because patch releases do not create database backups.
Manual rollback
To roll back the latest recorded upgrade:
./scripts/upgrade.sh rollback --profile <profile>
For a database-changing release, rollback points the app to the backup branch and deploys the previous application source. It does not overwrite the original production branch.
After rollback:
./scripts/upgrade.sh status --profile <profile>
Then confirm the app's health endpoint:
https://<app-url>/api/v1/system/health
Expected response:
{
"status": "healthy",
"database": "connected"
}
Troubleshooting
Repository has uncommitted changes
Use a clean release checkout. Do not use --allow-dirty to bypass this check
for a production installation.
Installed version cannot be discovered
Older installations without version metadata are treated as the legacy
baseline version. Review the warning in plan before applying.
Database backup capability is blocked
Confirm the app has secret resources for:
lakebase-projectlakebase-branchlakebase-endpointlakebase-host
The current installer configures these automatically.
Another upgrade holds the lock
Check status for an active run. Do not manually remove a lock while an
upgrade job is still running.
Deployment verification fails
Review the Databricks App deployment logs and the upgrade run output. The upgrader will already have attempted automatic recovery.