Skip to main content

Upgrade DALP and run its database migrations

How the database migration Job runs inside a Helm upgrade, which hook type to choose, and what a failed migration leaves behind for you to inspect.

A dalp Helm upgrade updates the platform release and runs its database migration Job. With the default pre-upgrade hook, the Job must succeed before Helm updates application Deployments. Database changes are separate from the application rollout and do not reverse with helm rollback. Check migration compatibility, recovery points, and any required index rebuild before the upgrade. To move a 3.1 or 3.0 deployment to 3.2, follow Upgrade a deployment to DALP 3.2.

What runs, and when

The dapp subchart renders a Kubernetes Job named <release>-migrations whenever dapp.migrator.enabled is true, which is the shipped default. Set dapp.migrator.enabled: false and no migration runs, so your application pods start against whatever schema the database already has. That setting is for a pipeline that runs migrations through its own tooling before it calls helm upgrade. On every other path, disabling it removes the check between a schema change and a pod that expects it.

dapp.migrator.hookType decides when the Job runs. Only the pre hook is a hard gate.

dapp.migrator.hookType
Runs
Use when
Consequence
pre (default)
pre-install,pre-upgrade hook at weight -5
Postgres is external or already running, as in production
The Job completes before Helm updates the application workloads.
post
post-install,post-upgrade hook at weight 0
The same release also creates the database the migration targets
Helm applies and waits on the workloads before the Job runs, so new pods can start before the migration finishes. A readiness check that needs the new schema can stop the wait from ever reaching the post hook.
none
An ordinary resource in the release, with no hook annotations
Your own pipeline orders migrations outside Helm
Helm's before-hook-creation cleanup and the hook ordering no longer apply, so you own migration ordering.

With pre, the chart also runs <release>-migrations-catchup after rollout (post-install,post-upgrade, weight 10) to migrate rows written by old pods during rollout. Pass --wait to helm upgrade so the catch-up waits until new pods replace old ones. Both Jobs carry app.kubernetes.io/component: migrations (kubectl get jobs -l app.kubernetes.io/component=migrations). Set dapp.migrator.catchUp.enabled: false if a second Job per upgrade is unwanted.

Init containers wait for PostgreSQL (120-second default timeout) and fetch a Conjur token when Conjur is enabled. That wait counts against activeDeadlineSeconds (default 600 seconds, backoffLimit: 3), so a slow database eats into the migration budget before the migration command starts.

The migrator connects directly to PostgreSQL through a dedicated migration Secret, bypassing PgBouncer so session-scoped advisory locks work. Configuration and optional Conjur summon wrapping match the dapp runtime pods.

Optional migration-only variables under dapp.migrator.env:

  • TXSIGNER_DATABASE_URL: reads the legacy pre-3.1 transaction signer database during the 3.2 custody census (see Prepare the custody census).
  • ENCRYPTION_MASTER_PASSWORD and ENCRYPTION_PREVIOUS_MASTER_PASSWORD: runs non-Conjur encryption key rotation (see Encryption at rest).
  • PLATFORM_ADMIN_RECOVERY_EMAIL: restores the platform administrator role to an existing password account for one upgrade (see Restore the platform administrator role).

Under pre, Helm leaves running Deployments untouched until the migration Job succeeds, though migration locks or schema changes can still affect live traffic. Plan upgrades inside a maintenance window.

An index rebuild is never a Helm gate. When a release requires one, the rebuild drains in the background while pods serve, and affected historical read models stay provisional until it finishes. Watch Platform status → Data freshness → Indexing until every network returns from “Reindexing” to “Healthy”.

A migration Job gates the release. An index rebuild never does.A vertical timeline runs down the figure from when helm upgrade starts to well after the release finishes. The migration Job sits directly on that timeline: on its default pre-install and pre-upgrade hook it runs before pods roll to the new version, and a solid gate marker shows the timeline cannot pass this point until the Job succeeds, so a failure stops the release right there while your prior release's serving pods stay untouched. Two independent clocks remove the finished or failed Job afterward: the Helm hook-delete policy, which by default keeps a failed Job until the next upgrade attempt, and a Kubernetes-native ttlSecondsAfterFinished defaulting to 24 hours, whichever fires first. Past the gate, pods roll and the timeline keeps moving. The index rebuild attaches differently: it starts once pods are already rolling, and its own activity is drawn straddling the point where the release reports complete, because the release proceeds regardless of whether the rebuild has finished and the rebuild keeps draining on its own clock afterward. While it drains, the affected chain's status shows as Reindexing in the Indexing detail page, and moves to Healthy once the rebuild finishes.Migration Job blocks. Index rebuild runs alongsideOne obligation gates the release, one never doesHelm upgrade startsMigration jobPre-hook default, before pods rollServing pods stay untouchedA failure blocks the release hereTwo clocks remove the JobHook policy, or a 24h TTLWhichever fires first winsGatePods roll to the new versionIndex rebuildNot a gate, runs after pods rollBehind the healthy deploymentRelease proceeds either wayRelease reports completeFigures stay provisionalShown as Reindexing in theIndexing detail page, then HealthyKeeps draining independently of the releaseA migration Job gates the release. An index rebuild never does.The same figure as the desktop variant, drawn portrait for phone widths. A vertical timeline runs from when helm upgrade starts to well after the release finishes. The migration Job sits directly on that timeline: on its default pre-install and pre-upgrade hook it runs before pods roll to the new version, and a solid gate marker shows the timeline cannot pass this point until the Job succeeds, so a failure stops the release right there while your prior release's serving pods stay untouched. Two independent clocks remove the finished or failed Job afterward: the Helm hook-delete policy, which by default keeps a failed Job until the next upgrade attempt, and a Kubernetes-native ttlSecondsAfterFinished defaulting to 24 hours, whichever fires first. Past the gate, pods roll and the timeline keeps moving. The index rebuild starts once pods are already rolling, and its own activity is drawn straddling the point where the release reports complete, because the release proceeds regardless of whether the rebuild has finished. While it drains, the affected chain's status shows as Reindexing in the Indexing detail page, and moves to Healthy once the rebuild finishes.Migration Job blocks.Index rebuild runs alongsideOne obligation gates the release,One never doesHelm upgrade startsMigration jobPre-hook default, before pods rollServing pods stay untouchedA failure blocks the release hereTwo clocks remove the JobHook policy, or a 24h TTLWhichever fires first winsGatePods roll to the new versionIndex rebuildNot a gate, runs after pods rollBehind the healthy deploymentRelease proceeds either wayRelease reports completeFigures stay provisionalShown as Reindexing in theIndexing detail page, then HealthyKeeps draining independently of the release

The pre-upgrade hook holds the application rollout while the migration runs, and an index rebuild continues alongside without gating the release.

What a failed migration leaves behind

The Job's hook delete policy defaults to before-hook-creation,hook-succeeded, without hook-failed. A hook-failed policy would make Helm delete the failed Job and its pod immediately, which removes the pod-local evidence before you inspect it. Centralised logs may still retain the error. With the default policy, Helm leaves a failed migration Job and its pod in the cluster for you to inspect (kubectl logs job/<release>-migrations, kubectl describe job/<release>-migrations) until the next upgrade attempt, at which point before-hook-creation deletes the previous Job to make room for the new one.

Helm's hook delete policy is not the only cleanup timer. The Job also sets ttlSecondsAfterFinished to 86400 seconds (24 hours), so the cluster deletes finished or failed Jobs after 24 hours regardless of hookDeletePolicy. Raise dapp.migrator.ttlSecondsAfterFinished if your team needs more than 24 hours to pull failure logs.

Before you upgrade

  • Drain waiting workflows (see Drain waiting workflows before you upgrade).
  • A 3.2 migrations Job copies each person's 3.1 KYC profile into one profile per organisation they belong to, then drops the old shared profile, all in one run. If it stops with user profile upgrade unfinished, run the Job again and it copies the rest. Nothing is dropped before every membership has its copy.
  • If the database ran a 3.2 pre-release build, confirm that build finished its migration Job (see Check the starting state).
  • Read the target release notes for any required index rebuild. A migration Job runs on every helm upgrade unless dapp.migrator.enabled: false. See Upgrade to 3.2 and Supply chain and support policy.
  • If your pooler does not track named prepared statements (PgBouncer before 1.21, statement mode, or a session-pinning proxy), set global.dalpApp.config.database.preparedStatementCacheSize: 0 (see Pooler requirements for prepared statements).
  • Confirm PostgreSQL has direct connection headroom inside max_connections and can finish within the 10-minute default dapp.migrator.timeout (see How application pods reach Postgres).
  • If NetworkPolicy is enforced, verify the migration Job's egress rule allows your PostgreSQL host and port. That policy ships at an earlier hook weight, and a wrong rule blocks the pre-upgrade hook before manifests apply.
  • Verify dapp.migrator.ttlSecondsAfterFinished (default 86400 seconds) and size helm upgrade --timeout for both the migration Job and workload rollout (see Helm charts).

Drain waiting workflows before you upgrade

The Workflow Engine replays each waiting workflow from its step journal after a restart. Waiting workflows survive an upgrade only if the new release still reads those step names and data, which the release does not verify automatically. Because funding pauses can stay open up to pauseWindowSeconds (up to 7 days, see Gas settings), finish or cancel waiting workflows before upgrading. Moving from 3.1 to 3.2 also requires Finish in-flight work.

  1. List unfinished workflows per organisation with GET /api/v2/platform-status/workflows-list?limit=500, or open Platform status → Workflows (Platform status).
  2. Check each item's status. Treat both waiting and running as unfinished. Unfinished items appear first, and truncated: true means more rows exist past limit.
  3. Wait for each unfinished workflow to complete, or cancel its operation in the Console.
  4. Re-check until zero items show waiting or running, then run helm upgrade.

Investigate any running workflow with stalled: true before cancelling it (see Platform status troubleshooting).

After you upgrade

All charts in a release share one version (see Subcharts). After the upgrade:

  • Confirm helm list shows the target chart version and helm history <release> shows the expected revision.
  • Confirm both migration Jobs succeeded with kubectl get jobs -l app.kubernetes.io/component=migrations.
  • For releases requiring an index rebuild, open Platform status → Data freshness → Indexing and wait for every network to move from “Reindexing” to “Healthy”.

Rolling back after a bad upgrade

helm rollback <release> <revision> reverts Kubernetes manifests to the prior release, leaving completed schema migrations and altered database rows intact. Rolling back manifests alone after an incompatible schema change leaves older pods running against a newer schema they cannot read.

The same holds for index rebuilds, which run as background indexer work outside Helm hooks and are not reversed by helm rollback.

Retry safety depends on the failed migration and the state it left behind. Treat a failed migration, and any rollback decision that follows it, as a stop-and-inspect event: read the Job's logs, confirm what state the schema is in, and involve whoever owns your database change process before retrying or rolling back. Do not assume a backoffLimit retry is always safe to repeat.

To return to the previous version after a migration changed the schema, restore the recovery point you took before the upgrade, then run helm rollback <release> <revision>. Records written after that recovery point are not in the restored database. Backup and disaster recovery lists what to restore and in what order.

Frequently asked questions

Is a helm upgrade --timeout failure the same thing as a failed migration Job?

No, though both can abort the same upgrade. --timeout bounds how long Helm waits for the whole release, migration Job and every workload's rollout together, before it gives up and reports a timeout. dapp.migrator.timeout (rendered as the Job's activeDeadlineSeconds) bounds only the migration Job itself. A migration that finishes at second 590 of its own 600-second budget can still exceed a --timeout sized for the rollout alone.

Is it safe to remove the previous encryption master password as soon as the migration Job finishes?

Yes for the local secrets, the KYC data and the transaction code secrets in the live database, once that Job has succeeded. The rotation does not re-seal RPC endpoint credentials, beneficial owner declarations, held administrator changes or participant import input, and the guard below does not count them. Keep the previous password until every backup you may restore has aged out, because a restore from an older backup brings back rows sealed under it. Rotation is one of the migration Job's required boot steps, not a separate job, so a row that fails to rotate fails the step, and a failed required step fails the Job. A migration Job that exited successfully has already reported a clean rotation.

The step logs four summary lines, Encrypted secret rotation summary, KYC template values rotation summary, Wallet authenticator secret rotation summary and KYC encryption rotation summary, each with scanned, rotated, skipped and failed counts. A skipped row is already stored under the current key. Check that failed is zero.

When ENCRYPTION_PREVIOUS_MASTER_PASSWORD is empty, the step checks that no data is still sealed under the previous password. When data remains, the step fails the Job with a count of the secret rows, KYC template values, wallet authenticator secrets and KYC objects still under the old key. That guard catches a premature removal at the next upgrade. The guard cannot recover a row sealed under a master password that nobody holds. That row stays unreadable. Encryption at rest covers the two-step sequence.

Was this page helpful?