Versions, recovery points and rollback

What a rollback changes, when it can break a site and when Fleet offers a database restore.

What it is

Every deploy of a site Fleet created records a version, which is a Worker version in your Cloudflare account, and a database recovery point taken before the deploy starts. A rollback puts an earlier version live. A database restore returns the database to a recovery point. The two are separate, and the Rollback dialog offers the restore when the rollback needs it.

How it works in Fleet

Versions. Rollback lists the 10 newest versions Fleet recorded for the site, except the live one, for as long as Cloudflare still holds them. After a deploy or update that failed once it was live, the dialog also offers the current version, labeled "Version <n> (current)".

Recovery points. Before each deploy Fleet records a D1 Time Travel bookmark of the site's database. Cloudflare keeps a recovery point for 30 days on Workers Paid and 7 days on Workers Free. When the point a rollback would restore is older, the version shows Recovery point expired. It still offers a code-only rollback when no later version changed the database, and is otherwise not offered.

Code-only rollback. A rollback changes code and bindings only. D1, R2 and KV contents are not rolled back. Every version keeps the site's encryption key, so a rolled-back site reads its stored secrets as before. Fleet offers it without a warning when no later version ran a database migration.

Rollback across migrations. When later versions changed the database, Fleet warns "Versions after this one changed the database, so rolling back the code alone can break the site." and offers two choices:

  • Restore the database to the earliest recovery point recorded since the target and put the target version live. Content created since that point is lost. You confirm by typing the site name.
  • Roll back the code anyway, available after you select its checkbox.

When no recovery point is known to come before the database changes, Fleet cannot restore the database and does not offer that target. Fleet also disables Rollback, with the reason, when a resource the version used (an R2 bucket, a KV namespace or a queue) was deleted, because Cloudflare would refuse it.

Database restore. Fleet puts a maintenance version live first, which answers every request with a 503 and pauses the site's scheduled work. It then restores the database, puts the version live and checks the site. For 7 days after a restore, the site page offers Undo restore, which returns the database to its state before the restore and puts the previous version live.

Rules and limits

  • A restore needs the permission to restore databases, which Owners and Admins hold, and a sign-in within the last 30 minutes. An API token cannot restore.
  • A member who can deploy but not restore can still confirm a code-only rollback after the warning.
  • Cloudflare allows 10 restores per 10 minutes for one database.
  • If Fleet cannot confirm a restore, the previous version is live again and Fleet offers Undo restore. If the restore ran but the version could not be put live, Retry puts it live without restoring again. See Rollback asks for a database restore.
  • Fleet never deploys a linked site, so a linked site has no Fleet version or recovery point.

Related how-tos

Report a problem with this page