Static Sites & Deployment

Atomic Deployment

Definition

Atomic deployment describes a publish with no in-between state. The new files are assembled somewhere the public cannot reach, checked for completeness, and only then made live by one instantaneous switch — typically repointing a symlink or a routing entry from the old release directory to the new one. Compare that with copying files one at a time over the top of a running site, which is what a plain FTP upload does: for the seconds or minutes the copy takes, the site is part old and part new. The word is borrowed from databases, where an atomic transaction either happens completely or does not happen at all. In practice the term also implies the previous release still exists afterwards, because keeping it costs almost nothing and makes going back trivial.

Why It Matters

Non-atomic publishing produces a class of bug that is hard to reproduce and easy to dismiss. A visitor loads the new markup while the stylesheet it names is still uploading, gets a 404 for the CSS, and sees a page with no layout at all; by the time they mention it, the upload has finished and the site looks perfect. On a site taking 30,000 visits a day, a two-minute non-atomic upload puts that broken page in front of roughly forty people. An atomic switch removes the window rather than shrinking it. It also removes the temptation to upload only the files that changed, which is how sites end up serving markup that points at assets deleted three publishes ago.

How It Works

Each publish writes into a fresh directory named for that release, so nothing is ever overwritten in place. The host then verifies the upload arrived intact — a file count, a total byte count, or a checksum per file — before treating the release as valid. The switch itself is a single pointer change taking microseconds: requests that arrived a moment earlier finish against the old directory, requests arriving a moment later are served from the new one. Caches are the remaining seam, so an atomic host usually purges or revalidates its edge caches as part of the same step. Going back is the same operation in reverse, pointing the site at the previous release directory, which is still sitting there untouched.

Real-World Example

A recruiter keeps a static microsite of 60 job pages. Under her old FTP workflow a full upload took about four minutes, during which the index page listed roles whose detail pages had not landed yet. She now publishes the whole folder to 99helpers in one action, and 'roles-northwest.99helpers.site' serves the previous version right up to the instant it serves the new one. Not-found errors in her analytics during publishing windows went from a handful every week to none at all.

Common Mistakes

  • Uploading over the live site with an FTP client and calling it a deployment — the site is inconsistent for the whole duration of the transfer
  • Publishing the new files atomically but forgetting the cache — visitors keep getting the old markup for as long as its lifetime allows
  • Deleting the previous release as soon as the new one is live — the switch was atomic, but there is now nothing to switch back to

Related Terms

Put a file online in seconds

Drop in a document, an image, a page or a whole static website and share the link — free, with no build step and no server to set up.

Host a file free →