Safe Medplum rollbacks with deferred post-deploy migrations

A self-hosted Medplum minor upgrade can be reversed only until its post-deploy migrations run. This page explains how to keep that window open, validate the new version and decide when rolling back is still safe.

On this page

Why a Medplum rollback window matters before you upgrade

A self-hosted Medplum team that must move to a newer minor version needs a way back if the new release misbehaves in production. The rollback window is kept open by setting disablePostDeployMigrations to true before the upgrade, and it closes once the new minor's post-deploy migrations run. Until that point, the previous minor's latest patch remains a valid rollback target, so the decision to start those migrations is the point where the team gives up the simple way back.

Self-hosted upgrades cannot skip versions. The Medplum upgrading guide requires you to move through each minor version in sequence, and skipping one causes startup failures. That means every stop on the path is a separate rollback decision, and a team planning from its current version to a target must know at each stop whether the window is still open. Confirm your current minor, the target minor and every intermediate minor before scheduling any work, because a rollback target is always the previous minor's latest patch and not an older release.

The rollback path covers only the latest patch of the previous minor, so the release you roll back to must be the one you tested against. Post-deploy migrations can run for hours or days on large datasets, so a team that lets them start without a validation plan may find that reverting is no longer available for a long stretch of time. Before you upgrade, record the version you would return to, confirm it is the latest patch of its minor, and agree who holds the Super Admin role that triggers the deferred migrations and when.

What changes between Medplum minor versions and what it means for rollback

This table separates the kinds of change a Medplum minor upgrade can carry, from additive schema changes to post-deploy data reshaping, and shows how each one affects your ability to roll back. Read it before you start an upgrade so you know which step closes the rollback window. Confirm the release notes for each target minor on the GitHub releases page before you schedule the work.

ChangeImpact on rollbackAction needed
Pre-deploy schema changesAdditive and tolerated by the previous minor since the 4.x series, so the prior version can still run against the changed schemaConfirm in the target minor's release notes that the change is additive, then deploy it while keeping the old server image available
Post-deploy migrationsIrreversible data reshaping; once they run, the previous minor cannot be relied on to read the dataTreat the moment they start as the close of the rollback window and record the time it happens
disablePostDeployMigrations set to trueHolds post-deploy migrations back so the rollback window stays open to the latest patch of the previous minorSet the option before deploying the new minor and confirm it is in effect in the running configuration
Rollback to the previous minor's latest patchAvailable only while no post-deploy migrations for the new minor have runCheck the async job records for the new minor before any rollback decision, and roll back to the latest patch of the previous minor, not an earlier one
Triggering post-deploy migrations manuallyA Super Admin starts them, which ends the rollback window for that minorPlan a validation period on the new version first, then assign a named Super Admin and a go or no-go owner for the trigger
Skipping a minor versionStartup failures are reported when a minor is skipped, for example from v3.1.2 straight to v4.3.4, so skipping does not produce a usable rollback pathStep through each minor in sequence and confirm the rollback window for each stop in your upgrade plan
Long-running data migrations on large datasetsCan run for hours or days, so the window to validate and decide is longer than a typical deployment windowAsk the vendor and your own staging environment to estimate run time from a copy of production data before you commit to a schedule

How disablePostDeployMigrations keeps the rollback path open

Setting disablePostDeployMigrations to true is the control that keeps a Medplum minor upgrade reversible. With it set, the new minor version deploys its pre-deploy schema changes, which are additive and tolerated by the previous minor, and the server starts without running the post-deploy migrations that reshape data. While those migrations have not run, the team can roll back to the latest patch of the previous minor version. The rollback window stays open for as long as the data is still in the shape the old version expects, so the team's job is to hold that state deliberately until it is ready to commit.

The post-deploy migrations are the irreversible step. They do the data reshaping that the previous minor cannot read, so running them is the point of no return. With the setting enabled, a Super Admin triggers them manually once the team has validated the new version against its own workloads. That turns the decision into a named, auditable action with a person accountable for it, rather than something the server does on the first restart. Plan who holds the Super Admin role during the window and make sure that person is available when the validation checks pass.

Confirm the exact location and syntax of the key for your deployment method before you rely on it. The configuration key path and format differ between AWS CDK, Helm and other installs, so check the Medplum enabling rollbacks guide and test the setting in staging, confirming that the server reports it as applied. A setting you believe is active but is not will leave you without a rollback path at the moment you need one.

What to prepare before the new minor goes live

Five items need to exist before the new minor version is deployed to production. Each one answers a question you will need during a rollback: what data you can restore, which integrations would break, whether the path was tested, who decides, and which patch you return to. Assemble them together so the rollback window is planned rather than improvised.

Verified database backup

Take a full PostgreSQL backup immediately before the upgrade and restore it into a separate instance to confirm it is readable. Record the backup time and the Medplum version running at that moment. This backup is your only path back if a change outside the rollback guarantees has to be reversed, so an untested backup does not count as a rollback plan.

Enabling rollbacks guide

Inventory of Bots and integrations

List every custom Bot, Subscription and client integration that reads from or writes to Medplum, with its owner and the Medplum version it was built against. Check each one against the new minor's release notes. Rolling back the server does not roll back the code in these integrations, so any client already written for the new version needs a path back as well.

Staging environment on the same sequence

Run the same minor sequence in staging that production will follow, starting from the same patch and using a copy of production-shaped data. Confirm that the pre-deploy changes start cleanly and that the previous minor still runs against the migrated schema. Staging is where you learn whether the rollback path works before you rely on it.

Named rollback decision owner

Name one person who can decide to roll back, with a stated time limit for that decision and a deputy for when they are unavailable. Agree in writing which symptoms trigger the decision, such as failed sign-ins, Bot errors or data inconsistencies. Without a named owner, teams often hesitate past the point where rolling back is still safe.

Record of the running patch version

Write down the exact patch version currently in production, for example the full three-part version number rather than the minor line. The rollback guarantee applies to the latest patch of the previous minor, so the target you return to must be known in advance. Keep this record with the deployment configuration so that whoever runs the rollback does not have to guess.

How to run a rollback-safe minor upgrade step by step

This sequence keeps a clear rollback point open from the moment the new minor is serving traffic until its post-deploy migrations have run and finished. It gives the operator a defined place to stop, validate and decide before any irreversible data reshaping begins.

  1. Set disablePostDeployMigrations before deploying

    Before the new minor's server is deployed, the platform team sets the disablePostDeployMigrations configuration key to true in the self-hosted server configuration. This tells the new server to apply its pre-deploy schema changes, which are additive and tolerated by the previous minor, while holding back the post-deploy migrations that reshape data irreversibly. Done means the setting is committed in the deployment configuration and reviewed by a second person, so it cannot be silently dropped during the rollout.

  2. Deploy the new minor's server at the latest patch

    The team deploys the newest patch of the target minor version, not an early patch, using the deployment method the instance already uses (AWS CDK, Helm, Docker or another supported path). Upgrades must pass through each minor in sequence, so the starting point must be the latest patch of the previous minor. Done means the server pods or instances report the new version and the rollout completes without errors in the startup logs.

  3. Confirm startup and health checks

    The operator confirms that the server starts cleanly, that the health endpoint responds, and that the database connection and Redis cache are reachable. Startup failures are the most common sign that a minor was skipped or that configuration is wrong, so any failure here should stop the sequence and trigger a return to the previous minor. Done means every instance reports healthy and the logs show no schema or migration errors.

  4. Run smoke tests across FHIR, auth and Bots

    The team runs a fixed smoke test suite against the new server, covering FHIR API reads and writes, a sign-in through the configured identity provider, a token issued for a client credentials flow, and a representative Bot execution. The suite should be written and stored before the upgrade so results are comparable. Done means every check passes against the new minor and the results are saved with the change record.

  5. Confirm traffic is served on the new minor

    The operator confirms the load balancer or ingress routes production traffic to the new server and that no requests are still hitting the previous version. They also check the server's reported version in logs and monitoring over a period of normal use. Done means the new minor is the only version serving production traffic, so any problem found later is attributable to the new code. The rollback window is open from this point until post-deploy migrations run.

  6. Hold the rollback window while validating

    The team keeps the instance on the new minor without triggering post-deploy migrations while application owners, clinical or operational users and integration teams validate their workflows. Rollback to the latest patch of the previous minor remains supported only while no post-deploy migrations for the new minor have run. Done means the validation sign-off is recorded, and any defect that requires rollback is handled before the window closes.

  7. Trigger post-deploy migrations manually

    Once validation is signed off, a Super Admin triggers the post-deploy migrations for the new minor manually. This step closes the rollback window: after these migrations have run, rolling back to the previous minor is no longer supported by this path, so the decision must be made with the sign-off record in hand. Done means the Super Admin action is logged with the operator's name, time and change reference.

  8. Confirm migration completion before the next minor

    The team monitors the async migration jobs until they report completion and checks the database and server logs for failures. Migrations on large datasets can run for hours or days, so the next minor should not start until completion is confirmed in the monitoring tools. Done means all post-deploy jobs for the minor are finished, the smoke suite passes again, and the next minor's upgrade plan can begin from a known state.

When rolling back is safe and when it is not

Rollback is safe only to the latest patch of the previous minor version, and only while no post-deploy migrations for the new minor have run. Those two conditions are the core test. If the team upgraded to a new minor, set disablePostDeployMigrations to true, and has not triggered the pending migrations, the database still matches what the previous minor expects, because the new minor's pre-deploy schema changes are additive and tolerated by the old version. Rolling back to the latest patch of the previous minor is then a redeployment of the old image, not a data operation. Confirm the exact patch number against the release list before the window opens, and do not treat an older patch of the previous minor as an equivalent target.

A third condition is easy to miss: the team must not have written data that depends on the new minor's behavior. Records created, updated or indexed through new-minor features, new resource shapes, or Bots and integrations built against the new API may be readable by the old server but wrongly interpreted or rejected by it. Check this with the application owners, not only with the platform team. Review which Bots, Subscriptions and client applications were changed as part of the upgrade, and confirm whether any of them began writing new data during the window. If that has happened, rollback is no longer a clean return to the prior state, even though the schema still allows it.

Once post-deploy migrations have run, rollback stops being the default. Those migrations reshape data in ways the previous minor cannot reverse, so the team has two different options: a forward fix on the new minor, or a restore from backup, which discards writes made since the backup point. Those are separate decisions with separate costs, and they should not be improvised during an incident. Name the owner, the criteria and the approval path for each in the runbook before the upgrade starts, and confirm that the backup needed for a restore has been tested. The runbook should state, in advance, which point in the sequence turns the rollback option off.

How validation differs between staging and production

Staging is where the team first sees the new minor version run against data shaped like production. Because the rollback window depends on post-deploy migrations not having run, staging is also the place to confirm that the pre-deploy schema changes are additive and that the previous minor still tolerates them. Test data matters here. Synthetic FHIR bundles prove that the server starts, that the API responds and that core workflows work, but they rarely contain the edge cases that a data reshaping migration will touch. A representative copy, de-identified where required, exposes those cases.

  • Startup and schema checks: Confirm the new server starts cleanly against a restored copy of the production database with disablePostDeployMigrations set to true.
  • Synthetic FHIR workflows: Run scripted create, read, search and update calls across the resource types your applications use.
  • Representative data sets: Test against a de-identified snapshot that includes unusual resource shapes, large bundles and legacy records.
  • Post-deploy migration rehearsal: Run the post-deploy migrations in staging to measure duration and find failures, but treat staging timings as indicators, not guarantees for production.
  • Limits: Staging cannot prove production load, network paths to devices or Agents, or how real users behave during the window.

Confirm the test scope, data copy method and privacy controls with your own environment and compliance owners before relying on staging results.

The decision path from deploy to rollback or forward fix

The path starts when a team deploys a new Medplum minor with disablePostDeployMigrations set to true, so only additive schema changes have run. The team then validates the new version and checks whether any post-deploy migrations have started. If none have run, the team can hold, roll back to the latest patch of the previous minor, or hand off to a Super Admin to trigger post-deploy migrations manually. Once those migrations finish and are monitored, the team moves to the next minor.

Decision path from a deferred-migration deploy to rollback, hold or forward fix.

What makes a rollback-safe upgrade take longer

This table lists the factors that stretch a Medplum minor upgrade once you commit to keeping a rollback window open. Read each row as a question to answer before scheduling, since the effect on the work and the way to reduce it depend on your own dataset and environment. The main takeaway is that the rollback window lasts only until post-deploy migrations run, so the time spent validating before triggering them is what most teams underestimate.

DriverEffect on the workHow to reduce it
Dataset sizePost-deploy migrations can run for hours or days on large datasets, so the window before migrations are triggered may stay open for a long time.Measure row counts and table sizes in a staging copy, and ask the vendor which migrations reshape the most data in your version.
Expected migration durationLong runs delay the next minor and extend the period in which the team must keep both versions in view.Schedule a rehearsal on a production-sized copy and record how long each post-deploy migration takes before setting a change window.
Custom Bots and integrationsEach custom Bot, Subscription and integration must be tested against the new version before you confirm that rollback is still a safe option.Inventory every Bot and integration, assign an owner to each, and keep a test script that exercises them on staging.
Number of minors to crossEach minor is a separate stop with its own validation, and the rollback window applies only to the latest patch of the previous minor.Plan the full path of minors in advance and decide in writing whether each stop will keep its rollback window open.
Staging environment availabilityWithout a staging environment that mirrors production, validation happens on live data and the decision to trigger migrations is made with less evidence.Confirm that staging uses the same configuration, database engine and approximate data volume before the upgrade begins.
Sign-off participantsTriggering post-deploy migrations is irreversible for rollback purposes, so each approver adds a review step and possible delay.Name one decision owner, define the evidence each approver needs, and agree on the sign-off order before the change window.

Questions teams ask before they upgrade Medplum

Can our team run a Medplum minor upgrade on its own?

Yes, if your team already operates the stack and can work through each minor version in sequence. Medplum's upgrade guide says self-hosted servers must move through each minor version in order, and skipping versions causes startup failures. The harder parts are staging rehearsals, reading each release for application impacts, and watching post-deploy migrations, which can run for hours or days on large datasets. Teams without a staging copy of production data, or without someone who owns the database, usually find the work takes longer than planned. Confirm your capacity against the full path before committing.

What does the upgrade need from our team?

Plan for named owners in four areas: the platform (Kubernetes, AWS CDK or Docker), the database, application teams who build Bots and integrations, and the compliance or change approver who signs off each stop. You will need a staging environment that mirrors production sizing, a recent backup you have tested, and access to the Medplum admin pages that show async job progress. Application teams should check the changelog for breaking changes before the staging run, not after. Ask any partner to state which of these items they expect you to provide.

How long does the rollback window stay open?

The window stays open for as long as no post-deploy migrations for the new minor have run. Medplum's rollback guide says that with disablePostDeployMigrations set to true, you can roll back to the latest patch of the previous minor only under that condition. The window length depends on how long you need to validate the new version, how quickly your team can run smoke tests, and whether business owners accept running the new minor without its data reshaping. Medplum does not publish a fixed duration in the supplied facts, so ask your team and any partner to write the validation exit criteria into the plan.

What drives the cost of outsourcing a Medplum upgrade?

Cost follows the written scope rather than a list price, and DeployOpen does not publish one. The main drivers are the number of minor versions on the path, the size of your dataset and how long migrations take to validate, the number of environments you need rehearsed, the complexity of your custom Bots and integrations, and whether you run AWS CDK, Helm or another deployment method. One-time work includes assessment, staging rehearsals and the cutover runbook. Recurring costs appear only if you buy a retainer for upgrades, testing or support. Ask for a quote that lists each stop, each environment and each recurring item separately.

Can we roll back after post-deploy migrations have run?

Generally no, not to the previous minor, once post-deploy migrations for the new minor have run. Medplum's rollback guide explains that the irreversible data reshaping happens in post-deploy migrations, while pre-deploy schema changes are additive and tolerated by the previous minor. After migrations run, your recovery path is usually a restore from backup or a forward fix, so the backup must be verified before you trigger them. Treat the trigger as a planned, approved change, not a routine step. Confirm the exact recovery procedure with Medplum's documentation and your database team before the cutover.

What should a Medplum upgrade partner show us in the scope?

A credible partner should write out the version path, including the latest patch of each minor, the point where each post-deploy migration is triggered, and the validation tests at each stop. The scope should name the environments, the backup and restore test, the rollback decision owner, the criteria for moving to the next minor, and the application changes required at any major boundary. It should also state who runs each step, which items are fixed and which are time-and-materials, and what happens if a migration runs longer than planned. DeployOpen delivers fixed-scope engagements agreed in writing before work starts, so ask for that document in any proposal.

Does the upgrade affect our compliance evidence?

It can. Medplum's compliance documentation says compliance is a shared responsibility between Medplum and its customers, so a self-hosted upgrade changes your side of that split. Keep records of each version tested, the change approvals, the backup verification, the migration logs and the rollback decision. DeployOpen prepares systems, controls and evidence for compliance assessments, but it does not issue audit reports or certifications. Ask your assessor which records they expect for a change to a regulated system before the first stop.

How DeployOpen scopes and runs a Medplum rollback-safe upgrade

DeployOpen treats a Medplum minor upgrade as two decisions: what the new version changes in the schema, and when its irreversible data reshaping runs. We scope, build, test and hand over the rollback window around that split, on a self-hosted deployment in infrastructure you control. Every step is written down so your team can repeat it at the next minor.

How we scope

  • The written scope names your current and target Medplum versions, and the minor versions between them.
  • We confirm your deployment method, database setup and where the configuration setting for post-deploy migrations lives.
  • Scope states who runs the manual trigger as a Super Admin and who approves the decision to move forward.

How we build

  • We set disablePostDeployMigrations to true in a staging environment that mirrors production data volumes as closely as possible.
  • We test the new version against your integrations, Bots and custom applications while the rollback window stays open.
  • We write the rollback conditions as a checklist, covering whether any post-deploy migration has run for the new minor.

How we hand over

  • You receive the runbook for the upgrade, the rollback decision tree and the exact manual trigger steps for post-deploy migrations.
  • Handover includes a test record showing the validation performed on the new version before the window was closed.
  • Your team walks through a rollback drill in staging so the procedure is practiced before production use.

How we support

  • Ongoing support and upgrade work for later minor versions can be covered by a retainer agreed in writing.
  • Support covers monitoring the migration timeline and confirming when it is safe to trigger the next step.
  • We update the runbook when Medplum publishes changes to the upgrade or rollback guidance that affect your deployment.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.