Skip to content

Upgrading Self-Hosted Provon

Upgrade a self-hosted deployment deliberately, with a verified backup and a quick rollback path. This page states the compatibility policy and the common sequence; Operations covers backup mechanics and runtime-specific monitoring.

Development Compatibility Policy#

The project is under active development. Refactors update all consumers directly, keep no compatibility shims, and maintain only the current initialization baseline. Historical data migration is not part of the development release workflow. Preserve a recovery copy before any future production schema change; application rollback does not restore data automatically.

Before Every Upgrade#

  1. Read the GitHub Release notes for the target version.
  2. Check for a version-specific upgrade note (docs/upgrades/v<version>.md) when one exists for the target release.
  3. Create a coordinated backup of metadata, usage aggregates, raw telemetry/usage facts, blobs, and PROVON_AUTH_SECRET. The jobs database holds only in-flight background work; restoring without it loses queued work but no durable records. Gateway in-flight reservations are reconstructed on restart.
  4. Verify the backup in an isolated environment before touching production.
  5. Record the current application version and configuration revision.

Upgrade Steps: Node / Docker#

  1. Stop new traffic at the reverse proxy.
  2. Allow in-flight requests and background work to finish.
  3. Send SIGTERM and wait for graceful shutdown.
  4. Back up the persistent data directory.
  5. Start one new container or process with the target image or version against the same data directory.
  6. Wait for startup migrations to complete.
  7. Run verification checks:
    • GET /healthz;
    • sign-in;
    • project API key creation;
    • OTLP ingest;
    • Gateway request and trace visibility;
    • diagnostic Rule execution;
    • Connector actions, if enabled.
  8. Resume traffic only after all checks pass.
  9. Retain the previous image until the release is accepted.

Do not run old and new Node processes concurrently against one local data directory.

Upgrade Steps: Cloudflare#

  1. Read release notes and any version-specific upgrade notes.
  2. Run pnpm test:cf.
  3. Export D1 metadata and metering aggregate databases.
  4. Apply any required Basin Catalog maintenance change.
  5. Run pnpm release:build && pnpm release:check && pnpm release:publish.
  6. Verify each deployment and the complete asynchronous evidence path.
  7. Watch queue lag, D1 errors, warehouse writes, and Basin SQL reads through the rollout window.

Publishing does not initialize D1; run pnpm release:db-init --remote when the schema baseline must be applied to remote databases.

Rollback#

Application rollback changes code only; it does not restore the current initialization baseline or reverse changes to persistent stores. This development workflow provides no historical migration or cross-version compatibility guarantee. To recover a live environment:

  1. Stop the new process or Worker deployment.
  2. Restore the data directory or D1 export from the pre-upgrade backup.
  3. Start the previous application version against the restored data.
  4. Verify end-to-end before resuming traffic.

Version-Specific Upgrade Notes#

Releases that need steps beyond this general guide carry notes in docs/upgrades/v<version>.md; these files are linked from the GitHub Release notes when they exist.

Tiered usage-fact storage#

Current builds split metering into a three-layer model: per-record raw usage_facts in the telemetry warehouse (DuckDB on Node, the Warehouse Container/Iceberg on Cloudflare), additive usage_fact_daily/usage_fact_period accumulators plus a usage_fact_receipts table in the metering database. There is no historical backfill; the metering baseline is recreated fresh.

Receipts share raw fact identities and retain pending delivery payloads until the warehouse acknowledges them. New incremental facts older than 90 days are rejected; expired, delivered receipts can be pruned, while pending receipts remain recoverable. Retries must preserve original occurrence times. Historical corrections use the aggregate rebuild procedure after pending warehouse deliveries have completed.

When deploying this change to an environment that already runs the pipeline:

  1. Drain the ingest and gateway-telemetry queues so no writer straddles the cutover.
  2. Flush pending usage out of the commercial wallet durable object before the new code starts writing markers (SaaS only).
  3. Bind the telemetry warehouse executor (PROVON_TELEMETRY_WAREHOUSE_EXECUTOR) on every worker that records usage (API, telemetry pipeline, diagnostics, maintenance, and the gateway durable object on SaaS). The raw append fails closed when the binding is absent.
  4. Apply the fresh metering baseline and the warehouse usage_facts table together with the new code. After cutover, aggregates are rebuilt on demand from the raw table rather than from any pre-cutover row log.

To repair divergence after a partial failure, trigger the on-demand rebuild for one organization and billing period:

  • Cloudflare: POST /admin/usage-aggregates/rebuild on the maintenance worker with Authorization: Bearer <PROVON_AUTH_SECRET> and { "organizationId", "startDay", "endDay", "periodStart" }.
  • Node: run provon-rebuild-usage --organization-id <id> --start-day YYYY-MM-DD --end-day YYYY-MM-DD [--period-start <epoch-ms>] (the same usageAggregateRebuilder is also exposed on the server runtime). The anchor defaults to the UTC natural month of start-day; pass --period-start for a different billing period.

Release Independence#

Public Node releases and the Cloudflare demo deployment use isolated resource coordinates and are published independently. Never point one deployment at the other's database, queue, or bucket resources, and do not reuse generated IDs across environments.