• Shopware Gold Partner & Shopify Partner
Shopware staging and backup: what a test system and a backup look like that hold up when it matters

Shopware staging and backup: what a test system and a backup look like that hold up when it matters

Why this is a matter for management

Staging and backups cost money in daily operations and seem to deliver nothing. Their value shows in three situations: before every update, when something goes wrong, and when you change agency. In all three, the quality decides whether you lose hours or days. As managing director you do not need to know how to build it, but you should know exactly what you have.

Staging environment and staging mode: two different things

The staging environment is a complete, separate copy of your shop: its own domain, its own database, its own code version from the repository. Your agency builds it. Shopware itself copies nothing for this.

Staging mode is a Shopware feature available since version 6.6.1.0. It is enabled on the copy with the command system:setup:staging and turns a copy into a safe test system. It does six things:

  • It removes apps with active connections to external services, together with their integrations.

  • It resets the instance ID that apps use to register with the shop.

  • It switches off email delivery.

  • It rewrites shop URLs to the staging domain, if configured.

  • It checks that no search indexes for OpenSearch or Elasticsearch exist yet.

  • It shows a notice in storefront and administration that this is a test system.

This command must never run on a live shop, because it removes exactly what the live shop needs.

The underestimated danger: test systems talking to real systems

The email to a real customer is the well-known mistake. Another one is more dangerous: a copy of the shop contains all credentials of the live environment. Without staging mode, the test system connects to the same services as the live shop:

  • ERP and inventory: a test order lands in the warehouse as a real order.

  • Payment providers: notifications, so-called webhooks, go to the wrong environment, or test payments run through the live account.

  • Marketing and analytics apps: test data distorts revenue figures, customer segments and campaigns.

  • Apps from the Shopware Store: they are tied to the shop through an instance ID. A copy with the same ID can write data into the live connection.

That is why staging mode removes these apps and resets the instance ID. The apps are then reinstalled on the test system and get their own ID. Shopware names three strategies for this. For a copy such as staging, the right one is to generate a new shop ID and reinstall the apps. The option to keep the shop ID is intended only for a permanent move and is dangerous on a copy.

How we build Shopware staging

  1. Code from the repository: the test system is deployed from the same Git version as the live shop, not by copying files. This guarantees that both environments run the same code.

  2. Own domain and access protection: for example staging.your-shop.com, with password protection and no search engine indexing. The APP_URL in the configuration points to this domain.

  3. Database with anonymised data: the export runs through the Shopware CLI with the options for a cleaned and anonymised dump. Personal data never reaches the test system. Which additional fields are anonymised and which tables are skipped is defined in a configuration file in the project.

  4. Separate infrastructure: database, Redis and search service are not shared with the live shop. For OpenSearch or Elasticsearch, staging gets its own index prefix, otherwise the indexes overwrite each other.

  5. Enable staging mode and define in staging.yaml: mail delivery off, notice banner on, rules for rewriting domains.

  6. Reinstall apps so they get their own instance IDs and are fully separated from the live system.

  7. Assign the licence correctly: the staging domain is listed in the Shopware Account as a test shop, not as a second live shop. More in Transferring Shopware licences.

Domain rewriting has three rule types: exact match, prefix and regular expression. In practice the prefix rule is the most robust, because paths such as /en or /ch are kept. We check regular expressions particularly carefully. Even a hyphen in the domain can cause a rule not to match, leaving links on the test system pointing to the live shop.

How current does staging need to be?

A test system with data from a year ago tests a shop that no longer exists. Before every major update and every major change, staging is therefore refreshed with a current, anonymised data set. In shops with a lot of product data from PIM or ERP, a current sync of that data is part of it.

Backup: the two numbers you should know

Two metrics from IT operations answer whether a backup is sufficient. You should define both with your agency:

  • RPO, Recovery Point Objective: how much data may be lost in the worst case? With a daily backup at midnight, it is up to 24 hours of orders. For a shop with high order volume that is too much.

  • RTO, Recovery Time Objective: how long may the shop be down after an outage before it runs again? This determines how the backup must be stored and whether a ready restore procedure exists.

The backup strategy follows from these two numbers, not the other way round. Without them you have a backup, but no strategy.

What a complete Shopware backup includes

  • Database: products, orders, customers, settings. For a small RPO, in addition to regular backups, the database's ongoing change logs, so the state can be restored to shortly before an outage.

  • Media and files: product images, documents, generated invoices. Depending on the setup they live on the server or in object storage such as S3 and must be backed up there.

  • Code and configuration: the Git repository with history. Plus the server configuration: PHP settings, web server, cron jobs and the services for the message queue and scheduled tasks.

  • Credentials: the environment variables from the .env file and the Composer credentials, stored separately and encrypted, never in the repository.

Where and for how long backups are kept

  • In a second location, separate from the server and ideally from the shop's host. A backup on the same server is lost along with it in a server failure or an attack.

  • Encrypted, because a database backup contains all customer data.

  • With retention periods, for example daily versions for two weeks and weekly ones for three months. That way you can also roll back an error that only shows after days.

  • Additionally before every intervention: immediately before every update, plugin installation and larger data change such as a bulk import.

The restore test

A backup that has never been restored is an assumption. We regularly restore backups to a test system and check that the shop runs completely: home page, products with images, customer account, checkout, administration. We also measure how long the restore takes. That is the honest answer to the RTO question.

Why this matters when you change agency

During a switch there is a moment when the old agency leaves and the new one does not yet know everything. That is exactly when a current, verified backup must be in your hands, not only on a server of the current agency or its host. With every takeover, a complete backup and our own test system are therefore our first technical work package. Only then does anyone touch the code. How the handover of access works is covered in Shopware agency won't hand over access.

What to ask your agency

  • Is there a test system, and when was it last filled with current data?

  • Does it run in staging mode, and are apps, payment providers and ERP separated from the live system?

  • Is the data on the test system anonymised?

  • Which RPO and RTO are agreed, and are they in the SLA?

  • Where are the backups, who has access, are they encrypted?

  • When was the last successful restore, and how long did it take?

How we do it at arboro

Every shop we look after has a test system in staging mode with anonymised data and separate infrastructure. We define RPO and RTO with you and record them in the SLA. Backups are stored encrypted in a second location and restored regularly. We test every update on staging first, as described in Shopware 6 update. arboro.PULSE then monitors the shop continuously, from checkout to structured data. More on arboro.PULSE and Switch your Shopware agency.

How test systems, backups and updates are built into our ongoing care is described on Shopware & Shopify support.

Frequently asked questions

The staging environment is the separate copy of your shop with its own domain and database. Staging mode is a Shopware feature since 6.6.1.0 that makes this copy safe: it switches off emails, removes apps with external connections, resets the instance ID and rewrites the domains.

Better not. The Shopware CLI can anonymise personal data during export. Orders and customers with anonymised names and addresses are enough for testing.

RPO defines how much data may be lost in the worst case, for example how many hours of orders. RTO defines how long the shop may be down after an outage. Both numbers determine how often and how backups are made.

Only if you know what it contains, how long it is kept, where it is stored and how quickly you can get the data yourself. Many hosts back up the server but not specifically database, media and credentials, and a restore has never been tested.

Author

Support

Test system and backup that hold up when it matters

Staging in staging mode, anonymised data, RPO and RTO in the SLA, regular restore tests. That is how we look after every shop.