Case studies

backup

A Magento shop lost its server together with its only backup

A large Magento shop served around one million customers. Backups ran every day, but they were written to the same server as the shop. When access to the server was lost, the shop and every backup became unavailable at the same time. We describe how we restored the shop and how backups now work in two independent places.

Illustration: a Magento online shop, orders and parcels

1 mln

Customer accounts in the Magento shop

2 miejsca

A backup on the server and outside it

Test

Regular shop restore from backup

From this case study you will learn

  • why a backup on the same server does not protect against losing the server
  • in what order we restore a Magento shop: database, media, configuration
  • how a two-location backup with separate credentials works
  • how to check that a backup really brings the shop back up

The shop ran on Magento 2 and served around one million customer accounts. The catalogue held tens of thousands of products, and traffic grew many times over during promotions. The whole platform ran on a single server: the application, the MySQL database, the media directory and the cron jobs.

The starting point

Backups existed on paper. Every night a script took a database dump and an archive of the media directory. The problem was where they went: both backups were written to a directory on the same disk as the shop. Nobody checked whether such a backup could bring the shop up on another server either.

What happened

The client lost access to the server. The shop went down, and every backup became unavailable together with the server. There was no second place to take the order database, customer accounts or product images from. Every hour of downtime meant lost orders and messages from customers who could not log in.

How we restored the shop

Magento admin panel, orders and sales
After the restore we check in the Magento admin that orders and customer accounts are complete. Illustrative screenshot.

First we secured whatever could be recovered from the old server's disk and copied the data off it. In parallel we prepared a new server with the same versions of PHP, MySQL, Elasticsearch or OpenSearch and Redis that the shop used.

We restored the shop in a fixed order:

  • the database from the last consistent dump,
  • the pub/media directory with product images,
  • app/etc/env.php and the service configuration,
  • the application code in the version that matches the database.

After the restore we rebuilt the indexes and the cache. Before switching the DNS records we checked customer login, the basket, payments and order saving on a copy of the shop available only to the client team.

Backups in two places

Backup diagram: a local copy and an off-server copy with separate keys
Backup storage outside the shop server, with its own account and keys. Illustrative diagram.

Once the shop was back, we changed how backups are taken. A backup now follows two independent paths.

Local backup

It stays on the server and makes it quick to undo a bad change, for example a failed module update. It is not the only backup and does not protect against losing the server.

Off-server backup

It goes to separate backup storage in another location. It has its own account and keys, so someone with access to the shop server cannot delete it. It covers a consistent database dump, the media directory, the configuration and the code version. The database is backed up more often than media, because it changes with every order.

Monitoring checks the age of the latest backup in both places. If a job fails, an alert goes to an administrator.

Restore test

Restore test chart: measured time against the RTO target
We run the restore test on a separate machine so production is not touched. Illustrative chart.

A backup only matters if the shop can be started from it. On an agreed schedule we restore the shop from the off-server backup to a separate test environment. We check login, the basket and order saving, and record how long it takes to bring the shop up.

Result

The shop is selling again on a new server. Losing the server no longer means losing the backups, because the most important backup lives outside it with separate credentials. The client knows how long a restore takes, because the procedure is tested regularly.

Summary

A backup on the same server protects against an application error, but not against losing the server. A shop with a million customers needs two independent backups, separate credentials and a regular restore test.

Write to us
Other

Other case studies

A media CDN for Magento: private S3 and CloudFront without moving the shop

A Magento shop with several domains kept product images, manuals and editor files on the application disk. The disk grew to hundreds of gigabytes and blocked scaling. We moved pub/media to a private S3 bucket and served media through CloudFront. The shop itself stayed on its existing server.

An EKS cluster for tens of thousands of pods, upgraded without downtime

We built an Amazon EKS cluster where Karpenter matches EC2 nodes to the load and data lives on EFS and S3. We run tens of thousands of pods on hundreds of nodes there and upgrade the cluster regularly without interrupting the applications.

The S3 bill dropped from $20,000 to $1,500 a month

The client was overpaying for AWS: data in an expensive S3 class, oversized instances, an EKS cluster on paid Extended Support and data transfers for partners at its own cost. We went through the bill line by line, removed the causes and set up a daily cost view in Grafana.

A 1 TB copy and a restore that took several days

The copy was 1 TB. After an outage the team restored the whole disk, while the service only needed a few files to run. Transfer, verification and bringing the machine up took several days. In this case study we describe how we split a start restore from the full image, so the service returns to traffic without waiting for the whole set.

A production database in a container without a persistent volume

The production database ran in a container. A restart, a node drain or a new image left an empty data directory. The application came up. The data did not. In this case study we show why database state cannot live in the image writable layer, and how we arranged a volume, a copy and a restore exercise.

AWS without a landing zone and without cost control

The AWS account grew without a landing zone, without a list of instance types and without a cost trail during the week. The bill arrived only with the invoice, at the end of the month. In this case study we describe how daily reports, threshold alerts and instance-type order went in, and what that did to the bill.