Discuss your task

Search

Start typing to search articles, cases, and services.

↑↓ navigate Esc close

How to Back Up a Static Site and Verify It Works

A complete backup of a static site consists of several independent layers: source code, CMS content, media files, environment variables, and DNS records. Git stores only the first of them, and the rest are backed up separately, each with its own mechanism. A copy counts as working only after you have deployed it once on a separate domain and checked the result.

Across maintenance projects, Exceltic.dev keeps running into the same setup: a repository on GitHub, content in a cloud CMS, media in the vendor’s storage, and the domain with a separate registrar. Formally, every provider has backups, but nobody holds a single snapshot the whole site can be rebuilt from.

Built-in export mechanisms exist almost everywhere. In Sanity it is a dataset export into an archive (Sanity documentation); with DNS providers it is a zone export into a text file (Cloudflare documentation). The problem is not the tooling - it is that nobody pulls these mechanisms into a single process.

As of Q3 2026, Exceltic.dev projects have not run into a setup where one provider covered every layer at once. Below is a layer-by-layer breakdown and the sequence for a restore drill.

The problem surfaces at the worst possible moment - when the site is already down. The code is right there in the repository, but there are no articles, no images, no form keys, and no DNS records. Recovery runs on memory, and the two hours of downtime you planned for turn into a day and a half.

Site backup: the set of data that is enough to bring up a working copy of the site from scratch on clean infrastructure.

Why “everything is in git” is not a backup

Git stores source code and its change history, and nothing else. Everything that lives outside the repository never makes it into the copy, and that is most of what the site actually contains.

Content from a headless CMS is stored on the vendor’s side. The repository holds the page template and the API query, while the text and the relationships between records sit in the cloud. This setup is covered in the piece on site architecture with Astro and Sanity.

Uploaded media files sit in the CMS storage or in object storage: a repository carrying hundreds of megabytes of images is awkward to work with, so nobody commits them on purpose.

Environment variables - form keys, analytics tokens, credentials for external APIs - live in the deployment platform’s dashboard. They are kept out of git for security reasons, which also means they are absent from the backup.

DNS records and the domain have nothing to do with the code: they live with the registrar, and if you lose access to that account, the repository will not save you. A separate case is when git itself is not a copy: a single instance of the repository at one host plus a blocked account means losing both the code and the history.

What exactly to back up on a headless site

A complete copy of a headless site is assembled from six layers, each with its own storage location and its own export method.

  1. Source code and history. The entire repository, with branches and tags. A real copy is a clone somewhere else, not a second address with the same provider.
  2. CMS content. A dataset export in a machine-readable format. Most headless CMS platforms provide this out of the box - through their own CLI or an export API.
  3. Media files. Images, PDFs, video. These are exported separately: a content export often contains only links to the files.
  4. Configuration and environment variables. Configuration files live in git, variable values do not. You need an encrypted file with the current values.
  5. DNS and the domain. A zone export in text form, plus a note on which registrar holds the domain and when it renews.
  6. Certificates. On managed platforms they are issued automatically and need no separate copy. On your own server, certificates and private keys are part of the backup (Let’s Encrypt documentation).
Nightly job skeleton - content, media, configuration
DATE=$(date +%F)
mkdir -p backup/$DATE

# 1. CMS content - export with the vendor's own tooling
#    (the exact command depends on the CMS, see its documentation)
cms-export --out backup/$DATE/content.tar.gz

# 2. Media - a separate export from storage
rclone sync remote:site-media backup/$DATE/media

# 3. Environment variables - encrypted only
gpg --encrypt --recipient ops@example.com .env.production

# 4. DNS zone - export into a text file via the provider's API

How long restoring each layer takes

Layers restore at different speeds, and total downtime is set by the slowest of them.

Recovery time objective (RTO): how long you are willing to keep the site unavailable while recovery is in progress.

Recovery point objective (RPO): how much recent work you are willing to lose, that is, how old the latest copy is allowed to be.

The numbers below are estimates for a marketing site of 200-400 pages, not guarantees.

LayerTypical timeLimited by
Code, build, and deploy10-25 minutesclone speed and the platform’s pipeline
CMS content20-60 minutesdataset size and import speed
Media files1-4 hoursstorage volume and available bandwidth
Environment variables10-30 minuteshaving an up-to-date list of values
DNS10 minutes to 48 hoursrecord TTL and caching at providers
Domain, if access is lostdaysthe registrar’s procedures

The nastiest layer is DNS. If a record points at failed infrastructure and the TTL is set to a day, some users will keep landing on the old address for another day.

Lowering the TTL to a few minutes in advance removes the problem, but only for planned work. The same trick applies when moving a site to a different host.

What a working static site backup looks like

A working plan is four recurring procedures with a clear schedule and one owner, not a folder of archives on somebody’s laptop.

1. Regular content exports from the CMS

The frequency follows your acceptable data loss: if content gets edited once a week, a daily export is more than enough.

The export has to leave the vendor - into another provider’s storage or a private repository. Keep several generations: seven daily, four weekly, twelve monthly. Content corruption is rarely noticed the same day.

2. A media copy kept separately from the CMS

Media is backed up by a separate job: a content export usually hands you links to files, not the files themselves. Checking this takes a minute - unpack the latest archive and look for images inside it.

The sync runs incrementally into separate storage. Monitor the size, not just the fact that the job ran: a copy that suddenly shrinks by a third is a warning sign.

3. Versioning configuration and environment variables

The repository holds a template with every variable name and no values. The values themselves go into a secrets manager or an encrypted file that at least two people can open.

When you add a variable on the deployment platform, update the template and the values file the same day. Drift between them only shows up during recovery.

4. A document with access details and DNS records

One file that records which registrar holds the domain, who owns the account, which DNS provider, deployment platform, and CMS you use, and what the mail records are. Next to it, a fresh zone export.

None of these four procedures survives as a one-off task: they work only if somebody runs them on schedule and notices an export that did not happen. In teams without a dedicated infrastructure engineer, this is covered by ongoing site maintenance: monitoring, backups, and small fixes on a subscription.

How to verify that the backup works

A backup counts as working only after the site has been brought up from it once. Until then you have archives, but no recovery plan.

The copy is deployed from scratch on a separate temporary domain, following a written runbook, without touching production. The key rule is that the person restoring the site is not the person who set it up: if the runbook makes sense only to its author, it is not a runbook.

The test environment must be closed off to search crawlers, otherwise duplicates of the main site show up in search results. How to do that reliably is covered in the piece on protecting a staging site from indexing.

On the restored copy you check five things: page count against the sitemap, media rendering, form submissions, redirects, and whether environment variables are substituted correctly. You record the time for each step - that is your measured recovery time objective.

In a typical maintenance project, the first restore drill for a 300-page site takes 4-6 hours instead of the expected hour and a half. Around 40 minutes goes into hunting down current environment variable values, and roughly another hour into media that turned out not to be in the content export.

The second restore of the same site, using the corrected runbook, fits into 60-90 minutes, and downtime becomes a known quantity. It is worth repeating every six months, and after any change of CMS, host, or storage structure.

Common mistakes

Most recovery failures are caused not by missing backups, but by incomplete ones that were never tested.

  • The copy sits in the same place as the original. An archive in the same account protects you from neither a suspension nor an accidental project deletion.
  • Nobody checks whether the job actually runs. The nightly export fails for months and is discovered on the day of the outage. You need a notification on success, not only on error.
  • Media is assumed to be part of the CMS export. The archive ends up holding links, while the files themselves stay in storage that nobody ever copied.
  • Environment variables are not written down anywhere. They get restored by reissuing keys, and forms, analytics, and email notifications break along the way.
  • The domain is registered to an employee’s personal account. The site is technically intact, but there is nobody to manage it: when that person leaves, access walks out with them.
  • The restore was never rehearsed. The runbook exists as a verbal agreement, and it gets read for the first time under pressure.

Who this matters most for

Layer-by-layer backups pay off unevenly. They matter first of all for sites that generate leads: for a marketing site running paid traffic, a day of downtime costs a full day of ad budget plus the inquiries you never received. Next come companies where several non-technical people manage the content: there, an accidentally deleted section is more likely than an infrastructure failure. A separate category is teams whose site was built by a contractor who still holds the credentials: for them the first step is not a backup but an inventory of access.

Frequently asked questions

How often should you back up a static site?

Backup frequency for a static site is driven by content, not code: the code is already versioned in git with every commit. CMS content and media are backed up according to your acceptable data loss - if the site is updated once a week, a daily export with seven retained copies is enough. For daily publishing, content is exported every few hours. Configuration, environment variables, and DNS records are updated in the backup on an event basis, whenever the infrastructure changes.

Are the backups your host makes enough?

No, unless the entire site lives on that host. A deployment platform snapshot covers what is deployed on it: the built files and the project settings. Content held in a cloud CMS from another vendor is not included, and neither are DNS records at the registrar. The second limitation is retention: snapshots are kept for a limited time, so corruption you notice a month later has nothing left to restore from.

Can you store content directly in the repository and forget about CMS backups?

Yes, for sites where developers edit the content this works. Articles stored as Markdown files are backed up together with the code, and one layer drops off the list. The limitation is elsewhere: a site like this is awkward for an editor without git access. As soon as a marketer joins the content work, a CMS appears, and with it a separate layer to back up. Media, environment variables, and DNS stay outside the repository in any scenario.

Do you need to test the backup if the export completes without errors?

Yes. A successful export tells you only that the process finished, not that the archive can be restored from. A typical case: the content export runs without errors for months, but inside it there are links to images while the files themselves sit in storage that was never backed up. This gets discovered at the moment of recovery, when the site is already needed. A restore drill every six months is the only reliable answer.

What to do this week

Four steps, each of which fits into a single evening:

  • Write down, layer by layer, where each part of the site physically lives: code, content, media, environment variables, DNS.
  • Set up a regular export of content and media out of the vendor that stores them.
  • Put together a document with access details and a fresh DNS zone export, available to at least two people.
  • Schedule a date for a restore drill and run it with someone who did not set the site up.

If your site brings in leads and you have no recovery plan, or you have never tested the one you have, describe the task to the Exceltic.dev team. We will go through what is being backed up now, what falls outside the copy, and build a recovery plan with measured downtime.

More articles

All
Get in touch your way
WhatsApp Telegram

Before you go: a free estimate

Describe your task in a few words and we propose a solution, a stack and a quote with timelines.

Three areas with one team: software, web development and CRM implementation. Over 100 projects, and the project is run directly by an engineer, in Russian and English.